Repository navigation
Description
Found on main @ b225a43, RTX 4090 (CUDA 13.2, torch 2.15). Llama-3.1-8B-Instruct, bf16, 128 C4 calibration docs.
What is wrong
GPTQConfig(bits=4, group_size=128, desc_act=True) produces a checkpoint that is fine on most text but catastrophically wrong whenever the first token after BOS is a delimiter-like token ( and, ", .). The cause is in model.layers.1.mlp.down_proj: a handful of input columns come out saturated. Their dequantized norm is 5x the original, and every row sits at about ±7·scale.
| col | bf16 ‖W[:,c]‖ | desc_act ‖Wq[:,c]‖ | rel err | default GPTQ (AGA) rel err |
|---|---|---|---|---|
| 5095 | 0.872 | 4.38 | 4.95 | 0.10 |
| 11717 | 0.647 | 3.31 | 4.90 | - |
| 11411 | 0.891 | 4.27 | 4.31 | - |
This is the #4393 mechanism. BOS (and the first delimiter after it) carries massive activations into layers.1.mlp.down_proj, and those rows dominate H. With desc_act=True the default act_group_aware is switched off (only a warning about silencing the flag is logged), so nothing protects those columns. #4393 measured desc_act sym as the best config on Llama-3.2-1B (13.48). On the 8B model it is worse than RTN.
The opt-in fix from #4440/#4663 (CalibrationConfig(exclude_attention_sinks=True)) removes the catastrophic windows. It costs median quality, though, and the result still only matches RTN.
Numbers (wikitext-2 test, BOS + 511 tokens per window, Marlin, bf16)
| config | PPL 40 win | PPL 160 win | windows with PPL > 2x bf16 | median per-window ratio vs bf16 |
|---|---|---|---|---|
| bf16 | 9.141 | 8.937 | - | 1 |
| RTN 4-bit g128 | 10.219 | |||
GPTQ default (act_group_aware=True) |
9.690 | |||
GPTQ desc_act=True |
11.623 | 13.520 | 10 / 160 | 1.065 |
GPTQ desc_act=True + exclude_attention_sinks=True |
10.154 | 9.867 | 0 / 160 | 1.097 |
These are the bad windows for desc_act=True (window index: quantized PPL / bf16 PPL, then the first tokens after BOS):
1: 12215 / 10.3 ' " horribly', 100: 2308 / 9.1 ' and are', 101: 916 / 11.3 ' and claims', 106: 3102 / 19.4 ' and suggests', 107: 8185 / 10.6 ' " no', 112: 1322 / 8.7 ' and salamanders', 113: 819 / 8.2 ' and connect', 116: 4499 / 8.5 ' . He', 127: 1659 / 8.7 ' and lissam', 159: 4809 / 7.7 ' . Three'.
The Torch kernel gives the same result (window 100: Marlin 2308, Torch 1947), so the error is in the weights, not in the kernel. The hidden states diverge right after layer 1. At position 1 the relative error is 0.70 after layer 1 and 2.8 after layer 3, and it stays above 1 through layer 31.
This is not a recent regression. A 2-layer truncation of the model shows the same saturated columns at 12c1273c2.
Minimal repro (2-layer truncation, ~1 min)
# Make a 2-layer Llama-3.1-8B-Instruct: copy the dir, set config.json num_hidden_layers=2.
import torch
from gptqmodel import GPTQModel
from gptqmodel.quantization.config import GPTQConfig, CalibrationConfig
texts = c4_docs_at_least_1500_chars[:128] # each cut to 2500 chars
for tag, kw, ckw in [("desc", dict(desc_act=True), {}),
("desc_sinks", dict(desc_act=True), dict(exclude_attention_sinks=True)),
("default", {}, {})]:
m = GPTQModel.load("Llama-3.1-8B-Instruct-2L", GPTQConfig(bits=4, group_size=128, **kw), dtype=torch.bfloat16)
m.quantize(CalibrationConfig(dataset=texts, **ckw)); m.save(tag)
# Dequantize layers.1.mlp.down_proj from the v1 checkpoint: (q - (z+1)) * s[g_idx].
# Compare it per input column with the bf16 weight: rel = ||Wq[:,c]-W[:,c]|| / ||W[:,c]||.Output:
desc overall rel 0.1718 worst cols [(5095, 4.95), (11717, 4.90), (11411, 4.31), (10271, 3.49), (9221, 3.44)]
desc_sinks overall rel 0.1467 worst cols [(3174, 0.247), (12657, 0.243), (10789, 0.229)] col 5095: 0.05
default overall rel 0.1172 worst cols [(6412, 1.28), (591, 0.79), (12657, 0.69)] col 5095: 0.10
A user-visible check on the full model is a forward over "<|begin_of_text|> and are being conserved and displayed at the Mariners ' Museum ..." (wikitext-2 test, token offset 51200). The desc_act=True checkpoint gives PPL > 2000 on it. The bf16 model gives 9.1.
Suggested fix
- For a BOS tokenizer, when
desc_act=Trueturnsact_group_awareoff, also protect the Hessian from sink rows by default. Either enable the attention-sink exclusion, or cap each token's contribution to H (for example, clip row norms to a high percentile beforeX^T X). The leading delimiter token after BOS is also a sink here, andexclude_attention_sinksonly drops BOS, so a norm-based cap would cover both cases. - At minimum, the
desc_act=True automatically disables act_group_awarewarning should say that on Llama-3 models this removes the sink protection, and point atexclude_attention_sinks. The docs (docs/quantization-guide.md"validate it per model") do not mention thatdesc_actmakes this much worse. - Optionally, allow
desc_actordering together with group-aware scales instead of rejecting the combination.
Test that should have caught it
tests/models/test_llama3_* covers only 1B models with the default config. Add a desc_act case on an 8B Llama-3, or a unit test on a synthetic H with one dominant rank-1 sink row. It should assert that no input column of the quantized weight exceeds a bound such as rel err < 1, and that held-out text starting with and stays within 2x of bf16 PPL.
Severity
Medium-high (silent accuracy loss). desc_act=True (act-order) is the most common non-default GPTQ option. The result passes a casual chat check ("The capital of France is Paris." is correct, because chat prompts start with <|start_header_id|>). But raw-text inputs whose first token is and, . or a quote get garbage. Average PPL is worse than RTN.
🤖 Generated with Claude Code
Activity
Qubitium commentedon Nov 17, 2026
Scope check. The problem follows the BOS token: it is not a general desc_act problem. Qwen3-8B has no BOS token, and the same harness (bf16, 128 C4 docs, wikitext-2 40x512, R9700) gives
desc_act=True11.991 against default GPTQ 11.957 (bf16 11.490). That is a normal result, and the 256-token probe KL vs bf16 is 0.074. So the failure is specific to tokenizers that prepend BOS (Llama-3.x), which matches the sink-row mechanism above.🤖 Generated with Claude Code
Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-fffcc532ace3is no longer working on this issue.The issue is free to claim.
CPU repro of the mechanism (synthetic Hessian, 256 cols / 64 rows, 3 channels carrying 700x sink rows at positions 0-1): desc_act=True gives mean column rel err 0.1101 vs 0.0890 natural order, worst column 0.30 vs 0.27, and act_group_aware is auto-disabled by desc_act as reported. Reached only a ~24% degradation, not the 4.95x saturation, which needs the real 8B activations. The suggested sink-row norm cap in compute_hessian_xtx is core quantization math: it needs maintainer design sign-off and GPU-oracle validation, so releasing instead of shipping an unvalidated numerics change.
Qubitium commentedon Nov 17, 2026
Agent claim:
agent-root-4742is working on this issue now.Qubitium commentedon Nov 17, 2026
Agent claim released:
agent-root-4742is no longer working on this issue.Shipped in #4909, squash-merged to
mainas7edbca8.What landed:
HessianConfig.sink_row_cap_median_multiple(default4.0;0/Nonedisables): whendesc_act=Truehas disabledact_group_aware, each calibration row's norm is capped atmin(p99.9, N x median)beforeX^T X. BOS/delimiter sink rows keep their direction but can no longer dominate the Hessian, so their columns are not ordered first against a degenerateHinv[i, i]. The defaultact_group_awarepath keeps the existing fast path and is bit-for-bit unchanged.meta.hessian(a reload does not restore the default) and is part of the shared-input Hessian capture signature.desc_act=Trueauto-disable warning now names the Llama-3 sink risk,exclude_attention_sinks, and the new knob;docs/quantization-guide.mddocuments the mechanism, default and opt-out.tests/test_descact_sink_4742.py(7 CPU-only tests, synthetic Hessian): 7 failed on the pre-fix base, 7 passed with the fix.Validation scope: the 8B end-to-end PPL rerun from the report could not be repeated here (the Llama-3.1-8B checkpoint is not in the local HF cache). Evidence is the synthetic Hessian regression (worst-column rel err
0.783->0.388, close to the0.31of dropping the sink rows entirely) plus a real-activation probe on cachedHuggingFaceTB/SmolLM2-135M(worst-column rel err improves on all three probedmlp.down_projlayers, mean column error moves <1%).CalibrationConfig(exclude_attention_sinks=True)remains the stronger opt-in for BOS tokenizers.fix(gptq): cap sink-row Hessian contributions when desc_act disables …