Paper commentary
GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers
- Problem Accurate post-training quantization of GPT-scale models at 3 or 4 bits per weight was unresolved, because the accurate methods do not scale to billions of parameters and round-to-nearest loses accuracy at low bit widths.
- Method GPTQ quantizes each linear layer with approximate second-order updates: it fixes a column order, processes blocks of 128 columns with lazy batch updates, and uses a Cholesky-based inverse Hessian.
- Results Reached 8.37 WikiText2 perplexity for 4-bit OPT-175B, against 8.34 for FP16 and 10.54 for RTN; 3-bit OPT-175B per-token latency on an A100 fell from 230 ms to 71 ms (3.24x in the table).

Figure 2 : GPTQ quantization procedure. Blocks of consecutive columns (bolded) are quantized at a given step, using the inverse Hessian informa- tion stored in the Cholesky decomposition, and the remaining weights (blue) are updated at the end of the step. The quantization procedure is applied recursively inside each block: the white middle column is currently being quantized.
Original paper · CC BY 4.0 · Elias Frantar, Saleh Ashkboos, Torsten Hoefler, Dan Alistarh · GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers · Original paper figure · Extracted the figure area from page 4 of the original PDF.Why GPT-scale weights are hard to quantize
At 175 billion parameters, GPT-3 weights stored in float16 occupy about 326GB, which is more than the largest single GPUs hold, so even inference needs multi-GPU deployments. Compression is the obvious remedy, but the methods that give the highest accuracy at low bit widths need retraining or are complex enough that they do not scale to billions of parameters.
The round-to-nearest approach has been applied at the scale of GPT-175B, yet it preserves accuracy only at higher bit widths such as 8-bit, so whether one-shot quantization can reach 3 or 4 bits remained open.
Layer-wise objective and the OBQ starting point
Each linear layer is handled on its own. For weights W and the inputs X that a small set of calibration points produces at that layer, the quantized weights \(\hat W\) are chosen to minimize \(\arg\min_{\hat W}\|WX-\hat WX\|_2^2\), which is the squared difference between the full-precision and the quantized layer output. The quantization grid is fixed before the optimization starts, and the individual weights are then allowed to move freely off their nearest grid values.
GPTQ builds on Optimal Brain Quantization, which treats each row of W as an independent quadratic problem whose Hessian is \(H_F = 2X_FX_F^\top\), where F is the set of weights not yet quantized. OBQ repeatedly chooses the weight whose rounding costs the least, quantizes it, and shifts all remaining unquantized weights to compensate. Each removal updates the inverse Hessian with one elimination step instead of a full recomputation.
The cost is high for large matrices: for a d_row by d_col matrix the runtime scales with the cube of d_col for every row, so OBQ, which takes about an hour on a ResNet-50 with 25M parameters, is impractical for billion-parameter models.
How GPTQ makes the procedure cheap enough
GPTQ drops the greedy order. Quantizing the weights in one fixed order gives a final error close to the greedy result, and the gap is smallest on large, heavily parametrized layers. Since the Hessian depends only on the layer inputs and not on the weights, the same inverse Hessian serves every row. Its update therefore runs once per column rather than once per weight, which lowers the runtime from the row-times-cube form to a bound that is smaller by a factor of min of d_row and d_col.
A direct implementation is limited by memory bandwidth, because each update touches a large matrix for only a few floating-point operations per entry. The rounding decision for a column is affected only by updates made to that same column, so GPTQ applies the algorithm to blocks of B = 128 columns and keeps the updates inside the block. Once a block is finished, the whole inverse Hessian and the weight matrix receive one global update, written with the index set Q of the quantized weights.
This leaves the arithmetic unchanged but reduces memory traffic, which the authors report gives about an order-of-magnitude speedup on very large models.
Repeated inverse updates accumulate numerical errors, and the inverse Hessian can become indefinite. The authors observed that this almost certainly happens for at least a few layers once models pass a few billion parameters. For smaller models, adding a small constant to the diagonal of H, set to 1% of the average diagonal value, is enough.
Larger models need a more robust route. Only the rows of the inverse Hessian are needed, and the row removal is essentially a Cholesky decomposition, except that the Cholesky version divides each row by the square root of its diagonal entry. The needed rows can therefore be precomputed with a well-optimized Cholesky kernel, which also adds speed.
Algorithm 1 combines these pieces. It uses the transposed Cholesky factor of the inverse Hessian, quantizes the columns of each block one at a time while updating the rest of the block, and then updates all remaining weights at the end of the block.
Calibration data and the block-by-block pipeline
Calibration uses 128 random segments of 2048 tokens from the C4 dataset, which is generic web text and not task-specific data. Quantization uses a standard uniform per-row asymmetric grid on the min-max range, similar to the setup in Dettmers et al. (2022).
Only one Transformer block of six layers is loaded at a time. Its layer Hessians are accumulated, the block is quantized, and the block inputs are then passed through the already quantized block to produce the inputs of the next block. Because later blocks see the inputs of the partially quantized model, the procedure does not use the full-precision layer inputs, and the authors found this gave noticeable gains at negligible extra cost.
The RTN baseline rounds every weight to the nearest value on exactly the same asymmetric per-row grid, so a comparison with GPTQ isolates the effect of its compensating updates.
Small vision models and the OBQ comparison
On ResNet18, with a full-precision accuracy of 69.76%, GPTQ reaches 69.37 at 4 bits and 67.88 at 3 bits; on ResNet50, with 76.13%, it reaches 75.71 at 4 bits and 74.87 at 3 bits. At 4 bits GPTQ is on par with the other methods, and at 3 bits it is slightly below the most accurate ones. It clearly outperforms AdaQuant, which falls to 59.21 at 3 bits on ResNet18.
On BERT-base and OPT-125M, GPTQ and the full greedy OBQ perform similarly at 4 bits, and GPTQ is slightly better at 3 bits. The authors suspect that heuristics of OBQ, such as early outlier rounding, need adjustment for non-vision models. GPTQ takes under a minute on these models, against about an hour for OBQ.
Perplexity across the OPT and BLOOM families
The OPT and BLOOM families are quantized to 3 and 4 bits and evaluated by WikiText2 perplexity, where lower is better; Figure 1 shows the 4-bit OPT and 3-bit BLOOM trends.
For OPT-175B at 4 bits, GPTQ reaches 8.37 against 8.34 for FP16, a loss of 0.03 perplexity, while RTN reaches 10.54. The authors note that RTN at 4 bits on the 175B model is worse than the full-precision 13B model, which is ten times smaller.
At 3 bits, RTN collapses on OPT-175B with a perplexity of 7.3e3, while GPTQ reaches 8.68. For OPT-66B at 3 bits, GPTQ reaches 14.16, compared with 10.27 at 30B, so the trend is not monotone.
BLOOM follows a similar pattern with smaller gaps between methods, which the authors take as a sign that this family is easier to quantize. On BLOOM-176B at 3 bits, GPTQ reaches 8.64 against 8.11 for FP16 and 571 for RTN.
Larger models generally appear easier to quantize, except OPT-66B, which the authors link to a significant fraction of dead units in its early layers.
Quantization time for the full models
Table 2 lists 4.2 hours for OPT-175B and 3.8 hours for BLOOM-176B.
For comparison, ZeroQuant-LKD reports 3 hours for a 1.3B model on the same hardware, which the authors extrapolate linearly to several hundred hours at 175B. Adaptive rounding methods use many more SGD steps.
Latency of generative inference
Quantized to 3 bits, OPT-175B takes about 63GB including the embeddings and output layer, which stay in FP16, and the key and value history for 2048 tokens adds about 9GB. The whole model therefore fits on one 80GB A100 and is run by dequantizing layers as they are needed; the model does not fit that way at 4 bits.
Generation is a sequence of matrix-vector products, which are limited by memory bandwidth. GPTQ uses a quantized-matrix full-precision-vector kernel that dequantizes weights during the product, so it reads much less memory even though it adds compute. The authors note that almost all of the speedup comes from these kernels, because communication costs are small in their accelerate-style setup, and no activation quantization is involved.
Table 6 gives average per-token latency at batch size 1 for sequences of length 128: on an A100, 3-bit OPT-175B takes 71 ms against 230 ms for FP16 on 5 GPUs, which the table lists as 3.24x and the text rounds to about 3.25x. Each ratio compares against the FP16 setup on the GPU count listed, so it combines the kernel speed with the smaller number of GPUs.
Grouping and extreme quantization
Grouping applies independent quantization to groups of g consecutive weights, and GPTQ combines with it naturally, because the group parameters are set during each layer's quantization from the most recent weight values.
Group size 1024 costs about 0.02 extra bits and improves perplexity by about 0.2 on average, while group size 128, at about 0.15 extra bits, adds another 0.1 and sits 0.1 to 0.3 above the uncompressed accuracy. In Table 5, OPT-175B at 3 bits goes from 8.68 without grouping to 8.45 with group size 128, and BLOOM-176B from 8.64 to 8.26.
At about 2.2 bits with group size 128, the perplexity increase is below 1.5 points, and at about 2.6 bits with group size 32 it is 0.6 to 0.7 points.
With group size 8 the weights become ternary, with values -1, 0 and +1, and this gives 9.20 WikiText2 perplexity on OPT-175B against 8.34 for FP16, a drop of less than one point.
Limitations
The method does not speed up the multiplications themselves, because mainstream hardware lacks support for mixed-precision operands such as FP16 by INT4, so its gains come from reduced memory movement rather than fewer computations.
Activation quantization is not included in the results, since the authors consider activations not a significant bottleneck in their target scenarios, and they point to orthogonal techniques as a route to add it.
The study covers generative tasks evaluated with perplexity and zero-shot tasks. The effects of compression on bias and other secondary measures were not studied, and the authors call for that work.
AdaRound and BRECQ were not run on the models with many billions of parameters, because the authors judge them too slow for that scale. The head-to-head comparison with full OBQ covers only BERT-base and OPT-125M, and the vision comparison covers only ResNet18 and ResNet50.
Paper info
- Authors
- Elias Frantar, Saleh Ashkboos, Torsten Hoefler, Dan Alistarh
- Venue
- arXiv · Preprint
- First published
- 2022-10-31
- Added
- 2026-10-20
- Updated
- 2023-3-22
- Version
- v2
- arXiv
- 2210.17323
- Category
- cs.LG
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Generative Pre-trained Transformer models, known as GPT or OPT, set themselves apart through breakthrough performance across complex language modelling tasks, but also by their extremely high computational and storage costs. Specifically, due to their massive size, even inference for large, highly-accurate GPT models may require multiple performant GPUs, which limits the usability of such models. While there is emerging work on relieving this pressure via model compression, the applicability and performance of existing compression techniques is limited by the scale and complexity of GPT models. In this paper, we address this challenge, and propose GPTQ, a new one-shot weight quantization method based on approximate second-order information, that is both highly-accurate and highly-efficient. Specifically, GPTQ can quantize GPT models with 175 billion parameters in approximately four GPU hours, reducing the bitwidth down to 3 or 4 bits per weight, with negligible accuracy degradation relative to the uncompressed baseline. Our method more than doubles the compression gains relative to previously-proposed one-shot quantization methods, preserving accuracy, allowing us for the first time to execute an 175 billion-parameter model inside a single GPU for generative inference. Moreover, we also show that our method can still provide reasonable accuracy in the extreme quantization regime, in which weights are quantized to 2-bit or even ternary quantization levels. We show experimentally that these improvements can be leveraged for end-to-end inference speedups over FP16, of around 3.25x when using high-end GPUs (NVIDIA A100) and 4.5x when using more cost-effective ones (NVIDIA A6000). The implementation is available at https://github.com/IST-DASLab/gptq.
Quote from the paper
Elias Frantar, Saleh Ashkboos, Torsten Hoefler, Dan Alistarh (2022). GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers. arXiv:2210.17323v2. https://arxiv.org/abs/2210.17323v2
BibTeX
@misc{frantar2022gptq,
title = {{GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers}},
author = {Elias Frantar and Saleh Ashkboos and Torsten Hoefler and Dan Alistarh},
year = {2022},
eprint = {2210.17323},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2210.17323v2}
}