Repository navigation
refactor(awq): release width-dropped tracker types to fold declarations - #6650
Merged
Merged
Conversation
The tree-order AWQ planner emits width-mismatched Linear->Linear guesses (fused QKV -> dense, GQA v_proj -> o_proj, MLA latents) that the processor drops after the fallback check. For 37 definitions those guesses were the only difference from the fold declarations, so remove the `awq_groups_from_tree_order` opt-out and pin the declaration plan in the inventory fixture: the diff deletes exactly 55 `drop:width` rows and nothing else. MiniCPM-V 4.6's full-attention branch is removed with its opt-out; every layer now plans from the declarations. Nemotron-H Puzzle and Nemotron Omni keep the tracker explicitly (they inherited it from Nemotron-H) because their data-dependent captures still differ. The remaining 29 of the 66 reviewed candidates stay on the tracker: the stress/perturbation A/B still changes an effective group for 28 of them (empty/absent capture, MHA or MLA width coincidence) and glm4v shares the Glm4vGPTQ parent with two of those. Keeping them is required by the fallback-before-drop rule; they can be released with their own behaviour-evidenced change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
marked this pull request as ready for review
December 1, 2026 12:15
5 tasks done
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
Follow-up to #6650: the merged change left `nemotron_h_puzzle` and `glm4v` without a test pin (their keeps were only comments) and left a blank line after the class header in the definitions whose opt-out was removed. Add both types to `DATA_DEPENDENT_KEEPS` with their reasons so `test_data_dependent_keeps_stay_on_the_tracker` fails if either flag is dropped, and remove the leftover blank lines. Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Dec 1, 2026
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.
Summary
Remove the
awq_groups_from_tree_order = Trueopt-out from 37 model definitionswhose tree-order AWQ plan differed from their fold declarations only by
width-mismatched Linear→Linear guesses (
drop:width). The processor alreadydiscards those groups after its fallback check, so the effective plan is
unchanged; the fixture diff deletes exactly 55 such rows and nothing else.
The other 29 of the 66 reviewed candidates stay on the tracker because a
stress/perturbation or local-port config still changes an effective group
(empty/absent capture, MHA or MLA width coincidence). Releasing them needs
their own behaviour-evidenced change, so this PR deliberately does not release
the full 66.
No issue: this is the maintainer-approved cleanup step before AWQ PR 8 deletes
the tree planner.
What Changed
glm4,phimoe,mllama_text_model,qwen2_5_vl_textandqwen2_vl_textinheritfrom a released parent).
MiniCPMV4_6QModeldrops its full-attention tracker branch; every layer nowplans from the fold declarations (the tracker's only extra group there was a
width-dropped
v_proj -> o_proj).NemotronHPuzzleQModelandNemotronOmniQModelset the flag explicitly(they inherited it from
NemotronHQModel) with the data-dependent reason.tests/module_tree/fixtures/awq_fold_plans.json: 37 types changed,55
drop:widthgroups removed, 0 other changes.tests/module_tree/test_awq_fold_inventory.py: newDATA_DEPENDENT_KEEPSand
test_data_dependent_keeps_stay_on_the_tracker;glm4vis pinnedthrough its
Glm4vGPTQparent.tests/module_tree/test_chatglm_local_port.py,tests/test_awq_scaling_groups.pyandtests/test_ricursive_local_port.pynow pin the declaration plan; the nodes they used to expect were
width-dropped and never folded.
docs/awq-scaling-groups.md: MiniCPM-V 4.6 now plans every layer from thedeclarations, and
DATA_DEPENDENT_KEEPSis documented.Released (37)
bloom, chatglm, glm, glm4, glm4_moe_lite, glm_ocr, glmasr, gpt_bigcode, gpt_neox, gpt_oss, granitemoehybrid, grinmoe, internlm2, jamba, lfm2_moe, minicpm3, minicpmv, minicpmv4_6, minimax_m2, ministral3, mistral3, mixtral, mllama, mllama_text_model, mpt, nemotron_h, phi3, phimoe, qwen2_5_omni, qwen2_5_vl, qwen2_5_vl_text, qwen2_vl, qwen2_vl_text, qwen3_omni_moe, ricursive, starcoder2, voxtralKept on the tracker (29)
lfm2,lfm2_vl: MHA width coincidence makes the tracker'sv_proj -> out_projgroup searchable;out_projhas noorole.dbrx_converted: same width coincidence throughattn_config.kv_n_heads;the local-port test exercises
kv_n_heads == n_heads.deepseek_vl_v2: a dense-Q MLA config makes the tracker'skv_a_layernorm -> kv_b_projfold width-valid;kv_b_projis not afirst-stage leaf, so the declarations never emit it.
nemotronh_nano_omni_reasoning_v3: the MoE group'smixersearch feature(the [QUALITY] AWQ MoE: one starved, unrouted or dynamic-excluded expert sends ALL experts' gate/up to RTN (one all-or-nothing scale group); default AWQ on Qwen3-30B-A3B RTNs all 256 expert gate/up per layer #4675 starved-expert split) has no declaration form.
deepseek_v3,kimi_k2,deepseek_v32,dots3_note,flint,glm4_moe,glm4v_moe,glm4v_moe_text,kimi_k25,llama4,llama4_text,mimo_v2_flash,minimax_m3_vl,xing4_0,ernie4_5_moe,ernie4_5_moe_vl,ernie4_5_vl_moe,falcon,refinedWeb,refinedWebModel,falcon_h1,moss,qwen3_next: anempty/absent capture changes the effective group set (the tracker emits a
group that falls back, keeps a narrower target set, or merges a member the
declarations skip or retarget).
glm4v: stays only becauseGlm4vGPTQis the shared parent of the twoglm4v_moe*keeps above.Tests
E2 (the 189 files in
scratch/e2_files.txt, CPU-only,-n 40):c31a0ec8eBoth failures are environmental/flaky, not planner changes:
test_local_model_loading.py::test_bypass_requires_explicit_trust_and_is_rechecked_on_retryfails on both sides because the sandbox's HF modules cache is read-only, and
test_deepseek_vl_v2_local_port.py::test_routed_and_shared_moe_matches_independent_full_consumer_sum[noaux_tc]is an RNG-dependent routing assertion that passes when run alone on both sides.
Targeted regressions after the local-port findings (19 passed):
A/B evidence
Fallback-before-drop proof.
AWQProcessor._quantize_layercalls_should_fallback_groupatgptqmodel/looper/awq_processor.py:4750, before theDROPbranch atawq_processor.py:4791; the width verdict comes fromwidth_mismatchingptqmodel/quantization/awq/fold_rules.py:244, and thedefault fallback threshold is
"0.5%"atgptqmodel/quantization/config.py:2054(should_use_fallback,gptqmodel/utils/fallback.py:111). Expanding the pre-change fixture shows the37 released types' 55 junk groups target only dense, always-run projections
(0 routed-expert and 0 shared-expert targets; 13 distinct dense leaves). Their
full capture is the whole calibration set, so the 0.5% threshold cannot trigger.
Width-coincidence stress A/B (
scratch/ab_stress.py, base vs branch, everyinventory config variant plus
+mhaand MLA-coincident variants): 102 cases,3410 layers compared, 2533 removed junk groups, 0 non-junk differences.
Capture-perturbation A/B (
scratch/ab_perturb.py, 2 seeds,full,unrouted,absent20,empty20,root_empty, plus+mha): for the 37released types, 608 layer-plan differences and 707 removed junk groups,
0 non-junk differences. The same run found the 25 non-junk types listed
above;
refinedWebwas added because it shares therefinedWebModelclass,and the two local-port configs added
dbrx_convertedanddeepseek_vl_v2.GPU AWQ A/B (GPU index 2, fixed seed/calibration, every saved tensor and
config/text file compared bytewise;
scratch/run_gpu_ab.sh):ibm-granite/granite-4.0-h-350mgranitemoehybrid(released)Qwen/Qwen2-VL-2B-Instructqwen2_vl(released)Qwen/Qwen2.5-0.5B-InstructLiquidAI/LFM2-1.2Blfm2(kept)baidu/ERNIE-4.5-0.3B-PTernie4_5(unaffected)The first three rows were rerun against the rebased
origin/main(
c31a0ec8e); the LFM2/ERNIE rows are the earlier run against53ca01933and cover a kept and an unaffected type.
A
ai21labs/Jamba-tiny-devattempt was rejected before quantization by theartifact-security chat-template check (
UnsafeModelArtifactError), so it isnot counted as evidence.
Model Support / Module Plan
Not applicable as new-model support: no
MODEL_MAPentry, loader, tree orfusion change. This is a definition-data cleanup. The inventory test still
builds every
MODEL_MAPtype and pins every effective plan; the module-planinventory (
registered_module_plans.json) is untouched.AWQ onboarding safety
and remove no effective fold. The inventory pins the full node fields the
processor reads.
affected types;
dbrx_converted(MHA),deepseek_vl_v2(dense-Q MLA),chatglm(post-LN residual),ricursive(GQA/MHA) and the fourfused-QKV families cover the layouts that changed.
Logic Flow Documentation
The dispatch flow is unchanged; this PR moves 37 definitions from the tracker
branch to the declarations branch. The old decision was "definition sets
awq_groups_from_tree_order = True"; the new decision is the class default(
False) plus the declaration set. The removed tracker groups were droppedbefore any fold, so no tensor path changes.
flowchart TD A["BaseQModel.awq_get_modules_for_scaling"] --> B{"awq_groups_from_tree_order?"} B -- "yes: 29 kept candidates" --> T["_awq_generic_get_modules_for_scaling<br/>tree-order tracker"] B -- "no: 37 released definitions" --> C["_awq_nodes_from_declarations<br/>awq_fold_declarations(layer)"] T --> D["tracker plan<br/>includes width-dropped guesses"] C --> E["declaration plan<br/>no width-dropped guesses"] D --> F["AWQProcessor._quantize_layer"] E --> F F --> G{"_should_fallback_group?<br/>line 4750, before drop"} G -- "starved / empty capture" --> H["fallback member or group"] G -- "full capture" --> I{"check_layer verdict"} I -- "DROP width" --> J["skip group<br/>line 4791"] I -- "OK" --> K["scale search and fold"] style H fill:#fff3cd,stroke:#997404,stroke-width:2px style J fill:#fff3cd,stroke:#997404,stroke-width:2pxawq_groups_from_tree_order = TrueFalsedefault; 29 keep the flagbase.py:7857→_awq_generic_get_modules_for_scaling(base.py:7863)base.py:7859→_awq_nodes_from_declarations(base.py:7781)awq_processor.py:4750can fall back before the dropfold_rules.py:244→awq_processor.py:4791drop:widthrowsThe reference page is
docs/awq-scaling-groups.md(updated in this PR).Measured Impact
Not applicable: the change is behavior-preserving for every released type.
The GPU A/B is bit-identical (table above); no VRAM, throughput or accuracy
metric changes.
Review Requirements
Notes
fallback-before-drop rule says to keep any type that can still be affected,
and the perturbation A/B plus two local-port configs show they can.
minicpmv_4_6also loses its full-attention tracker branch, which is theonly code change beyond the opt-out lines.
test_local_model_loadingfailure isenvironmental (read-only HF modules cache).
🤖 Generated with Claude Code