Repository navigation
Description
Severity: medium (accuracy). Status: confirmed on a Radeon AI PRO R9700 (ROCm, PYTHON_GIL=0) at def6e61. Kind: pre-existing. At 842d666, plain sym gives 65.8 (vs 63.1 at HEAD). The shipped 5.4.2 checkpoint Llama-3.2-1B-Instruct-GPTQ-4bits-gp128 scores ppl 82–115 on the same eval.
Where
gptqmodel/quantization/gptq.py:789 (add_batch) and :1056 (process_batch). The Hessian is accumulated over every calibration token, including the BOS token the tokenizer prepends to each row. Nothing down-weights or excludes attention-sink tokens.
Setup
- Calibration: 128 wikitext-2-raw train rows longer than 400 chars, batch_size=4.
- Eval: the first 40 wikitext-2 test articles longer than 2000 chars, each cut to 512 tokens with its own BOS (20,440 tokens).
- Baseline (fp16): ppl 12.263.
Results (4-bit, g128)
| Config | ppl |
|---|---|
| RTN sym | 15.90 |
GPTQ default (sym, act_group_aware=True) |
18.49 |
GPTQ plain sym (act_group_aware=False) |
63.09 |
| GPTQ desc_act sym | 13.48 |
| GPTQ desc_act asym | 103.9 |
| GPTQ GAR asym | 15.15 |
| GPTAQ | 17.06 |
| QQQ | 19.73 (answers "The largest city in France is Marseille") |
| AWQ / GGUF q4_k_m / FOEM / ParoQuant | 14.13 / 13.66 / 13.83 / 14.30 |
On Qwen3-0.6B the GPTQ family behaves well: 21.9–22.6, against 27.3 for RTN.
Localisation
-
Not the kernels. A pure-torch dequant oracle reproduces the kernel ppl (fp16: 19.278 for both).
-
One module is responsible. Swapping only
model.layers.1.mlp.down_projfrom the plain-GPTQ checkpoint into the fp16 model raises ppl from ~12.5 to 26.8. RTN on that one module gives 13.44. -
Its input is dominated by BOS. The module's input max |x| is 1176, on the BOS token.
-
Error split, ||(W−Q)X||² over calibration tokens:
total BOS rows non-BOS rows GPTQ 6.9e4 6.7e4 2136 RTN 5.3e5 5.3e5 625 GPTQ minimises its objective (7.6× lower than RTN in total), but almost all of that objective is the BOS rows. On ordinary tokens GPTQ is 3.4× worse than RTN.
-
Errors compound. desc_act asym on L1 down_proj alone gives 14.9; all other layers alone give 13.4; together they give 103.9.
Caveat: a round-11 run with a different calibration set (128 nm-calibration rows) and an in-distribution eval did not show this. The effect depends on the calibration data and eval, but it is large on standard wikitext calibration and eval.
Repro
from datasets import load_dataset
from gptqmodel import GPTQModel
from gptqmodel.quantization.config import GPTQConfig, RTNConfig
calib = [t for t in load_dataset("Salesforce/wikitext", "wikitext-2-raw-v1", split="train")["text"] if len(t.strip()) > 400][:128]
for i, cfg in enumerate([GPTQConfig(bits=4, group_size=128, sym=True, desc_act=False, act_group_aware=False),
GPTQConfig(bits=4, group_size=128, sym=False, desc_act=True, act_group_aware=False),
RTNConfig(bits=4, group_size=128, sym=True)]):
m = GPTQModel.load("meta-llama/Llama-3.2-1B-Instruct", quantize_config=cfg); m.quantize(calib, batch_size=4); m.save(f"out{i}")
# then wikitext-2 test ppl with one BOS per article (40 articles x 512 tokens)Expected: GPTQ ≤ RTN.
Suggestion: mask BOS / attention-sink positions, or cap per-token weight, when accumulating H. Alternatively, exclude position 0 from the Hessian when it is a special token.
Found during an AI-assisted review (Claude Code, round 12) of def6e61; repros were run at that commit (A/B against 842d666 where noted) on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
Qubitium commentedon Nov 16, 2026
Claimed by an AI agent. Investigating: BOS/attention-sink token domination of GPTQ Hessian on Llama-3.2 calibration; measuring per-token Hessian contribution and evaluating an explicit GPTQConfig masking option.
fix(gptq): add opt-in attention-sink masking for the calibration Hess…
test(llama3_2): exclude attention sinks and refresh slow baselines (#…
Qubitium commentedon Nov 16, 2026
Re-checked at 489aed6. The opt-in
exclude_attention_sinks(8d6ebb0) gets Llama-3.2-1B GPTQ below RTN (sym 33.81 → 21.77, default 23.24 → 21.30).Two problems remain, filed as #4459:
The VPTQ,
dynamicand AWQ/ParoQuant paths silently ignore the flag (#4447).(AI-assisted review, round 13 at
489aed6)feat(calibration): exclude attention sinks in the shared calibration …
feat(calibration): exclude attention sinks in the shared calibration …
refactor(api): quantize() takes a CalibrationConfig; drop the calibra…