GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
NeurIPS 2022

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

Past 6.7B parameters a handful of hidden dimensions grow 20x larger than the rest and wreck int8 quantization. Keep them in 16-bit and int8 halves memory with no quality loss, up to 175B.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2022
AUTHORS
Dettmers, Lewis, Belkada, Zettlemoyer
FROM
University of Washington, Facebook AI Research, Hugging Face, ENS Paris-Saclay
PUBLISHED
Aug 2022 · NeurIPS 2022
CITED BY
1,428Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 20% of this breakdown.

01

The paper in one minute

Quantizing a model's weights from 16-bit to 8-bit integers halves the memory they take. For small transformers this worked; for multi-billion-parameter models, every 8-bit method tried before this paper degraded quality, and the larger the model, the worse it got. Dettmers and colleagues found out why and fixed it.

The cause is a property of large transformers they call emergent outlier features. In a model's hidden states, a few specific feature dimensions carry values up to 20 times larger than the others. They appear in some layers in smaller models and, at around 6.7 billion parameters, show up in the same few dimensions in every layer and for most tokens. In a 6.7B model with 2,048-token sequences there are about 150,000 such outliers per sequence, but they sit in just 6 dimensions. They matter: zeroing them halves the model's top-1 attention probability and makes perplexity 6 to 10 times worse. Zeroing 6 random dimensions barely changes anything.

Ordinary int8 quantization scales a whole tensor (or row) by its largest value. One outlier of 60 forces every ordinary value, which sits within about ±3.5, into a handful of the 255 integer levels, and precision collapses.

LLM.int8() has two parts. Vector-wise quantization gives every row of the input and every column of the weights its own scaling constant. Mixed-precision decomposition pulls out any feature column containing a value of magnitude 6 or more and multiplies those few columns in 16-bit, while more than 99.9% of the values go through int8. The method needs no retraining or calibration data: load a 16-bit checkpoint, convert, and run. It held 16-bit accuracy up to 175B parameters and was released as the bitsandbytes library with a Hugging Face integration.

THE IDEA, VISUALLY
SPLIT THE MATRIX MULTIPLY (SECTION 3) hidden states X: rows are tokens, columns are features columns with |x| >= 6 everything else outlier columns fp16 matmul, ~0.1% all other columns int8, scale per row and column add in fp16 ordinary features sit within about +/-3.5; outliers are 3-20x larger, one-sided, in the same few dimensions in every layer from about 6.7B params 6.7B model: ~150,000 outliers per 2,048-token sequence, all in 6 feature dimensions 13B MODEL, C4 PERPLEXITY (TABLE 1) lower is better 32-bit float 12.45 int8 absmax 19.08 int8 vector-wise 16.48 int8 zeropoint 13.94 LLM.int8() 12.45 WEIGHT MEMORY VS GPU SETUPS (TABLE 2) OPT-175B, 16-bit 352 GB OPT-175B, int8 176 GB 8x RTX 3090 192 GB int8 fits eight 24 GB cards; 16-bit needs 8x A100 80GB IT SAVES MEMORY, NOT TIME (TABLES 5, 6) matmul vs fp16: 0.86x at 6.7B, 1.22x at 13B, 1.81x at 175B BLOOM-176B per token: 239 ms bf16 on 8 GPUs, 253 ms int8 on 8 GPUs, 247 ms int8 on 3 arXiv 2208.07339, NeurIPS 2022
LLM.int8() splits each matrix multiplication in two. The few feature columns with values of 6 or more, about 0.1% of features, are multiplied in 16-bit; everything else is quantized to int8 with a separate scale for every row of the input and every column of the weights. The two results are added back together in 16-bit.
Research notes: the problem, approach and results
12.45 → 12.45

C4 perplexity of a 13B model at 32-bit and with LLM.int8(); plain int8 absmax gave 19.08 (Table 1)

6 dimensions

hold about 150,000 outliers per 2,048-token sequence in a 6.7B model (Section 4.2)

1.96x

smaller memory footprint for BLOOM-176B with int8 projection layers (Section 3)

THE PROBLEM

Large models need large GPU memory just to hold their weights, and 8-bit quantization methods that worked for models under 350M parameters degraded badly beyond a few billion. A 175B model in 16-bit needs about 350 GB, more than most servers have.

THE IDEA

Quantize the feed-forward and attention projection layers to int8 with vector-wise scaling, a separate constant per input row and weight column. Find the few feature dimensions that carry very large values (magnitude 6 or more) and multiply those in 16-bit, leaving more than 99.9% of values in 8-bit. No retraining or calibration.

THE RESULT

LLM.int8() matched 16-bit perplexity on C4 from 125M to 13B parameters and 16-bit zero-shot accuracy on OPT up to 175B, while ordinary int8 methods fell apart from 6.7B. It cut BLOOM-176B's memory by 1.96x, enough to run OPT-175B on eight 24 GB consumer GPUs, at a small speed cost.

02

Why it matters to an FDE

This is the method behind load_in_8bit=True in Hugging Face Transformers, and its findings explain why quantizing large models takes more than rounding.

Memory is the usual blocker, and this halves it. A model that does not fit on a customer's GPUs in 16-bit often fits in int8: the paper's Table 2 runs OPT-175B on eight 24 GB RTX 3090s, which could only hold OPT-66B in 16-bit. When the alternative is buying hardware or using a smaller model, int8 is a quick first try.

It is not a speedup. The paper's own benchmarks show the decomposition adds overhead. For models of 6.7B and smaller, LLM.int8() matrix multiplication is slower than 16-bit; on BLOOM-176B, per-token latency rose about 5% on the same GPUs. Use it to fit a model, not to make it faster.

Outliers are why quantization needs care. The same few large features cause trouble for 4-bit and activation quantization methods that came after. When a quantized model loses accuracy, a handful of extreme dimensions is the first suspect.

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

    Outlier features, why per-tensor int8 fails, the two-part fix, the costs and two misreadings

    Free account
  2. 04How it works

    Absmax and zeropoint quantization, vector-wise scaling, the decomposition and the outlier criteria

    Premium
  3. 05The numbers that matter

    Perplexity by method and size, outlier statistics, hardware fits and runtime tables

    Premium
  4. 06Try it yourself

    Memory fits, int8 error with and without decomposition on an outlier matrix, and the speed tables

    Premium
  5. 07Where it breaks

    Speed overhead, inference-only scope, layers left in 16-bit, newer formats, and slips

    Premium
  6. 08Using it on a deployment

    When to reach for int8, how to check quality, and when 4-bit is the better tool

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →