Repository navigation
fix(awq): keep the norm fold for an absent sibling branch (#4759) - #4800
Merged
Merged
Conversation
#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.
Problem
#4751 exempted a block from
refuse_last_module_fallback(#4708) only when the current block and the preceding absent block share one:in=tag. Hybrid trees whose alternative branches carry no tag still lost the norm -> projection AWQ group whenever a sibling branch was absent:mambaon an attention layerinput_layernorm -> [q,k,v]droppedconvon an attention layeroperator_norm -> [q,k,v]droppedmixerattention/mamba/MLP alternativesbailing_moe)self_attnbeforeattentioninput_layernorm -> query_key_valuedroppedFix
gptqmodel/models/base.py:refuse_last_module_fallbacknow requires the absent run to be a data-flow predecessor, not merely absent. It tracks the absent run's plan parents and the plan parents of quantized blocks already emitted since the last declared non-quant block, and refuses the fallback only when both intersect the current block's parents.mamba/self_attn,conv/self_attn,self_attn/attention) is a sibling branch -> the norm fold is kept;attention.q_b/kv_bbeforeattention.dense, [BUG] Ling 2.0 (bailing_moe) AWQ folds attention.dense into input_layernorm with query_key_value: 13-14% logit change per fold (regression from #4429 dense:1 -> dense:2) #4677) -> still refused.The
:in=tag exemption from #4732 is untouched.Tests
tests/module_tree/test_awq_fold_safety_4175.py(+244): four new "the norm still folds" tests with fold-neutrality assertions — tinygranitemoehybrid(attention),lfm2(attention),nemotron_h(M/-/*layers:norm -> mixer.in_proj,norm -> mixer.up_proj,norm -> q/k/v), andbailing_moe(input_layernorm -> [attention.query_key_value], nodense).Red on parent (source stashed, tests kept): 4 failed — "attention input norm did not fold after the absent
mambasibling branch", same forconv, nemotron "type: no foldable AWQ group was emitted", bailinggot []forinput_layernorm.Verification
test_awq_fold_safety_4175.py+test_awq_scaling_groups.py+test_awq_moe_starved_expert_group_4675.py+test_awq_ling2_fold_4677.py: 170 passed, 9 skippedruff check gptqmodel tests: cleanCloses #4759