Repository navigation
fix(calibration): per-model attention-sink default; Llama 3 GPTQ excludes BOS sinks (#6498) - #6500
Merged
Merged
Conversation
Qubitium
marked this pull request as ready for review
November 30, 2026 19:25
…udes BOS sinks (#6498) GPTQ on Llama 3 loses the model to the BOS attention sink: its row dominates the layer-0 down_proj Hessian (diag ~40,000x median). Excluding the BOS token (`CalibrationConfig(exclude_attention_sinks=True)`, already supported) fixes it, but it is not a safe global default, so: - `CalibrationConfig.exclude_attention_sinks` defaults to `None` = model default; explicit True/False always win. - A definition opts in via `attention_sink_exclusion_methods` in its own class body (not inherited) plus an optional `attention_sink_exclusion_applies(config)` predicate. Weight-only runs and staged GSQ resolve to False. - Llama opts in for GPTQ on Llama 3 checkpoints only (rope_type "llama3"). wikitext2 PPL, 4-bit g128 GPTQ (kept -> excluded): Llama-3.2-1B-Instruct 53.85 -> 15.05, Llama-3.2-1B 130.05 -> 12.51, Llama-3.1-8B-Instruct 14.01 -> 7.46. Unchanged (digest-identical to main): Qwen2.5-0.5B-Instruct; TinyLlama (Llama 2 arch, would be 9.02 -> 9.14) is not opted in. The earlier row-norm Hessian exclusion is dropped: it cost Qwen2.5-0.5B ~0.4-0.5 PPL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
force-pushed
the
gptq-sink-row-exclusion
branch
from
November 30, 2026 19:57
a54a17f to
44aa8d9
Compare
Qubitium
marked this pull request as draft
November 30, 2026 19:57
Qubitium
marked this pull request as ready for review
November 30, 2026 19:59
2 tasks done
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
…6506) `tests/test_docs_contract_refs.py` had 8 failures on main: - docs/cancelled-run-contract.md (+ the citation table) still cited `_copy_checkpoint_tensors_into_submodule` / `_publish_checkpoint_param_` in gptqmodel/utils/structure.py; #6473 moved both to gptqmodel/weight_loader/source.py. - docs/weight-loader.md blocks 0/1 (#6473) executed on a CPU-only host: a two-accelerator `accel:0`/`accel:1` placement map and a continuation that needs `model` and a real checkpoint. Skip-listed with reasons. - docs/measurement.md block 3 is a continuation snippet (prose-defined `texts`, `tokenizer`, models); skip-listed. - Skip-list digests refreshed for docs/calibration-config.md::0 (#6500 added `exclude_attention_sinks=None`) and docs/looper-checkpoint-redesign.md::0 (#6492 added subset intervals); both reasons still hold. The eighth, docs/jit-kernel-builds.md::0, is fixed in #6505. Co-authored-by: Claude Opus 5.5 <[email protected]>
3 tasks done
Qubitium
added a commit
that referenced
this pull request
Dec 1, 2026
This release carries breaking changes (Accelerate removed and placement= replacing device_map= in #6473, pickle checkpoints refused, sccache >= 0.18 for JIT builds, model-owned attention-sink defaults in #6500) and many new features, so it is a minor release per the rule in version.py, not the 7.12.4 patch number main carried. 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.
Fixes #6498.
GPTQ on Llama 3 loses the whole model to the BOS attention sink. The BOS row dominates the layer-0
down_projHessian (its diagonal is ~40,000× the median), and the error GPTQ propagates from that column saturates the module. Excluding the BOS token from calibration statistics fixes it. That option already exists (CalibrationConfig(exclude_attention_sinks=True)), but it isn't a safe global default. This PR makes the default per model: it is off unless measured, so other models are unchanged.Change
CalibrationConfig.exclude_attention_sinksnow defaults toNone, meaning the model default. An explicitTrue/Falsealways wins.attention_sink_exclusion_methods, declared in its own class body. It is not inherited, so Qwen2/3, Gemma, OLMo2 and the otherLlamaQModelsubclasses are unaffected;attention_sink_exclusion_applies(config)predicate.False.meta.calibration_exclude_attention_sinksrecords it.rope_type == "llama3").flowchart TD A["exclude_attention_sinks"] --> B{"value"} B -- "True / False" --> Z["use it"] B -- "None (default)" --> C{"definition's own methods list has the run's method?"} C -- no --> F["False: unchanged"] C -- yes --> D{"calibrated, not staged GSQ, applies(config)?"} D -- no --> F D -- yes --> T["True: drop every attended BOS (logged, recorded in meta)"]Results
4-bit g128 GPTQ,
desc_act=True, 128 wikitext2 train rows; wikitext2 test perplexity:mainmain+ explicitTrue)For reference, Llama-3.2-1B-Instruct scores 12.64 unquantized and 16.9 with round-to-nearest.
Replaces this PR's first version, a row-norm Hessian exclusion. That version fixed Llama but cost Qwen2.5-0.5B 0.4–0.5 perplexity, because Qwen's large first-token rows carry useful signal. A norm threshold can't tell those apart from Llama's sink.
Validation (targeted)
tests/test_attention_sink_model_default_6498.pyfails onmainand passes here. It pins:Nonedefault and strict type checks;test_calibration_config.pyandtest_calibration_attention_sinks.pywere updated for the new default; 101 passed.mainover 157 test files that quantize a Llama-type model or touch sink exclusion (per file, CPU): identical results, except the new test file, which doesn't exist onmain.🤖 Generated with Claude Code