GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
ICLR 2023

GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers

GPTQ rounds weights one column at a time and shifts each rounding error onto the columns still unrounded. OPT-175B went to 3 bits in about 4 GPU-hours and ran on one A100, 3.24x faster per token.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2022
AUTHORS
Frantar, Ashkboos, Hoefler, Alistarh
FROM
IST Austria, ETH Zurich, Neural Magic
PUBLISHED
Oct 2022 · ICLR 2023
CITED BY
2,926Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 22% of this breakdown.

01

The paper in one minute

The simplest way to compress a model's weights is to round each one to the nearest value on a 4- or 3-bit grid. For 8 bits, that works. For 4 and 3 bits on very large models, it does not: rounding OPT-175B to 4 bits made its perplexity worse than a full-precision model ten times smaller, and at 3 bits the model produced nonsense. Methods that rounded more carefully existed, but they were built for vision models of around 100 million parameters and would have taken far too long at 175 billion.

GPTQ makes careful rounding fast enough. It works one linear layer at a time, with a goal: after quantizing the layer's weights W, the layer's outputs on a small calibration set X should change as little as possible. That is a least-squares problem whose curvature is the matrix H = 2XXᵀ, computed from the calibration inputs. GPTQ rounds the weights one column at a time, in the same order for every row, and after each column it nudges all the not-yet-rounded weights to cancel the error that column introduced. Correlated inputs mean another weight can often absorb most of the damage.

Three engineering changes make it scale. A fixed column order lets every row share one inverse-Hessian computation. Updates are batched in blocks of 128 columns so the GPU is busy rather than waiting on memory. And the needed rows of the inverse Hessian are taken from a Cholesky decomposition, which stays numerically stable where repeated matrix updates did not.

The results: OPT-175B and BLOOM-176B quantized in about four GPU-hours with 128 sequences of generic web text. At 4 bits, perplexity barely moved; at 3 bits it rose a fraction of a point. The 3-bit OPT-175B fit in a single 80 GB A100, and custom kernels that read 3-bit weights and dequantize them on the fly made generation 3.24 times faster than fp16 spread over five GPUs.

THE IDEA, VISUALLY
QUANTIZE A COLUMN, CORRECT THE REST (SECTION 4) column i quantized still fp16: absorb the error 1 round column i to the 3/4-bit grid 2 err = (w_i - q_i) / U_ii, U = chol(H^-1) 3 W[:, i+1:] -= err x U[i, i+1:] 4 apply in blocks of 128 columns H = 2XX^T from calibration inputs. Goal: keep the layer's output WX the same on calibration inputs, not keep each weight close. 128 C4 sequences of 2,048 tokens; one Transformer block on the GPU at a time. QUANTIZATION TIME, ONE A100 (TABLE 2) OPT-13B 21 min, OPT-66B 1.6 h, OPT-175B 4.2 h, BLOOM-176B 3.8 h OPT-175B, WIKITEXT2 PERPLEXITY (TABLE 3) lower is better; RTN 3-bit bar cut off fp16 8.34 RTN 4-bit 10.54 GPTQ 4-bit 8.37 RTN 3-bit ~7,300 GPTQ 3-bit 8.68 GPTQ 3-bit, g128 8.45 ONE GPU INSTEAD OF FIVE (SECTION 5, TABLE 6) fp16 weights 350 GB 3-bit weights 66 GB one A100 80 GB ms per generated token, batch 1 fp16 on 5x A100 230 ms 3-bit on 1x A100 71 ms 3.24x faster: fewer bytes per token, weights dequantized inside the kernel, math in fp16 arXiv 2210.17323, IST Austria and ETH Zurich, ICLR 2023
GPTQ quantizes a weight matrix column by column. After rounding each column, it uses second-order information from a small calibration set to adjust the columns not yet quantized so the layer's output barely changes. Plain rounding treats every weight alone and collapses at 3 bits; GPTQ stays close to 16-bit.
Research notes: the problem, approach and results
4.2 h

to quantize OPT-175B on one NVIDIA A100 80GB (Table 2)

8.34 → 8.37

OPT-175B WikiText2 perplexity, fp16 to 4-bit GPTQ; round-to-nearest gave 10.54 (Table 3)

3.24x

faster per-token generation for 3-bit OPT-175B on 1 A100 than fp16 on 5 (Table 6)

THE PROBLEM

Rounding every weight to the nearest 4- or 3-bit level (RTN) works for small models but breaks large ones: OPT-175B at 4 bits lost 2.2 perplexity points and at 3 bits collapsed. Accurate post-training methods existed but took hours for 100M-parameter models and could not reach 175B.

THE IDEA

Solve layer-wise reconstruction, minimizing the change in each layer's output on 128 calibration sequences, with a fast approximation of Optimal Brain Quantization: quantize columns in a fixed order, update the remaining weights using the inverse Hessian, apply updates in blocks of 128 columns, and compute what is needed with a Cholesky decomposition for numerical stability.

THE RESULT

GPTQ quantized OPT-175B and BLOOM-176B in about four hours on one A100. At 4 bits OPT-175B's WikiText2 perplexity rose from 8.34 to 8.37 (RTN: 10.54); at 3 bits to 8.68 (RTN: 7,300). The 3-bit model fit one 80 GB A100 and generated tokens 3.24x faster than fp16 on five.

02

Why it matters to an FDE

GPTQ is one of the formats you will meet most when someone downloads a "4-bit" open model, and its lessons apply to any weight-only quantization.

Fewer GPUs, faster tokens at batch 1. Generation at small batch sizes is limited by how fast weights stream from memory. A 3- or 4-bit model reads a quarter or less of the bytes per token, so it can be both cheaper to host and faster per user, unlike int8 with outlier handling, which mainly saves memory.

Calibration data is small but not free. GPTQ needs a few hundred calibration sequences and an hour or a few on one GPU per model. The paper uses generic web text and reports results on standard benchmarks. If a customer's domain is unusual, quantize with representative domain text and check.

4 bits is the safe default; 3 bits needs testing. At 4 bits the paper's largest models lost under 0.25 perplexity points; at 3 bits up to about one point on some tests. Smaller models lose more. Test on the customer's task before going below 4 bits.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The layer-wise objective, the three speedups, grouping, the speed result and two misreadings

    Free account
  2. 04How it works

    The objective, OBQ, the three changes, the full algorithm and the inference kernel

    Premium
  3. 05The numbers that matter

    Perplexity by model and bit width, runtime, the 175B summary, speed and 2-bit results

    Premium
  4. 06Try it yourself

    Implement GPTQ's core loop, check the memory and speed numbers, and audit the prose

    Premium
  5. 07Where it breaks

    Weight-only scope, smaller models, perplexity-only evaluation, kernel dependence and slips

    Premium
  6. 08Using it on a deployment

    Choosing bits and groups, calibrating on domain data, and checking quality and latency

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →