Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

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

  • Problem Billion-parameter transformers need large GPU memory at inference, and earlier 8-bit methods either lost accuracy or were only tested on small models.
  • Method Combines vector-wise Int8 quantization, which gives each inner product its own scale, with a 16-bit path for the few outlier feature dimensions.
  • Results Keeps 13B-parameter C4 perplexity at 12.45, equal to the 32-bit model, where absmax vector-wise Int8 reaches 16.48.

Figure 2: Schematic of LLM.int8(). Given 16-bit floating-point inputs Xf 16 and weights Wf 16, the
features and weights are decomposed into sub-matrices of larg…

Figure 2 : Schematic of LLM.int8(). Given 16-bit floating-point inputs Xf 16 and weights Wf 16, the features and weights are decomposed into sub-matrices of large magnitude features and other values. The outlier feature matrices are multiplied in 16-bit. All other values are multiplied in 8-bit. We perform 8-bit vector-wise multiplication by scaling by row and column-wise absolute maximum of Cx and Cw and then quantizing the outputs to Int8. The Int32 matrix multiplication outputs Outi32 are dequantization by the outer product of the normalization constants Cx⊗ Cw. Finally, both outlier and regular outputs are accumulated in 16-bit floating point outputs.

Original paper · CC BY 4.0 · Tim Dettmers, Mike Lewis, Younes Belkada, Luke Zettlemoyer · LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale · Original paper figure · Extracted the figure area from page 3 of the original PDF.

Why 8-bit inference breaks at scale

Large transformer language models spend most of their inference cost in the feed-forward and attention projection layers, which hold most of the parameters and account for 65-85% of the computation. Storing those weights in fewer bits is an obvious way to cut memory, and 8-bit quantization is the natural target.

Whether quantization is free of degradation at this small scale was already unclear, and at billions of parameters the problem was open.

The obstacle is a set of large-magnitude outlier features that appear in all transformer layers once models reach about 6.7B parameters, and these features break the precision of simple quantization.

Quantization with a single scale per tensor is fragile because one large value sets the scale for every other value in that tensor. The outlier features reach magnitudes up to 20x those of the other feature dimensions.

Vector-wise scaling of inner products

Absmax quantization maps an FP16 matrix to Int8 by multiplying it by 127 divided by its largest absolute value and rounding, so the scale is set by the single largest entry. Zeropoint quantization instead uses the full range of the datatype by shifting values with a zeropoint, which helps asymmetric distributions but adds extra terms to the arithmetic.

Row-wise quantization gives each row of the hidden states its own constant, which limits how far one outlier can compress the others. The method refines this by treating the matrix product as a set of independent inner products, so each row of the hidden states and each column of the weights gets a separate constant.

The result of each inner product is rescaled by the reciprocal of the product of its row and column constants, and across the whole matrix this is a denormalization by the outer product of the two constant vectors. Because the scales are computed per inner product, the Int8 values keep more precision than with one scale per tensor.

Beyond that scale, the outlier dimensions remain too large for a per-row scale to handle, which motivates the second part of the method.

Mixed-precision decomposition of outliers

The outlier dimensions are collected into a set O: any feature dimension that has at least one value with magnitude at least the threshold α is placed in O, and α is set to 6.0. Given the weight matrix, the product is written as a sum over outlier dimensions computed in 16-bit plus a denormalized Int8 sum over the remaining dimensions.

The product is therefore split into a 16-bit part for the columns in O and an Int8 part for all other columns, with the Int8 part scaled back by the denormalization term. Because outliers are few and fixed to particular dimensions, the 16-bit part touches only a small slice of the features while more than 99.9% of the values are multiplied in 8-bit.

The number of outlier dimensions is at most 7 for transformers up to 13B parameters, so the decomposition adds only about 0.1% memory. Overall, the weights and most features stay in Int8 and the memory footprint of the model is about half that of 16-bit, which gives a 1.96x reduction for BLOOM-176B.

Figure 2 shows the full flow: the outlier columns are multiplied in 16-bit, the remaining values are scaled with the row and column constants and multiplied in Int8, the Int32 result is dequantized by the outer product of the constants, and both outputs are added in 16-bit floating point.

Where the outlier features come from

The analysis counts a feature dimension as an outlier when a value in it has magnitude at least 6.0, it affects at least 25% of the layers, and it appears in at least 6% of the sequence dimensions. These thresholds were chosen empirically so that a single outlier appears in the smallest model with 125M parameters.

Figure 3 plots the share of layers and sequence dimensions affected against model size and against C4 perplexity.

When measured by perplexity instead of parameter count, the spread of outliers looks smooth and exponential, which the authors read as a sign that emergence depends on the training quality and not only on model size. The number of outlier features rises strictly monotonically as perplexity falls, while the relation with model size is non-monotonic.

Figure 4 shows that the median magnitude of the largest outlier rises sharply once outliers occur in all layers, which the authors give as the main reason quantization fails. Large, asymmetric outliers leave most quantization bins empty, so small values are rounded to zero.

Zeroing these dimensions lowers the mean top-1 softmax probability from about 40% to about 20% and raises validation perplexity by 600-1000%, while zeroing 7 random dimensions changes top-1 probability by only 0.02-0.3% and perplexity by 0.1%.

