Skip to content

[QUALITY] Regression from #4708: AWQ no longer scales linear-attention in_proj_qkv/in_proj_z on Qwen3.5-text / MiniCPM-V 4.6 / Intern-S2 (absent self_attn block blocks the input_layernorm source; 2 fold-safety tests red) #4732

Closed

Description

@Qubitium

Found on main @ b225a43, CPU (no GPU involved; the test is a pure module-tree check). Regression from e2a5ff6 (#4708, the fix for #4677).

What is wrong

#4708 added refuse_last_module_fallback to awq_get_modules_for_scaling (gptqmodel/models/base.py, prev_block_absent / block_absent). When the block before the current one declared only modules that this layer does not own, the current block may no longer fall back to last_module as its fold source.

Hybrid Qwen3.5-style trees hit this condition on every linear-attention layer. The tree declares self_attn (q/k/v/o) and then linear_attn. A linear-attention layer owns no self_attn.*, so self_attn is an "absent" block. The linear_attn block that follows then refuses its real source, input_layernorm.

So the input_layernorm -> [linear_attn.in_proj_qkv, linear_attn.in_proj_z] group is gone. In its place the selector emits linear_attn.in_proj_qkv -> [linear_attn.in_proj_z]. That group is invalid: in_proj_z reads the norm output, not in_proj_qkv's output. AWQProcessor drops it on the width check ("skipping scaling group due to dimension mismatch", debug log only).

Result: the DeltaNet input projections on every linear-attention layer get no AWQ scale. That is 3/4 of the layers in Qwen3.5 / MiniCPM-V 4.6 / Intern-S2. Nothing is logged at INFO/WARN, so the quality loss is silent. If a config ever had in_proj_qkv.out_features == hidden_size, the bogus group would be applied as a non-neutral fold.

Failing repo tests

tests/module_tree/test_awq_fold_safety_4175.py. Both pass at e2a5ff6^ and fail from e2a5ff6 on:

  • test_minicpmv_4_6_linear_attn_tags_preserve_layer_output
  • test_intern_s2_preview_linear_attn_tags_preserve_layer_output
E       AssertionError: the linear-attention input norm did not fold

Minimal repro

This uses the test's own tiny Qwen3.5 text model, layer 0 = linear_attention and layer 1 = full_attention:

import sys, torch; sys.path[:0] = ["tests/module_tree", "tests"]
from types import SimpleNamespace
import test_awq_fold_safety_4175 as T
from gptqmodel.models.auto import MODEL_MAP
from gptqmodel.quantization.awq.utils.module import get_op_name
text = T._tiny_qwen35_text()
model = T._LanguageModelContainer(text, SimpleNamespace(text_config=text.config))
ids = torch.randint(2, 60, (1, 8)); fwd = lambda: text(input_ids=ids).last_hidden_state
for key in ("minicpmv4_6", "qwen3_5_text"):
    d = MODEL_MAP[key]; layer = text.layers[0]
    _, feats = T._capture(layer, fwd); feats = T._quantized_features(layer, feats, d.module_tree)
    nodes = T._wrapper(d, model, d.module_tree).awq_get_modules_for_scaling(layer, feats, {})
    print(key, [(get_op_name(layer, n["prev_op"]), [get_op_name(layer, m) for m in n["layers"]]) for n in nodes][:1])

Output at b225a43 (main):

minicpmv4_6  [('linear_attn.in_proj_qkv', ['linear_attn.in_proj_z'])]
qwen3_5_text [('linear_attn.in_proj_qkv', ['linear_attn.in_proj_z'])]

Output at e2a5ff6^:

minicpmv4_6  [('input_layernorm', ['linear_attn.in_proj_qkv', 'linear_attn.in_proj_z'])]
qwen3_5_text [('input_layernorm', ['linear_attn.in_proj_qkv', 'linear_attn.in_proj_z'])]

The full-attention layer (layer 1) is unchanged.

Suggested fix

The Ling case (#4677) and the hybrid case differ in one way. In Ling, the absent block (q_b/kv_b) sits between the real producer and the consumer in data flow. In Qwen3.5, self_attn and linear_attn are alternatives that read the same input_layernorm.

Some options:

  • Set prev_block_absent only when the absent block shares a parent branch with the next block (same attention/self_attn key).
  • Do not count a whole sibling branch that is absent on this layer.
  • Keep the refusal, but let the consumer's in=x input tag select the shared norm source. shared_source already exists for Cohere-style shared inputs, so the tag should win over the refusal.

Test that should have caught it

tests/module_tree/test_awq_fold_safety_4175.py caught it: the two tests above are red on main. #4708 ran only tests/test_awq_ling2_fold_4677.py. A guard is needed that runs the whole tests/module_tree/test_awq_fold_safety_4175.py / test_awq_scaling_groups.py family for any change to awq_get_modules_for_scaling.

Severity

Medium. Silent AWQ quality loss on the linear-attention layers (most layers) of Qwen3.5-text, MiniCPM-V 4.6 and Intern-S2 Preview, and on any other tree with alternative sibling attention branches. No crash.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 finished this issue.

    Pull request: #4751

    Restoring AWQ scaling for linear-attention in_proj after the #4708 fold-safety change

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    The same #4708 regression also removes AWQ groups in real end-to-end quantize() runs on three more hybrid families, beyond the Qwen3.5-style trees above. Setup: RTX 4090, AWQConfig(bits=4, group_size=128), 16 C4 rows, batch_size=1, layer-truncated real checkpoints. Groups are the (prev_op, #members, first member) x layers that reached _search_best_scale:

    checkpoint e2a5ff6fa~1 (before #4708) main @ b225a43
    granite-4.0-h-350m (11 layers; layer 10 = attention) input_layernorm -> [mamba.in_proj] x10, input_layernorm -> [q,k,v] x1, mamba.norm -> [mamba.out_proj] x10 the q/k/v group is gone: layer 10 using fallback quantization (no scaling group survived filtering)
    LFM2.5-1.2B-Instruct (3 layers; layer 2 = full_attention) operator_norm -> [conv.in_proj] x2, operator_norm -> [q,k,v] x1, ffn groups x3 the q/k/v group is gone
    NVIDIA-Nemotron-Nano-9B-v2 (15 layers: 8 Mamba, 6 MLP, 1 attention) norm -> [mixer.in_proj] x8, norm -> [mixer.up_proj] x6, norm -> [q,k,v] x1 only norm -> [q,k,v] x1. Every Mamba and MLP layer logs no valid scaling groups ... falling back to plain quantization / no module configuration generated

    The trigger is the same as for Qwen3.5: a sibling branch that this layer type does not own (mamba on an attention layer, self_attn on a Mamba/MLP layer) counts as an "absent" block and refuses the shared norm source. On Nemotron-H this makes AWQ plain RTN for every Mamba and MLP layer, which is almost the whole model. Like the Qwen3.5 case, the only signal is an INFO/WARN fallback line per layer.

    🤖 Generated with Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions