Skip to content

[QUALITY] GPTQ desc_act=True on Llama-3.1-8B is worse than RTN (PPL 11.62 vs 10.22): layers.1.mlp.down_proj columns saturate on BOS-sink Hessian, 10/160 wikitext windows reach PPL 800-12000 (#4393 unsolved for desc_act) #4742

Closed

Description

@Qubitium

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=True turns act_group_aware off, 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 before X^T X). The leading delimiter token after BOS is also a sink here, and exclude_attention_sinks only drops BOS, so a norm-based cap would cover both cases.
  • At minimum, the desc_act=True automatically disables act_group_aware warning should say that on Llama-3 models this removes the sink protection, and point at exclude_attention_sinks. The docs (docs/quantization-guide.md "validate it per model") do not mention that desc_act makes this much worse.
  • Optionally, allow desc_act ordering 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

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    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=True 11.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

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-fffcc532ace3 is 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.

  3. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-root-4742 is working on this issue now.

  4. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-root-4742 is no longer working on this issue.

    Shipped in #4909, squash-merged to main as 7edbca8.

    What landed:

    • HessianConfig.sink_row_cap_median_multiple (default 4.0; 0/None disables): when desc_act=True has disabled act_group_aware, each calibration row's norm is capped at min(p99.9, N x median) before X^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 degenerate Hinv[i, i]. The default act_group_aware path keeps the existing fast path and is bit-for-bit unchanged.
    • The knob is written to meta.hessian (a reload does not restore the default) and is part of the shared-input Hessian capture signature.
    • The desc_act=True auto-disable warning now names the Llama-3 sink risk, exclude_attention_sinks, and the new knob; docs/quantization-guide.md documents the mechanism, default and opt-out.
    • New 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 the 0.31 of dropping the sink rows entirely) plus a real-activation probe on cached HuggingFaceTB/SmolLM2-135M (worst-column rel err improves on all three probed mlp.down_proj layers, mean column error moves <1%). CalibrationConfig(exclude_attention_sinks=True) remains the stronger opt-in for BOS tokenizers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions