Efficient Inference · 2/4 research notes

Quantizing LLMs: three ways to stop outliers from setting the scale

Naive low-bit quantization breaks on large language models because of a few huge activations. LLM.int8(), SmoothQuant, and GPTQ each take a different route around them.

NeurIPS
2022

LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale

T. Dettmers, M. Lewis, Y. Belkada, L. Zettlemoyer

ICML
2023

SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models

G. Xiao, J. Lin, M. Seznec, H. Wu, J. Demouth, S. Han

ICLR
2023

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

E. Frantar, S. Ashkboos, T. Hoefler, D. Alistarh

TL;DR

  • Plain round-to-grid quantization struggles on large transformers because a few outlier feature dimensions force the scale so wide that everything else loses precision.
  • LLM.int8() routes outliers through FP16, SmoothQuant shifts the difficulty from activations onto weights, and GPTQ solves for the quantized weights instead of just rounding them.
  • The lower you push the bit-width — from 8 bits toward 2 — the more targeted machinery you need.

The outlier problem

The simplest quantizer maps a real value \(x\) onto an integer grid using a single scale \(s\):

\[q = \text{round}(x / s), \qquad \hat x = s \cdot q\]

That is the whole idea, and on large transformers it barely works. The culprit isn’t random noise. LLMs develop specific feature dimensions whose activation magnitudes are many times larger than everything around them.

A few outliershuge activation magnitudes
→
Wide scalestretched to cover them
→
Crushed valuesordinary values collapse onto a few grid points

One shared scale lets a handful of dimensions dictate precision for everyone else.

The outliers aren’t the ones who suffer. Covering them is easy. The damage lands on the ordinary values, which get squeezed into a handful of grid points once \(s\) is wide enough for the extremes.

The three papers below all refuse to let outliers set the scale for everyone else. They just disagree on how.

LLM.int8(): give the outliers their own lane

LLM.int8() doesn’t force every value through one shared 8-bit scale. It quantizes the bulk of values with a vector-wise scheme, so different rows and columns get their own scales.

The small set of outlier feature dimensions is pulled out entirely and computed in FP16 through a separate mixed-precision path. Everything else stays in int8.

>99.9%

of values still computed in int8

175B

OPT-175B converted to Int8 with no measured performance loss vs. 16-bit

~2×

less memory — roughly half of the 16-bit original

Isolate, don’t average. Because the outliers live in specific dimensions, you can carve them out and keep the rest of the matrix multiply fully low-precision.

SmoothQuant: move the difficulty, don’t hide it

SmoothQuant starts from a blunt observation: weights are easy to quantize, activations aren’t. So rather than special-casing outliers at runtime, it rescales the model before quantization happens.

  1. Divide each troublesome activation channel by a per-channel smoothing factor.
  2. Multiply the matching weight channel by the same factor.
  3. Quantize both. The matrix product is mathematically unchanged, but the difficulty has migrated from activations (hard) onto weights (easy).

That shift is enough to unlock full W8A8 — weights and activations at 8 bits, not just weights.

1.56×

speedup with negligible accuracy loss

~2×

memory reduction

530B

model served on a single node

GPTQ: stop rounding, start solving

GPTQ throws out the fixed-rule approach entirely. It treats quantization as a per-layer optimization problem: given a small calibration set, find the quantized weights that minimize that layer’s output reconstruction error.

Approximate second-order information decides the order in which weights get quantized and how to compensate for each one’s error. It is one-shot, with no retraining.

3–4 bits

per weight for a 175B model

~4

GPU-hours to quantize it

~3.25×

measured speedup, with the model fitting on a single GPU

It holds up surprisingly far down. Pushed all the way to 2-bit, GPTQ still produces a usable model — territory where naive rounding simply stops working.

Side by side

LLM.int8()

Separate the outliers

  • Outliers in FP16, the rest in INT8
  • W8 (mixed precision)
  • 175B model, no degradation, ~2× less memory

SmoothQuant

Rebalance before quantizing

  • Rescales activations ↔ weights ahead of time
  • W8A8
  • 1.56× speedup, ~2× memory reduction

GPTQ

Solve for the weights

  • Minimizes per-layer reconstruction error
  • W3–W4, down to 2-bit
  • 175B model on 1 GPU, ~3.25× speedup

None of these is “quantization” as one fixed algorithm. Each found a structural weak point and built the method around it.

LLM.int8() exploits which dimensions are outliers. SmoothQuant exploits which operand is actually hard to quantize. GPTQ exploits what a layer’s own reconstruction error looks like.

That is also roughly the order of difficulty. Going from 8 bits toward 2 demands progressively more of this kind of targeted machinery, because simple rounding gives out somewhere along the way.

Key takeaways

  • Naive quantization of LLMs fails because of outlier activations, not random noise.
  • LLM.int8(): keep >99.9% of values in int8 and route outliers through FP16 — OPT-175B with no measured loss.
  • SmoothQuant: migrate difficulty from activations to weights to get full W8A8.
  • GPTQ: solve per-layer reconstruction to reach 3–4 bits, still usable at 2-bit.
  • Lower bit-widths need more targeted machinery aimed at a specific structural weak point.