Repository navigation
fix(looper): stop a subset only after every member captured (#4679) - #4703
Merged
Merged
Conversation
`stage_subset` set `forward_hook_last` on the member at the declared end of the subset, assuming declaration order matches the order the model calls the modules. Falcon-H1's MLP computes `up_proj(x)` before `gate_proj(x)`, so the forward stopped at `up_proj` and `gate_proj` never saw a calibration sample (GPTQ silently fell back to RTN; AWQ crashed on the empty feature). bailing_hybrid's hybrid attention runs `b_proj` before `g_proj`, same effect. Track the members still unseen and flip the stop flag from the hook of the member that actually completes the subset. Declaration order no longer decides where the forward stops, and a subset whose member never fires simply runs to completion instead of starving the rest. Also skip AWQ clip search for a projection with an empty feature (log instead of reshaping a 0-element tensor) and give `_compute_best_clip` an explicit error for that case.
This was referenced Nov 17, 2026
Qubitium
added a commit
that referenced
this pull request
Nov 17, 2026
…tch (#4738) (#4752) #4703 made the member that empties the pending set flip forward_hook_last, so a subset is cut off only after every member fired once. But the pending set was built once per subset pass and the flag was only cleared at the end of the pass. From the second calibration batch on the set was already empty, so the first member to fire stopped the forward: every sibling - every other routed expert of a MoE layer - captured exactly one batch. Register a forward pre-hook on the layer module that refills the pending set and clears the flag once per batch, before any subset member runs. The #4703 ordering guarantee is unchanged.
This was referenced Nov 17, 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
Fixes #4679.
stage_subsetsetforward_hook_laston the member at the declared end of the subset, assuming declaration order matches the order the model calls the modules. When a sibling runs after the declared-last member it never saw an activation:feed_forward:up_projruns first, sogate_projgot 0 samples in every layer — GPTQ silently shipped RTN for it, AWQ crashed on the empty feature.self_attn:b_projruns beforeg_proj, sog_projgot 0 samples on every linear-attention layer.Capture now keeps the set of members still unseen and flips the stop flag from the hook of the member that actually completes the subset. Declaration order no longer decides where the forward stops, and a subset with a member that never fires runs to completion instead of starving the others.
Also hardened the AWQ side of the same failure:
_search_best_cliplogs and skips a projection whose feature is empty (previouslyRuntimeError: cannot reshape tensor of 0 elements into shape [-1, 0]), and_compute_best_clipraises an explicit error for a direct caller.Validation
tests/test_subset_declared_order_4679.py(new) builds a layer whose MLP callsup_projbeforegate_projand declares the subset in the Falcon-H1 order:[gate, up], executedup, gateup_proj→ fails[up, gate], executedup, gateBoth cases also assert the module after the subset still does not run, so the early stop is preserved.
tests/test_awq_clip_empty_feature_4679.py(new): the empty-feature skip returns no clip bounds, and the helper raisesValueErrormentioning "at least one calibration token row".Adjacent suites:
tests/module_tree/test_subset.py,tests/test_subset_cancel_hook_cleanup_4470.py,tests/test_quantization_lifecycle_contracts.py,tests/test_stage_modules.py→ 78 passed, 7 failed. All 7 failures are intests/test_stage_modules.pyand pre-exist on unmodifiedmain: itsDummyLooperdouble lacks_track_inflight_layer, which #4546 added (AttributeError). I verified the same 7 fail on a pristinemainworktree and will fix that double separately.ruff check gptqmodel docs/eora tests setup.pyclean.Resolves #4679.