Repository navigation
Closed
Labels
bugSomething isn't working
Description
Follow-up on #4005 / #4030 and #4017 / #4035, at main @ ff8443d.
Method (the tests/test_awq_scaling_groups.py methodology, run over every MODEL_MAP type that builds in transformers 5.22):
- Capture real inputs and build the groups with
awq_get_modules_for_scaling. - Apply the repo's
apply_scalewith a random scale in [0.5, 1.5]. As of fix(moe): scale AWQ norm consumers, split MLA fold groups, guard ERNIE patch, drop padding rows (#4017) #4035 this passes the group's_scale_consumersasconsumer_map, exactly asawq_processor.py:1658-1688does. - Measure the relative change in full-model logits; an output-preserving group is ~1e-7.
Real AWQ scales are usually wider, so the real damage is likely larger.
Re-run on ff8443d. #4035 fixed the router / shared_expert_gate consumers: the GPT-OSS and OLMoE post_attention_layernorm → experts groups are now ~1e-7, Qwen3.5 is clean, and the router-as-prev_op crash for flint/laguna is gone.
These remain:
| family (definition) | group | rel change | cause |
|---|---|---|---|
exaone4_5 (exaone4.py:75) |
post_attention_layernorm → gate/up |
0.60 | the Exaone 4.5 tree re-declares the norm without :postnorm (Exaone4 at :35 has it); #4030 incomplete |
| deepseek_v3, flint, laguna (also deepseek_v2/v32, kimi_k2, glm_moe_dsa, hy_v3, solar_open, axk2, deepseek_v4 by tree shape) | post_attention_layernorm → routed experts and a separate → shared_experts group |
0.049 / 0.080 (dsv3), 0.036 / 0.027 (flint), 0.014 / 0.008 (laguna) | routed and shared experts read the same normed input but are folded as two groups from the same norm, so each fold leaves the other's gate/up unscaled; they must be one group |
cohere (mapped to LlamaQModel, auto.py:298) |
input_layernorm → q/k/v; o_proj → gate/up |
0.061; 0.24 | Cohere is a parallel block (attention and MLP read the same norm); the Llama tree assumes sequential |
| cohere2, cohere2_moe | any norm group | crash | apply_scale → NotImplementedError: Cohere2LayerNorm isn't in allowed_norms (quantization/awq/quantize/scale.py:51) |
falcon / rw (rw.py:20) |
self_attention.dense → dense_h_to_4h; dense_h_to_4h → dense_4h_to_h |
0.25; 0.039 | parallel block; fc1→fc2 across GELU |
gpt_neox (:21), gpt_neo (:26), gpt_bigcode (:20), bloom (:20) |
fc1 → fc2 across GELU |
0.037 / ~0.02-0.05 / ~0.02 / 0.0018 | same class #4030 fixed for gptj/phi/starcoder2 with nosrc; #4030 incomplete |
afmoe (afmoe.py:33) |
self_attn.gate_proj → o_proj; post_attention_layernorm → mlp / shared experts |
0.28; 0.44 / 0.22 | o_proj reads attn * sigmoid(gate_proj(x)); gate_proj:0 is listed after o_proj, so it becomes block 0's last module |
| muse_glimmer, hrm_text | gate_proj → o_proj (gated attention) |
0.10-0.48, 0.002 | same as afmoe (tree reviewer, 8f2efe5) |
olmoe (olmoe.py:38-40) |
self_attn.k_norm → o_proj |
0.29 | full-width q_norm/k_norm without a group index / nosrc (Exaone4 got q_norm:0:! in #4030) |
gemma4_text / gemma4 (gemma4.py:41-42) |
v_proj → o_proj; post_feedforward_layernorm → per_layer_input_gate |
0.30; 0.54 | v goes through a scale-free v_norm (MHA configs; GQA is skipped by width); post-norm used as source (needs :postnorm) |
| gpt_oss | experts.N.up_proj → down_proj |
0.12-0.21 | (clamp(up) + 1) * glu isn't homogeneous in up_proj |
minimax (minimax_m2.py) |
input_layernorm → q/k/v, → o_proj, → qkv_proj; post_attention_layernorm → experts |
0.29-0.30 | not isolated; also minimax_m3_vl (0.20-0.67) |
| falcon_h1 | o_proj → mamba.in_proj; mamba.out_proj → feed_forward; input_layernorm → qkv omits mamba.in_proj |
0.12-0.28; 0.02-0.044 | parallel attention + mamba (8f2efe5) |
laguna (laguna.py:35) |
input_layernorm → qkv omits g_proj:!, which reads the same input |
6.2e-3 | missing consumer (8f2efe5) |
Other AWQ crashes on supported families (8f2efe5):
- olmo: confirmed end to end,
apply_scale failed … OlmoLayerNorm (no weight) not supported yet. - hrm_text: weightless RMSNorm →
AttributeError. - axk2:
AXK2GatedRMSNormwith an inner MLP →AttributeError. - gpt2:
Conv1D→ size mismatch /NotImplementedError. - falcon_mamba:
x_projin the norm group → size mismatch. - deepseek_v4:
attn_hc(HyperConnection) picked asprev_op→NotImplementedError. Alsokv_projgetsprev_op=o_b_proj(0.27-0.52).
Fix:
- Mark post-norms with
:postnormand non-sources with:nosrc(or use the activation asprev_op, as AutoAWQ does withScaledActivation). - Put routed and shared experts in one group.
- Add every same-input consumer to parallel-block groups.
- For weightless norms, either skip AWQ scaling cleanly or fold into the consumers only.
- Extend
FAMILIESintests/test_awq_scaling_groups.pyto every registered dense and MoE family, so these regress loudly.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
fix(awq): correct scaling groups across dense and MoE families (#4039) (