Quantization & Numeric Formats
Why FP32 was always overkill, what BF16, FP8 and INT4 actually change, and why halving the bits nearly halves your latency as well as your memory.
#Why precision is an infrastructure decision
Quantization means storing each of the model's numbers in fewer bits — 8 instead of 16, or even 4 — accepting a little imprecision in exchange for a much smaller model. The names below are just bit widths: FP32 is 32 bits per number, BF16 is 16, INT4 is 4.
Why that's an infrastructure decision rather than a research one comes straight from inference arithmetic: the time to produce a token is the bytes of weights you must read divided by memory bandwidth. Halve the bytes, halve the time.
70B model, 3 TB/s memory bandwidth, single GPU:
FP32 280 GB → doesn't fit; needs 4 GPUs
BF16 140 GB → needs 2 GPUs; 47 ms/token if it fit on one
FP8 70 GB → fits one 80 GB GPU (barely); 23 ms/token
INT4 35 GB → fits comfortably; 12 ms/token
→ Quantization changes how many GPUs you need, how fast you
decode, and how much KV cache fits. Three wins from one knob.That third win is easy to miss. Smaller weights leave more memory for KV cache, which raises concurrency, which raises the batch size, which raises arithmetic intensity, which raises throughput. The effects compound.
#The formats
FP32 [S][ 8 exponent ][ 23 mantissa ] 4 bytes
FP16 [S][5 exp][ 10 mantissa ] 2 bytes
BF16 [S][ 8 exponent ][7 mant] 2 bytes
FP8-E4M3 [S][4ex][3m] 1 byte
FP8-E5M2 [S][ 5ex ][2] 1 byte
INT8 [ 8-bit integer ] 1 byte
INT4 [ 4-bit ] 0.5 byteA floating-point number is stored in three parts: a sign (S), an exponent that sets how big or small the number can be (its range), and a mantissa that holds the significant digits (its precision). More exponent bits reach bigger and tinier numbers; more mantissa bits make the steps between representable values finer. Integer formats (INT8, INT4) have neither — they store whole numbers, plus a separate scale factor that maps them back to real values (e.g. stored 7 × scale 0.02 = 0.14).
| Format | Bytes | Range | Precision | Where used |
|---|---|---|---|---|
| FP32 | 4 | Huge | High | Legacy; optimizer states |
| BF16 | 2 | Same as FP32 | Low (7-bit mantissa) | Default for training |
| FP16 | 2 | Narrow | Better than BF16 | Older training; overflow-prone |
| FP8 (E4M3) | 1 | Moderate | Coarse | Modern inference; some training |
| INT8 | 1 | Fixed-point, needs scale | Coarse | Mature inference quantization |
| INT4 | 0.5 | Very coarse, needs group scales | Very coarse | Memory-constrained inference |
#What actually gets quantized
Three separate things, with different sensitivities:
Weight-only quantization is the common starting point: store weights at INT4, convert them back to BF16 on the fly inside the GPU code (the kernel) that does the multiply, and compute in BF16. You get the full memory and bandwidth win — which is what decode is limited by — without needing low-precision arithmetic to be accurate. For decode this is nearly ideal.
Weight-and-activation quantization also quantizes the activations — the intermediate values computed as each input flows through the network, which are different for every request. Then the matrix multiplies themselves run at low precision, which speeds up compute-bound work too, i.e. prefill and training. Harder, because activations have outliers.
#The outlier problem
Quantizing means mapping a range of floats onto a small set of levels. If one value in a tensor is 100× larger than the rest, the scale must accommodate it, and everything else collapses into a few levels.
Typical activation values: [-2.1, 0.4, 1.8, -0.9, 143.0, 0.2, ...]
↑ outlier
INT8 scale must cover ±143 → step size ≈ 1.1
→ the values near ±1 quantize to 0, ±1, or ±2
→ almost all information destroyedTransformer activations reliably develop these outliers. A small number of dimensions (positions in the activation vector, called channels) carry very large values, and it's the same few channels on almost every token. This is why naive INT8 activation quantization badly damages large models while working fine on small ones.
Three families of fix:
- Mixed precision (LLM.int8()). Detect outlier dimensions and keep them in FP16; quantize the rest to INT8. Accurate, but slow, because the GPU must run two kinds of multiply and stitch the results together.
- Smoothing (SmoothQuant). Move the difficulty from activations to weights by scaling channels: divide the activation channel by s and multiply the matching weight column by s. The product is unchanged — (x ÷ s) × (w × s) = x × w — but the activation's outlier shrinks, and weights are much easier to quantize.
- Rotation (QuaRot, SpinQuant). Multiply by a rotation matrix before quantizing. It smears one huge value across many dimensions as moderate values, and the weights are rotated the opposite way so the result is unchanged. Removes outliers rather than working around them.
#Calibration-based methods
For aggressive weight quantization (INT4 and below), the good methods use a small calibration dataset — a few hundred samples — to decide how to round.
| Method | Idea |
|---|---|
| Round-to-nearest | The naive baseline. Fine at INT8, poor at INT4 |
| GPTQ | Quantize column by column, adjusting remaining weights to compensate for the error just introduced |
| AWQ | Identify the ~1% of weight channels that matter most (by activation magnitude) and protect them with per-channel scaling |
| QAT | Fine-tune with quantization simulated in the forward pass, so the model learns weights that survive it |
Group-wise scales are the other essential ingredient: instead of one scale per tensor, use one per group of 64 or 128 weights. The scale metadata costs a few percent of the memory saved and dramatically improves accuracy, because an outlier now only stretches the scale for its own group of 128 weights, not for the whole tensor.
#FP4 and microscaling: group scales in hardware
The newest accelerators (NVIDIA Blackwell, 2025) build the group-scale idea into the tensor cores (the GPU's dedicated matrix-multiply units). Block-scaled FP4 stores each number in 4 bits — E2M1, meaning 2 exponent bits and 1 mantissa bit, only 16 possible values — and shares one scale across a small block:
MXFP4 (OCP standard) 32 values per block
scale = a power of two (8 bits)
NVFP4 (NVIDIA) 16 values per block
scale = FP8 (E4M3), plus one FP32 scale
per tensor
NVFP4 cost: (16 × 4 + 8) / 16 = 4.5 bits per valueSmaller blocks and a finer-grained scale make NVFP4 noticeably more accurate than MXFP4 at almost the same size. Because the hardware multiplies in FP4 directly, it speeds up compute-bound prefill as well — not only memory-bound decode, which is all that weight-only INT4 helps. Open-weight models now ship this way: OpenAI's gpt-oss (2025) stores its expert weights in MXFP4, which lets a ~120B-parameter model fit on one 80 GB GPU. Treat FP4 like INT4 for quality: measure on your task, and keep sensitive layers at higher precision.
#Quality: what you actually lose
Rough guidance, with the strong caveat that it varies by model and task:
| Precision | Typical quality impact |
|---|---|
| BF16 | Reference; indistinguishable from FP32 |
| FP8 | Very small; commonly deployed with no measurable regression |
| INT8 (with SmoothQuant or similar) | Small |
| INT4 (GPTQ/AWQ, group 128) | Noticeable on hard reasoning; often fine for chat |
| INT3 and below | Substantial degradation |
#Deployment shape
A reasonable default for a serving deployment today:
- Weights at FP8 — near-zero quality cost, halves memory and decode latency versus BF16, hardware-supported on current accelerators.
- KV cache at FP8 — roughly doubles concurrency; tends to matter more than the weight saving once you're serving many users.
- Compute at FP8 for prefill where the hardware supports it, while keeping the running sums of each multiply (the accumulation) in BF16 so rounding errors don't pile up.
- INT4 or FP4 weights (NVFP4 where the hardware supports it) when you are memory-constrained and have measured that your task tolerates it.
- Keep sensitive layers higher precision — the embedding, the unembedding, and often the first and last transformer blocks. They're a small fraction of parameters and disproportionately sensitive.
#Check yourself
What three wins does quantization give?Show answer
Why did BF16 beat FP16 for training?Show answer
What gets quantized, and which is hardest?Show answer
What is the outlier problem, and its three fixes?Show answer
What do GPTQ, AWQ and group scales do?Show answer
What are MXFP4 and NVFP4?Show answer
Why is perplexity a poor quantization check?Show answer
What is a sensible default serving configuration?Show answer
#What to carry forward
- Halving bits nearly halves decode latency, because decode is bandwidth-bound. Memory, latency, and concurrency all improve together.
- BF16 beat FP16 on range, not precision — networks need range far more.
- Weights quantize easily; activations have outliers. Smoothing or rotation is how you handle them.
- Group-wise scales are what make INT4 viable; the real cost is ~4.25 bits/weight, not 4.
- Perplexity hides quantization damage. Evaluate on your task.
- Largest model that fits after quantization beats smaller model at full precision.