Repository navigation
refactor(awq): release the empty-capture tracker types to fold declarations - #6675
Merged
Merged
Conversation
…ations Remove the `awq_groups_from_tree_order` opt-out for the 19 types whose full-capture plan differs from their fold declarations only by width-dropped guesses. #6657 keeps a declared fold whose first reader captured nothing, so the declaration path no longer needs the tracker's narrowed/dropped groups. The inventory fixture diff removes exactly 36 `drop:width` groups and no other group; `awq_fold_inventory.py --check` reports `changed: none`. deepseek_v3, kimi_k2 and kimi_k25 stay on the tracker until the `_search_best_clip` KeyError on an uncaptured ungrouped projection is fixed; xing4_0 and minimax_m3_vl keep their separate reasons. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Move the remaining tracker-planned types whose AWQ plan differs from their fold
declarations only in the empty/absent-capture bookkeeping to the declaration
planner: remove their
awq_groups_from_tree_order = Trueopt-out. This is thelast release before AWQ PR 8 deletes the tree planner, except for three types
blocked on a processor crash found while validating this release (below).
#6657 (
fix(awq): keep a declared fold whose first reader captured nothing)landed the declaration-path half of #6630: a declared fold whose first feature
is absent/empty is kept with its full target set and
inp=None, and theprocessor's fallback check owns it. That makes the declaration path the correct
planner for the types this PR releases: under an empty/absent capture the
tracker either drops the group or folds a narrowed target set that omits an
uncaptured reader, while the declarations keep the full set (fold it when every
reader was captured, fall back otherwise).
Full-capture plans are unchanged for every
MODEL_MAPtype: the inventoryfixture diff removes exactly the tracker's width-dropped guesses and nothing
else (
awq_fold_inventory.py --check->changed: none).No issue: maintainer-approved cleanup before the tree planner is deleted.
What Changed
awq_groups_from_tree_order = True. Theline is on the shared class for four of them, so it releases 19 types:
ernie4_5_moe_vl/ernie4_5_vl_moe(Ernie4_5_VLMoeQModel),llama4/llama4_text(Llama4QModel),refinedWeb/refinedWebModel(
RwgQModel) andfalcon(FalconQModel(RwgQModel)).glm4vsharesGlm4vGPTQwith the two releasedglm4v_moe*types; itsperturb A/B is fallback-bookkeeping only (no effective group changes), so it
is released with them instead of adding a pin subclass.
tests/module_tree/fixtures/awq_fold_plans.json: 19 types changed,36
drop:widthgroups removed, 0 other changes.tests/module_tree/test_awq_fold_inventory.py:DATA_DEPENDENT_KEEPSdropsthe released 19;
xing4_0keeps its own MLA-latent reason,minimax_m3_vlgets an MHA tracker-gap reason, anddeepseek_v3/kimi_k2/kimi_k25are pinned on the processor crash below.tests/test_awq_falcon_two_norm_parallel_5414.pyandtests/test_awq_scaling_groups.py: falcon now plans from its declarations;the tracker's width-dropped
query_key_value -> densecandidate is gone, sothe tests assert the surviving norm folds.
docs/awq-scaling-groups.md: documents that an absent/empty capture nolonger keeps a type on the tracker.
Released (19)
deepseek_v32, dots3_note, flint, glm4_moe, glm4v_moe, glm4v_moe_text, llama4, llama4_text, mimo_v2_flash, ernie4_5_moe, ernie4_5_moe_vl, ernie4_5_vl_moe, falcon, refinedWeb, refinedWebModel, falcon_h1, moss, qwen3_next, glm4vKept on the tracker
deepseek_v3,kimi_k2,kimi_k25: a layer with no captured rows keepsits declared folds with
inp=None, and the processor's clip search thenraises
KeyErrorfor an ungrouped projection (self_attn.o_proj) with nocapture.
tests/module_tree/test_deepseek_v3_local_port.pyandtest_kimi_k25_local_port.pyreproduce it; the fix is a separate processorchange (skip clip search for a module with no captured rows), so these three
stay on the tracker until it lands.
xing4_0: the tracker emits a width-validself_attn.kv_a_layernorm -> self_attn.kv_b_projMLA latent fold;kv_b_projis not a first-stage leaf, so the declarations never emit it.minimax_m3_vl: under an MHA config the declarations emit a validself_attn.v_proj -> o_projfold the tracker misses; adopting it changesnumerics and needs its own quality-evidenced PR.
lfm2,lfm2_vl,dbrx_converted(MHA width coincidence),deepseek_vl_v2(dense-Q MLA latent),nemotron_h_puzzle(unrouted sharedexpert),
nemotronh_nano_omni_reasoning_v3(mixersearch feature): thepreviously pinned reasons are unchanged.
Tests
Full-capture stress A/B (width coincidence)
ab_stress.pyover the 19 released types: every inventory config variant plus+mhaand the explicit width-coincidence variants (MHA, MLA coincident, KVshared,
k_eq_v,qk_layernorm), base0127a0313vs branch.Perturb A/B: empty/absent captures
Two seeds of
empty20,absent20,root_emptyandunroutedover everyconfig variant (plus
+mha) of the 19 released types, origin/main (tracker)vs branch (declarations). Every difference is one of:
drop:*group (tracker junk)drop:*group (declaration junk)fallbackgroup added/removed/changedroot_empty/empty20)empty20)No difference adds a group the tracker never had with a different target set,
and no difference changes a full-capture plan. The 15
removed-okcases arethe tracker folding a group that dropped the uncaptured
mlp.gaterouter(qwen3_next), the attention branch of a shared norm (falcon, refinedWebModel,
moss, falcon_h1) or the gate half of a dense gate/up pair (ernie4_5_moe,
ernie4_5_moe_vl); the declaration path keeps those readers and either folds the
full set or falls back, which is the #6630 contract.
Zero-size-module stress (#6663 class)
klearwithn_shared_experts=0(the config-disabled shared expert thatmaterializes as zero-sized Linears, #6663) plus
no_sharedvariants of thereleased MoE types are included in a perturb A/B (
klear,deepseek_v32,glm4_moe,glm4v_moe,glm4v_moe_text,ernie4_5_moe,ernie4_5_moe_vl,flint,qwen3_next; all variants +no_shared++mha,1 seed), with #6663's zero-size-source check applied to both checkouts
(
planned_group->DROP): 384 layer plans over 36 config variants, 0 builderrors, and every base/branch difference stays in the release classes above
(
validate_release.py->problems: 0). The inventory harness does not emita zero-element-source group itself (the planner skips it), so the end-to-end
guard is the #6663 reproducer below.
GPU AWQ A/B
ERNIE-4.5-21B-A3B-PT(ernie4_5_moe, a Group-A2/B2 released type; the onlyGroup-A MoE checkpoint available locally), quantized on GPU 2 with a fixed
seed and the same 32-row wikitext calibration on both sides
(
offload_to_disk=Trueso the 21B checkpoint fits the 32 GB card), every savedtensor compared byte-for-byte.
AWQ onboarding safety
changed: none, stress A/B 0 differences); the release only changes theplanner used to derive the same groups.
fix(awq): keep a declared fold whose first reader captured nothing #6657: the full target set is kept, and the processor's fallback check
decides between folding the whole set and plain quantization. The new
tests/test_awq_declaration_empty_capture.pyproves the empty-root fold isneutral and that folding around an uncaptured reader drifts.
tests/test_awq_moe_shared_expert_group_4760.py,tests/test_awq_moe_starved_expert_group_4675.py,tests/test_awq_moe_prune_uncovered_4456.py,tests/test_awq_empty_groups.pyandtests/module_tree/test_awq_dynamic_excluded_reader.pypass.Logic Flow Documentation
Not applicable: no control-flow change. The planner selection switch
(
awq_groups_from_tree_order) and the declaration/processor flow are alreadydocumented in
docs/awq-scaling-groups.md; this PR only removes opt-outs andupdates that page's release criterion.
Kernel Accuracy Requirements
Not applicable: no kernel, packing, dispatch or fusion change.
Notes
removed-okperturbation cases are tracker bugs being removed, notregressions: the tracker folded a narrowed group that omitted an uncaptured
reader (the router, a parallel branch or a gate sibling). The declaration
path keeps the full set and falls back when a member has no capture.
fallback=Nonekeeps the documented fix(awq): keep a declared fold whose first reader captured nothing #6657 contract: an empty (not absent)capture fails closed with
_AWQScaleGroupError.🤖 Generated with Claude Code