Uniform Quantization and Its Error
Affine quantizers, the exact error bound, the additive-noise model that is not a theorem, and the clipping–resolution trade-off.
The affine quantizer
For a target integer range and a clipping interval , define the scale and zero point
and the quantize / dequantize pair
The quantizer is symmetric when , which requires .
If , so that no clamping occurs, then
This is a deterministic bound — it holds for every input, with no probabilistic assumption. Keep it separate in your mind from what follows.
Error as a random variable
Let for an integer , so that lies in the cell rounding to . Then the error satisfies
Heuristic — a reasoning shortcut that predicts the right answer in the regimes discussed here. It is not a proof and can fail outside them.
For a general input distribution, one models quantization as
with uncorrelated across coordinates.
Signal-to-quantization-noise ratio
Assume the noise model, a symmetric -bit quantizer with clipping range so that , and a signal with variance and negligible clipping. Then
Key idea
Two readings, both useful:
- Each bit buys about 6 dB, a factor of 4 in noise power. Going from 8-bit to 4-bit costs 24 dB — a 250× increase in quantization noise power, which is why 4-bit needs machinery that 8-bit does not.
- The loading factor enters as a penalty. If one outlier forces to be , the term dB eats nearly six bits of precision. The grid is being spent on a range almost no value occupies.
That second reading is the central practical fact about quantizing transformers, and the reason per-tensor scaling is inadequate for activations.
Clipping versus resolution
Let have density , symmetric about , and quantize with bits over . Under the noise model for the unclipped part, the mean squared error decomposes as
The first term is increasing in and the second decreasing, so if is unbounded the minimiser is attained at some finite A^\star > 0.
The formats in use
Open problem — no proof and no counterexample is known to the author of this page.
There is no satisfactory theory predicting end-task degradation from quantization error. The chain from weight-level MSE, through layer output perturbation, to next-token distribution shift, to downstream accuracy is not analytically controlled for networks of this depth: layer-wise error bounds compose multiplicatively through Lipschitz constants that are far too loose to be informative. Quantization methods are selected by measurement, and claims that a format "preserves quality" are empirical claims about particular benchmarks, not theorems.
References
- SurveyR. M. Gray, D. L. Neuhoff (1998). QuantizationThe standard reference for the theory, including when the additive-noise model is and is not valid.
- PaperT. Dettmers et al. (2022). LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale
These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.
Results stated on this page
- PropositionAffine quantization round-trip errorproof includedWith step size Δ and no clipping, the dequantized value differs from the original by at most Δ/2, deterministically.
- PropositionExact error law on a single cellproof includedIf the input is uniform on one quantization cell, the error is exactly uniform on [−Δ/2, Δ/2] with variance Δ²/12.
- HeuristicThe additive white-noise modelTreating quantization error as zero-mean noise of variance Δ²/12, independent of the signal, is an approximation that fails at low bit widths.
- PropositionSix decibels per bitproof includedUnder the noise model, each additional bit adds 6.02 dB of signal-to-quantization-noise ratio.
- PropositionClipping and resolution trade offproof includedTotal distortion splits into a clipping term that decreases with range and a rounding term that grows with it, so an interior optimum exists.
Problems (5)
All problems- The round-trip error boundProofFoundation⏱ 15 min
- Optimal clipping for a Laplace-distributed tensorProofAdvanced⏱ 1 hour
- The true bit width of a group-quantized formatNumericalFoundation⏱ 15 min
- The Δ²/12 noise varianceProofBeginner⏱ 15 min
- Six decibels per bit, and what outliers costNumericalBeginner⏱ 30 min