Repository navigation
fix(awq): skip clip search for modules with no captured features - #6681
Merged
Merged
Conversation
`_search_best_clip` indexed `input_feat[name]` for every quantized module, so a featureless layer, a `dynamic` exclusion, a starved reader or an unrouted expert raised KeyError instead of leaving the module unclipped. #6657 keeps a declared fold with `inp=None`, so a declaration-planned layer can reach the clip search with an ungrouped quantized projection that has no capture. Skip absent or empty features with the existing #4679 `log.warn` low-coverage signal. The same missing-capture condition also filtered those modules out of `apply_quant`; the module then reached packing without zero points and aborted the run. Quantize every non-fallback module and let the clip search skip the uncaptured ones. The tracker path already quantizes the same module via its fallback, so the declaration path now matches it. Tests: the DeepSeek-V3/Kimi featureless tests force the declaration path and assert the #6657 featureless contract; clip-search unit tests cover the absent feature and its warning. Full-capture plans are unchanged (`awq_fold_inventory.py --check` -> changed: none; Qwen2.5-0.5B and ERNIE-4.5-21B GPU A/B bit-identical). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
force-pushed
the
fix/awq-clip-search-missing-feature
branch
from
December 1, 2026 18:50
1d75651 to
ff10c83
Compare
Qubitium
marked this pull request as ready for review
December 1, 2026 18:58
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
AWQProcessor._search_best_clipindexedinput_feat[name]for every quantizedmodule in the layer. A module with no captured calibration rows (a featureless
layer, a
dynamicexclusion, a starved reader or an unrouted expert) is absentfrom
input_feat, so the clip search raisedKeyError: '<module>'instead ofleaving that module unclipped. #6657 keeps a declared fold whose first reader
captured nothing (
inp=None), so a declaration-planned layer can reach theclip search with an ungrouped quantized projection that has no capture — for
example DeepSeek-V3/Kimi
self_attn.o_proj, or falconself_attention.denseafter #6675 releases it to its declarations.
The same missing-capture condition also filtered those modules out of the
quantization pass (
named_childswas filtered toname in input_feat). Thatdoes not produce a usable dense checkpoint: the module stays in the layer state
and still reaches
pack_module, which raisesRuntimeError: ... reached packing without quantized zero points. On main, a featureless layer thereforecannot finish quantization at all (clip
KeyError, or the packRuntimeErrorwhen clip search is disabled). This PR fixes both: the clip search skips
modules with absent or empty captures, and the quantization pass quantizes every
non-fallback module (the scale search still only uses captured features).
No model is special-cased. This unblocks releasing deepseek_v3/kimi_k2/kimi_k25
to fold declarations (follow-up PR) and fixes the crash on the types released
by #6675 (falcon and friends).
What Changed
gptqmodel/looper/awq_processor.py_search_best_clip:input_feat.get(name); skip when the feature is absentor empty (
features is None or features.numel() == 0). The existingempty-capture skip ([BUG] Subset early-stop fires on the declared-last module: Falcon-H1 feed_forward.gate_proj (runs after up_proj) gets 0 samples -> GPTQ silently RTN, AWQ crashes; same for bailing_hybrid self_attn.g_proj #4679) now shares this branch; the module is left
unclipped. The skip keeps the user-visible
log.warnlow-coverage signal("received no calibration samples") instead of hiding it at debug level.
named_childs: drop thename in input_featfilter; onlyfallback_namesare excluded, so an uncaptured projection is quantizednormally instead of reaching packing without zero points. The clip search
skips it; no AWQ scale is applied to a module outside a group.
tests/test_awq_clip_empty_feature_4679.py: newtest_clip_search_skips_a_module_with_no_capture(absent key) andtest_clip_search_warns_when_a_quantized_module_has_no_capture(pins the[BUG] Subset early-stop fires on the declared-last module: Falcon-H1 feed_forward.gate_proj (runs after up_proj) gets 0 samples -> GPTQ silently RTN, AWQ crashes; same for bailing_hybrid self_attn.g_proj #4679 warning for an absent key).
tests/module_tree/test_deepseek_v3_local_port.pyandtests/module_tree/test_kimi_k25_local_port.py: the featureless tests nowforce the declaration path (
awq_groups_from_tree_order = False) and assertthe fix(awq): keep a declared fold whose first reader captured nothing #6657 featureless contract (nodes kept with
inp=None) instead of thetracker's
[]. The forced override becomes redundant when the release PRremoves the class flag.
one); the tree tracker is unchanged.
Reachability
found ungrouped quantized projections, but the inventory model dropped all
their groups before the clip call, so none reproduced in that screen.
695ea9614(after refactor(awq): release the empty-capture tracker types to fold declarations #6675 releasedfalcon to its declarations): a featureless falcon layer with the default
AWQConfig()fallback raisesKeyError: 'self_attention.dense'during apublic
GPTQModel.load(...).quantize(...)run. With the declaration pathforced, the DeepSeek-V3/Kimi featureless tests raise
KeyError: 'self_attn.o_proj'(4 fallback params).dynamicexclusions, unroutedexperts and zero-row calibration.
Why the
named_childschange is required (CPU end-to-end)The review asked whether main's behaviour (an uncaptured module excluded from
apply_quant) is an intentional dense-in-checkpoint state. It is notreachable: the module remains in the layer state and
pack_modulerequires itsstaged zero points. Proof with a tiny falcon (two-norm parallel decoder, 2
layers, 8 quantized linears), the public
GPTQModel.load -> quantize -> save -> loadpath on CPU, the processor's capture forced empty(
_layer_input_features -> {}, i.e. the zero-row/featureless calibration case),AWQConfig(device="cpu", group_size=-1, fallback={})(current main8eeab5e35is the same code as
695ea9614plus a test-only turboquant commit):695ea9614, featureless declaration layer, default fallbackKeyError: 'self_attention.dense'in_search_best_clip; no checkpointRuntimeError: AWQProcessor: module transformer.h.0.self_attention.dense reached packing without quantized zero points; no checkpointKeyError: 'self_attention.dense'in_search_best_clip; no checkpointRuntimeError: ... self_attention.dense reached packing without quantized zero points; no checkpointawq_groups_from_tree_order=True, featureless)AwqTorchLinear; save +GPTQModel.loadOK; finite logits (std 0.1082)In the partial runs the group sources (
self_attention.query_key_value,mlp.dense_h_to_4h) have captured rows and the ungroupedself_attention.dense/mlp.dense_4h_to_hdo not: the exactone-ungrouped-projection-missing case, not only a fully featureless layer.
The tracker's established behaviour is to quantize the uncaptured projection
(its featureless layer falls back to plain quantization), not to leave it
dense. The declaration path must match; the
named_childschange does exactlythat. This is the same missing-capture cause as the clip crash, so it stays in
this PR rather than a split.
Script:
.../awq-clip-search-missing-feature.scratch/prove_named_childs.py(logs
prove_falcon_*.log,prove_deepseek_tracker_*.log).Tests
Measured Impact
GPU AWQ A/B, GPU 2 (
CUDA_DEVICE_ORDER=PCI_BUS_ID), fixed seed, the same32-row wikitext calibration, every saved tensor compared byte-for-byte
(
offload_to_disk=Truefor the 21B model):The A/B was taken before the final log-level amendment; the only delta since is
log.debug->log.warnin the missing-capture skip branch, which has nonumeric path.
Model Support / Module Plan
Not applicable: no model type, alias or definition change.
AWQ onboarding safety
awq_fold_inventory.py --checkreportschanged: noneand the GPU A/B is bit-identical. The clip skip only fireswhen a feature is absent or empty; full captures have every feature. The
named_childspredicate is a no-op when every module was captured._quantize_layer_fallback); thefilter change fixes the declaration group path leaving uncaptured modules
unquantized (which aborts packing) instead of changing which modules are
quantized. Coverage-pruned modules (fallback disabled) are removed from the
layer state and recorded as dynamic exclusions, so they are not affected.
input is kept and falls back; the clip search now leaves its uncaptured
ungrouped projections unclipped and quantized.
the warning is per skipped module, matching the pre-existing empty-feature
behaviour.
Logic Flow Documentation
Not applicable: no new decision mechanism or lifecycle. The existing clip loop
adds one per-module skip (
features is None or features.numel() == 0), and thenamed_childspredicate loses itsname in input_featterm. The scale search'smissing-feature handling and the fallback/drop order are unchanged.
Kernel Accuracy Requirements
Not applicable: no kernel, packing, dispatch or fusion change.
Review Requirements
Notes
skipping the absent module in the clip search, the V3/Kimi featureless tests
failed because
named_childshad dropped it fromapply_quant; in the realpipeline the same module then aborts packing. The one-line filter fix makes
those tests green and completes the run.
stays
Trueuntil the release PR.🤖 Generated with Claude Code