Repository navigation
fix(llama): exclude the Llama 3 BOS attention sink for QQQ by default (#6568) - #6570
Merged
Merged
Conversation
QQQ builds the same calibration Hessian as GPTQ without group-aware ordering, but the #6498 per-model default only listed METHOD.GPTQ, so QQQ kept the Llama 3 BOS sink. Llama-3.2-1B QQQ4 g128 scored wikitext2 PPL 1105 by default and 11.5 with the sink excluded. Fixes #6568 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
marked this pull request as ready for review
December 1, 2026 03:58
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 #6568
Problem
The #6498 per-model attention-sink default lists only
METHOD.GPTQfor Llama 3, soQQQConfigwith a defaultCalibrationConfigkeeps the Llama 3 BOS sink in its Hessian. QQQ has no group-aware ordering, so the sink wrecks the model: Llama-3.2-1B QQQ4 g128 scores wikitext2 PPL 1105.Change
LlamaQModel.attention_sink_exclusion_methods = (METHOD.GPTQ, METHOD.QQQ). Thellama3RoPE predicate is unchanged, so TinyLlama/Llama 2 and every other model keep their checkpoints. An explicitexclude_attention_sinks=True/Falsestill wins.calibration-attention-sinks.mdadds the QQQ measurement;quantization-guide.mdnames QQQ in the default.flowchart TD A["CalibrationConfig.exclude_attention_sinks=None"] --> B{"method in LlamaQModel.attention_sink_exclusion_methods?"} B -- "before: GPTQ only" --> C["QQQ: sinks kept, PPL 1105"] B -- "after: GPTQ, QQQ" --> D{"rope_type == llama3?"} D -- yes --> E["sinks excluded, PPL 11.55"] D -- no --> F["sinks kept (unchanged)"]Test plan
Hardware: AMD Radeon AI PRO R9700 (gfx1201), ROCm 7.16, torch 2.16 dev. Model
unsloth/Llama-3.2-1B, QQQ 4-bit g128, 128 C4 rows, wikitext2 test PPL over 141 x 2048-token windows.c649fcb5fexclude_attention_sinks=True, baseAn FP64 oracle forward (dequantized weights, no activation quantization) on the base checkpoint gives the same per-window PPL as
QQQTorchLinear, so the fault is in calibration, not the kernel.Unit regression (
tests/test_attention_sink_model_default_6498.py):origin/main:test_llama3_qqq_excludes_attention_sinks_by_defaultFAILED (resolvedFalse), 17 passedtests/test_attention_sink_model_default_6498.py tests/test_calibration_attention_sinks.py tests/test_calibration_config.py tests/test_qqq_config.py-> 122 passed, 1 failed. The failure istest_qqq_linear_per_channel_normalizes_activation_order[native_qqq], which also fails on cleanorigin/mainon ROCm (native CUDA QQQ kernel has no ROCm build, test is not NVIDIA-gated); unrelated.tests/test_docs_contract_refs.py -k "calibration-attention-sinks or quantization-guide": 27 passed.uvx [email protected] checkon the touched files: clean.Not verified: an NVIDIA run of the QQQ e2e (the change is calibration policy, not device-specific).
🤖 Generated with Claude Code