Three papers on rounding model weights to 4 or 8 bits: why outliers break it, and how LLM.int8(), GPTQ and AWQ cope.
Large language models store billions of numbers, usually 16 bits each. Quantization stores each number with fewer bits, such as 8 or 4, so the model needs less memory and fits on fewer GPUs. The hard part is that a few unusual numbers can ruin the rounding for everything else. This article follows three papers that handle it in different ways.
LLM.int8(): Dettmers, Lewis, Belkada, Zettlemoyer, 2022. arxiv.org/abs/2208.07339. NeurIPS 2022.
GPTQ: Frantar, Ashkboos, Hoefler, Alistarh. ICLR 2023. arxiv.org/abs/2210.17323
AWQ: Lin, Tang, Tang, Yang, Chen, Wang, Xiao, Dang, Gan, Han. MLSys 2024. arxiv.org/abs/2306.00978
Rounding numbers to a few levels is easy, but an outlier (a number much bigger than the rest) stretches the levels and ruins the small numbers, so good methods either set outliers aside, round with compensation, or protect the numbers that matter most.
Quantization maps each number to the nearest of a small set of levels, and stores only the level's index. With 4 bits there are 16 levels. Reading the model back means multiplying the index by a step size.
The step size is the scale . In the common "absmax" form (used in LLM.int8() and AWQ) you set so the largest absolute value in the group lands on the top level. Toy example (made up, 4-bit with levels to ):
Some methods also use a zero-point , a shift so that a range not centred on zero uses all the levels. LLM.int8() describes both forms. Toy example: numbers range from to , with 16 levels (0 to 15). Then and . The number becomes , and reads back as .
Take the same list but replace with an outlier (toy example). Now . The numbers become: . Six of the eight ordinary numbers now share only the levels , and , and four of them are zero. The detail is gone.
The LLM.int8() paper shows this happens in real models. Beyond about 6.7 billion parameters, some hidden-state dimensions get values up to 20 times larger than the others. At 6.7B these outliers sit in only 6 dimensions out of the whole network, yet they matter a lot: setting them to zero raised validation perplexity by 600 to 1000%, while removing the same number of random dimensions changed it by about 0.1%. (Perplexity is a score for how surprised the model is by real text. Lower is better.) Note that these outliers are in the activations (the values flowing through the model as it reads text), not in the stored weights.
LLM.int8() has two parts:
On C4 validation perplexity (Table 1), plain absmax 8-bit gets worse as models grow, while LLM.int8() matches full precision:
| Model size | 32-bit | Int8 absmax | LLM.int8() |
|---|---|---|---|
| 6.7B | 13.30 | 14.59 | 13.24 |
| 13B | 12.45 | 19.08 | 12.45 |
Another way to limit an outlier's damage is to give each small group of numbers its own scale. A group of 128 weights is common, written "g128". Toy example with groups of 4, using the outlier list from Step 2:
The cost is that each group stores its own scale. GPTQ reports that groups of 128 cost about 0.15 extra bits per weight, and groups of 1024 cost about 0.02. In GPTQ's tests, groups of 128 moved the 4-bit and 3-bit results to within 0.1 to 0.3 perplexity of the uncompressed model on its largest models.
GPTQ is post-training: it takes a finished model and needs no retraining. It works one layer at a time. For each layer with weights , it tries to find quantized weights that keep the layer's output close, meaning it minimizes on a small sample of real inputs .
It quantizes the columns of in turn. After each column is rounded, the leftover error is spread over the columns not yet quantized, so they can compensate. This uses second-order information (how the error changes with each weight, from the inverse of a matrix called the Hessian built from the sample inputs). Two tricks (a fixed column order and batched updates) let it quantize a 175B model in about four GPU hours.
Round column 1 to the grid and measure the error
Results on OPT-175B, WikiText2 perplexity (Table 3), where lower is better:
| Method | Bits | Perplexity |
|---|---|---|
| Full precision | 16 | 8.34 |
| Round to nearest | 4 | 10.54 |
| GPTQ | 4 | 8.37 |
| Round to nearest | 3 | 7300 |
| GPTQ | 3 | 8.68 |
AWQ is also post-training and weight-only. Its first finding: keeping only 1% of weights in 16-bit greatly cuts the error, but only if you pick those weights by looking at the activations, not at the weights themselves. A weight that gets multiplied by large activations matters more. In its Table 1 (OPT-6.7B, 3-bit, groups of 128, WikiText perplexity), plain rounding gives 23.54. Keeping 1% in 16-bit chosen by activations gives 11.39. Chosen by weight size it gives 22.37, and chosen at random 24.23.
Mixed 16-bit and 3-bit storage is awkward on hardware. So AWQ instead multiplies the important weight channels by before rounding, and divides the matching input by , which leaves the layer's output mathematically unchanged. A bigger weight takes up more of the grid, so its rounding error is smaller in comparison. With on the important 1% of channels, perplexity falls from 23.54 to 11.92. A larger hurts the other channels, so AWQ searches for a good scale per channel on a small calibration sample.
Why 4-bit weights are faster: the AWQ paper observes that weight access dominates memory traffic on-device, so 4-bit weights cut it fourfold. Its TinyChat system reaches more than 3 times the speed of a Hugging Face FP16 setup.
LLaMA-2 7B, WikiText2 perplexity, groups of 128 (AWQ paper, Table 4; lower is better):
| Bits | Round to nearest | GPTQ | AWQ |
|---|---|---|---|
| 16 (baseline) | 5.47 | 5.47 | 5.47 |
| 4 | 5.73 | 5.69 | 5.60 |
| 3 | 6.66 | 6.43 | 6.24 |