Skip to content

[BUG][model][AWQ] Unsafe AWQ scale folds in several definitions change the full-precision output #4175

Closed

Description

@Qubitium

Severity: high — AWQ quantization degrades or corrupts these models
Version: 7.11.0 @ 6c3421c

How this was checked

  1. Run the real awq_get_modules_for_scaling on meta features, then AWQProcessor._validate_scale_group.
  2. For each emitted group, apply the fold without quantization to a tiny real CPU layer and compare outputs.

A correct fold leaves the output unchanged (about 1e-7). Every case below passes validation but changes the output.

Model Where Problem Output diff (neutral fold)
Intern-S2-Preview, MiniCPM-V-4.6 intern_s2_preview.py:58-66, minicpmv_4_6.py:35-43 Copied the Qwen3.5 linear_attn tree but dropped the :in=x tags. input_layernorm is folded into in_proj_qkv only, and in_proj_z/a/b read x/s uncompensated, in every linear-attention layer. 9.7e-3 (vs 2.4e-7 with the Qwen3.5 tree)
MiniCPM-V, MiniCPM-o minicpmv.py:42-44, minicpm_o.py:219-221 q_proj:0, k_proj:1, v_proj:2, o_proj:3: input_layernorm folds into q only, and q is folded into k although q is not k's input. Validation accepts it because q width equals hidden on Qwen3-8B / Llama3-8B. GPTQ also puts down_proj in the gate/up subset (ungrouped mlp). 3.5e-2 / 1.1e-2
DiffusionGemma diffusion_gemma.py:211 router.proj:! becomes a scale consumer of pre_feedforward_layernorm_2 → experts. The native router reads the raw residual through its own scale-free norm, so expert routing is corrupted. Also, v_proj lacks :nosrc despite a scale-free v_norm (MHA configs only; gemma4.py has the fix). 0.23 (4.8e-7 without the router compensation)
Ricursive (Ripple-65B) ricursive.py:47-53 g_proj is the last entry of group 0, so it becomes o_proj's fold source, but the forward is o_proj(attn * sigmoid(g_proj(h))). v_proj reads lerp(value_residual, h) but is folded with the input_layernorm group (use_valres=True). structural
Qwen4-Exp (qwen4_exp, qwen4_exp_text) qwen4_exp.py:38-70 No norms declared, so o_proj / linear_attn.out_proj become the fold source for mlp.shared_expert.{gate,up}_proj across the hyper-connection residual mixing. Routed experts sharing that input are not compensated. structural
BailingMoe shared experts bailing_moe.py:47 No group ids, so down_proj is calibrated in the gate/up subset on unquantized activations (GPTQ). —

Quality loss (no corruption)

On Qwen3.5 dense and Olmo-Hybrid linear-attention layers, the self_attn entries come first.

  • On linear layers they don't resolve, and the empty subset clears the pending norm.
  • The linear_attn container then becomes the fold source, which apply_scale skips as non-foldable.
  • So about 3/4 of the layers get no input-norm scaling. qwen3_5_moe is unaffected.

Latent

Laguna's and Spark2.5's g_proj become o_proj's source. Today the shipped configs reject this (per-head gating), but a full-gating config would corrupt.

Suggested fix

  • Restore the :in=x tags, regroup MiniCPM-V/o and BailingMoe shared experts, add :nosrc / non-source tags for gated outputs, and add router compensation.
  • Add the full-output neutral-fold test required by .agents/skills/gptqmodel-awq-model-onboarding for each of these definitions.

Found during an AI-assisted review (Claude Code) of 6c3421c; repros were run on RTX 4090/5090 (CUDA 13) and Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmodel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions