apiversion: modelslim_v1
metadata:
  config_id: deepseek_w4a8_per_channel
  score: 90
  verified_model_types:
    - DeepSeek-R1-0528
  label:
    w_bit: 4
    a_bit: 8
    is_sparse: False
    kv_cache: False

default_w8a8_dynamic: &default_w8a8_dynamic
  act:
    scope: "per_token"
    dtype: "int8"
    symmetric: True
    method: "minmax"
  weight:
    scope: "per_channel"
    dtype: "int8"
    symmetric: True
    method: "minmax"

default_w4a8_dynamic: &default_w4a8_dynamic
  act:
    scope: "per_token"
    dtype: "int8"
    symmetric: True
    method: "minmax"
  weight:
    scope: "per_channel"
    dtype: "int4"
    symmetric: True
    method: "ssz"

spec:
  process:
    - type: "flex_smooth_quant"
      enable_subgraph_type:
        - 'norm-linear'
        - 'ov'
      include:
        - "*"
    - type: "group"
      configs:
        - type: "linear_quant"
          qconfig: *default_w8a8_dynamic
          include:
            - "*self_attn*"
          exclude:
            - "*kv_b_proj"
        - type: "linear_quant"
          qconfig: *default_w8a8_dynamic
          include:
            - "*mlp*"
          exclude:
            - "*gate"
            - "*mlp.experts.*"
        - type: "linear_quant"
          qconfig: *default_w8a8_dynamic
          include:
            - "model.layers.61.mlp.experts*"
        - type: "linear_quant"
          qconfig: *default_w4a8_dynamic
          include:
            - "*mlp.experts*"
          exclude:
            - "model.layers.61.*"
  dataset: mix_calib.jsonl
  save:
    - type: "ascendv1_saver"
      part_file_size: 4