Repository navigation
fix(awq): keep the norm fold for linear-attention siblings of an absent block (#4732) - #4751
Merged
Merged
Conversation
…nt block (#4732) #4708's refuse_last_module_fallback drops the last-module fallback when the previous block resolved to no module, which broke Qwen3.5-text, MiniCPM-V 4.6 and Intern-S2 layers: their self_attn block is absent on a linear-attention layer, so the DeltaNet input group lost input_layernorm -> in_proj_qkv/z and AWQ folded nothing. A block that declares the same :in=<tag> input as the absent block is its sibling, not its consumer, so the norm before them is still this block's producer. Track the absent block's input tags and allow the fallback when the following block reads the same tensor.
This was referenced Nov 17, 2026
Qubitium
added a commit
that referenced
this pull request
Nov 17, 2026
) #4751 exempted a block from `refuse_last_module_fallback` only when the block and the preceding absent block shared one `:in=` tag. Hybrid trees whose alternative mixer branches carry no tag still lost the norm -> projection group, so the following block silently fell back to plain quantization: * Granite-4.0-H attention layers (absent `mamba`), * LFM2 attention layers (absent `conv`), * Nemotron-H Mamba and MLP layers (absent `mixer.q_proj`/`mixer.o_proj`/ `mixer.in_proj` siblings), * Ling 2.0 `input_layernorm -> attention.query_key_value` (absent `self_attn` before `attention`). An absent declaration may only take the fold source away when it is a data-flow predecessor of the consumer: it must be declared under the same plan parent as the block and a quantized block of that branch must already have been emitted (#4677's `attention.q_b/kv_b` before `attention.dense`). An absent sibling branch (different plan parent) never is, so the norm still folds. The tagged-tree exemption from #4732 is unchanged. Tests: tiny granitemoehybrid/lfm2/nemotron_h/bailing_moe layers assert the norm group is emitted and that folding it is neutral.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
#4708 added
refuse_last_module_fallbacktoawq_get_modules_for_scaling: when the previous block resolved to no module, the last-module fallback must not fold a norm into the wrong producer. On Qwen3.5-text, MiniCPM-V 4.6 and Intern-S2 that drops a real fold.Those hybrid trees declare
self_attnandlinear_attnagainst the same:in=<tag>input. A linear-attention layer owns noself_attn, so theself_attnblock is absent, but it still declares that tag. The followinglinear_attnblock therefore read the same tensor the absent block would have read: the two are siblings, not producer/consumer. Refusing the fallback there replaced the validinput_layernorm -> [linear_attn.in_proj_qkv, linear_attn.in_proj_z]with the invalidin_proj_qkv -> in_proj_z, which AWQ then dropped at debug level — so the DeltaNet input group folded nothing.Fixes #4732 (regression from #4708).
Fix
Track the input tags of a run of absent blocks and allow the last-module fallback when the following block declares the same
:in=tag. Full-attention layers are unchanged.Evidence
tests/module_tree/test_awq_fold_safety_4175.py::test_minicpmv_4_6_linear_attn_tags_preserve_layer_outputand::test_intern_s2_preview_linear_attn_tags_preserve_layer_outputfail; 9 pass.test_awq_fold_safety_4175.py+test_awq_ling2_fold_4677.py, which fix(awq): do not fold a block that follows an absent declaration (#4677) #4708 must keep green) → 11 passed.ruff check gptqmodel/models/base.pyclean.