Skip to content

GPTQ 4-bit on Llama-3.2-1B-Instruct is ~3x worse than RTN (PPL ~50 vs 18): layers.0.mlp.down_proj sink channel #6498

Done

Description

@Qubitium

Summary

GPTQ 4-bit g128 on Llama-3.2-1B-Instruct gives wikitext2 PPL ~50: dense is 13.6 and plain round-to-nearest (RTN) is 18.4. GPTQ comes out ~3× worse than naive rounding. Nearly all of the damage comes from one module, model.layers.0.mlp.down_proj, the input of Llama's massive-activation ("attention sink") channel. GPT-QModel's GPTQ is also clearly worse than a textbook GPTQ on the same module and calibration data.

It reproduces on aff56aa1a (before #6473) and on current main with bit-identical PPL, so it is not related to the accelerate removal.

Repro

from datasets import load_dataset
from gptqmodel import GPTQModel, BACKEND, CalibrationConfig
from gptqmodel.quantization.config import QuantizeConfig
train = load_dataset("Salesforce/wikitext", "wikitext-2-raw-v1", split="train")
calib = [t for t in train["text"] if len(t) > 400][:128]
m = GPTQModel.load("meta-llama/Llama-3.2-1B-Instruct", quantize_config=QuantizeConfig(bits=4, group_size=128, desc_act=True))
m.quantize(CalibrationConfig(dataset=[{"text": t} for t in calib], batch_size=8), backend=BACKEND.GPTQ_TORCH)
m.save(out)
# wikitext2 test PPL, 2048-token windows, BACKEND.TORCH

Measurements (wikitext2 test PPL)

Whole model:

config PPL
dense bf16 12.64 (40 windows) / 13.63 (20)
RTN 4b g128 sym (all decoder linears) 18.39
GPTQ desc_act=True (default hessian) 53.85
GPTQ desc_act=False 45.43
GPTQ desc_act=True, HessianConfig(sink_row_cap_median_multiple=None) 75.93
GPTQ desc_act=True, calibration batch_size=1 52.15
GPTQ desc_act=True, auto_dtype_cast="off" 53.85

The inference kernel is not the cause. PPL with BACKEND.TORCH (50.651) equals PPL of the dense model with the dequantized GPTQ weights copied in (50.648).

Swapping GPTQ weights into the dense model one layer at a time (6 windows, dense 13.21):

swapped GPTQ (desc_act=True) GPTQ (desc_act=False) RTN
layer 0 46.63 28.87 13.51
layer 1 13.75 26.31 14.11
layers 2–15 (each) 13.23–13.28 — 13.24–13.41
all down_proj 46.44 33.83 14.72
all q/k/v/o/gate/up (per kind) 13.23–13.44 — 13.32–13.61

On every other module GPTQ beats RTN, as expected.

Textbook GPTQ (Frantar et al.: damp·mean(diag), Cholesky inverse, block 128, static g128 scales, sym 4-bit) on only layers.0.mlp.down_proj, with the same 128 calibration samples:

PPL
dense 13.21
RTN 13.41
textbook GPTQ, act-order 25.01
textbook GPTQ, no act-order 14.49
GPT-QModel GPTQ, desc_act=True 46.6

Input column 4548 has a Hessian diagonal of 11.2 against a median of 2.8e-4 (~40,000×).

  • Textbook act-order is already fragile here: the sink column is quantized first and its error is propagated into every other column.
  • GPT-QModel is roughly 2× worse again. With desc_act=False it also breaks layer 1, which textbook no-act-order does not.
  • The per-module loss logged in quant_log.csv for 0,mlp.down_proj is tiny (2.2e-7), so the solver believes it succeeded.

Suspects

A guard worth considering: compare each module's GPTQ result against RTN on the calibration activations, and fall back when GPTQ is not better. The existing fallback machinery could host this.

Found while auditing quantization accuracy after #6473.

Activity

  1. Qubitium commented on Nov 30, 2026

    @Qubitium
    CollaboratorAuthor

    Draft fix: #6500. It leaves sink rows out of the GPTQ Hessian in every mode, replacing the #4742 cap.

    Llama-3.2-1B-Instruct wikitext2 PPL: 53.85 → 15.02 (desc_act=True) and 45.43 → 14.55 (default). RTN is 16.93, dense 12.64. Layer 0 down_proj now matches a textbook GPTQ reference.

    Caveat: on Qwen2.5-0.5B, whose first-token rows are 50–245× the median, the same rule costs +0.36–0.5 PPL. The BOS-id rule CalibrationConfig(exclude_attention_sinks=True) gives the same Llama gain and is a no-op on Qwen, so flipping its default may be the better fix. Details are in the PR.

  2. Qubitium commented on Nov 30, 2026

    @Qubitium
    CollaboratorAuthor

    Reworked #6500 per maintainer direction (safe default, per-model opt-in). The global default is unchanged: no Hessian change, and other models are digest-identical (checked on Qwen2.5-0.5B). Llama 3 checkpoints quantized with GPTQ now exclude the BOS attention sink by default. wikitext2 PPL: 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. TinyLlama (Llama 2 arch) is not opted in, because it would get slightly worse (9.02 → 9.14). Any model can still pass CalibrationConfig(exclude_attention_sinks=True/False) explicitly.

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