Outliers are mostly one-sided, so zeropoint quantization can map them onto the full range, which the authors offer as the reason zeropoint looks strong in the perplexity table.

Perplexity and zeroshot scaling

Perplexity was measured on C4 validation data for dense autoregressive transformers pretrained in fairseq from 125M to 13B parameters. Table 1 lists the 32-bit float perplexities and the Int8 variants at each size.

At 13B parameters the 32-bit model reaches 12.45, absmax vector-wise Int8 reaches 16.48, and absmax LLM.int8() with vector-wise quantization and decomposition reaches 12.45. Plain absmax Int8 at 125M reaches 87.76, against 25.65 for 32-bit, which is the scale effect the study is probing at the small end.

Vector-wise quantization without decomposition stays close to the 32-bit model up to 2.7B parameters, with 14.98 against 14.43 for absmax vector-wise at 2.7B. Zeropoint quantization shows an advantage in the table but loses it once decomposition is added, as the zeropoint LLM.int8() row reaches 25.69, 15.92, 14.43, 13.24 and 12.45 from 125M to 13B.

Figure 1 tracks mean zeroshot accuracy over WinoGrande, HellaSwag, PIQA and LAMBADA for OPT models from 125M to 175B parameters. LLM.int8() stays at the 16-bit level across that range, while the 8-bit absmax vector-wise baseline declines to random performance at large scale.

The perplexity table ends at 13B parameters, so the 175B result rests on the zeroshot evaluation of OPT models.

Memory and speed

The memory saving lets OPT-175B and BLOOM run on a single server with consumer GPUs, including 8x RTX 3090 with 24 GB each in 8-bit. For BLOOM-176B the memory footprint drops by 1.96x.

In the matrix multiplication benchmark for the first feed-forward layer of GPT-3 sized models, LLM.int8() with decomposition runs at 0.14x, 0.20x, 0.36x, 0.51x, 0.64x and 0.86x of the 16-bit speed for model dimensions 768 to 4096. It reaches 1.22x at model dimension 5140 and 1.81x at model dimension 12288.

Quantization and decomposition overhead make models with model dimension 2560 or smaller slower, and the authors attribute the gap to unoptimized kernels for quantization and decomposition.

End-to-end, BLOOM-176B runs at 239 ms per token at batch size 1 on 8x A100 80GB in bfloat16, against 253 ms for LLM.int8() on 8x A100 80GB, 246 ms on 4x A100 80GB and 247 ms on 3x A100 80GB. Overall Int8 inference is slightly slower than 16-bit inference, but it fits on fewer GPUs.

Limitations

The analysis covers only the Int8 data type and does not study 8-bit floating-point types. The models studied go up to 175B parameters, and additional emergent properties might disrupt the method at larger scales.

Attention computation is not run in Int8, and an initial exploration suggested it needs quantization methods beyond those developed here. The study covers inference, and an initial analysis of Int8 finetuning and training is given in the appendix only.

In training, using 8-bit linear attention projections with vector-wise quantization degrades neural machine translation and the 1.1B language model, and mixed-precision decomposition does not fully recover performance in most cases. The authors conclude that 8-bit feedforward layers are straightforward to train, while other layers need additional techniques or different data types.

Paper info

Authors
Tim Dettmers, Mike Lewis, Younes Belkada, Luke Zettlemoyer
Venue
arXiv · Preprint
First published
2022-8-15
Added
2026-10-20
Updated
2022-11-10
Version
v2
arXiv
2208.07339
Category
cs.LG · cs.AI
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

Large language models have been widely adopted but require significant GPU memory for inference. We develop a procedure for Int8 matrix multiplication for feed-forward and attention projection layers in transformers, which cut the memory needed for inference by half while retaining full precision performance. With our method, a 175B parameter 16/32-bit checkpoint can be loaded, converted to Int8, and used immediately without performance degradation. This is made possible by understanding and working around properties of highly systematic emergent features in transformer language models that dominate attention and transformer predictive performance. To cope with these features, we develop a two-part quantization procedure, LLM.int8(). We first use vector-wise quantization with separate normalization constants for each inner product in the matrix multiplication, to quantize most of the features. However, for the emergent outliers, we also include a new mixed-precision decomposition scheme, which isolates the outlier feature dimensions into a 16-bit matrix multiplication while still more than 99.9% of values are multiplied in 8-bit. Using LLM.int8(), we show empirically it is possible to perform inference in LLMs with up to 175B parameters without any performance degradation. This result makes such models much more accessible, for example making it possible to use OPT-175B/BLOOM on a single server with consumer GPUs. We open-source our software.

Quote from the paper

Tim Dettmers, Mike Lewis, Younes Belkada, Luke Zettlemoyer (2022). LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale. arXiv:2208.07339v2. https://arxiv.org/abs/2208.07339v2

BibTeX
@misc{dettmers2022int8,
  title = {{LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale}},
  author = {Tim Dettmers and Mike Lewis and Younes Belkada and Luke Zettlemoyer},
  year = {2022},
  eprint = {2208.07339},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.07339v2}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up