Memory & Efficiency
Quantization & Precision
IntermediateQuantization is usually the biggest single thing you can do to fit a large model on the hardware you have. Store each number in fewer bits and you need less memory and bandwidth, often with almost no loss in quality. This page starts with how a float is laid out in bits, then covers the methods people use and the hardware that runs low precision fast.
Fewer bits, same model
A model's weights are just billions of numbers. Store each one in 2 bytes instead of 4, and the model halves in size. Drop to 1 byte () or half a byte () and it halves again, and again. The limit is precision. With too few bits, the numbers can no longer represent what the model learned, so modern quantization cuts bits right up to that line. On Blackwell-class hardware the low-precision math also runs faster, so you gain speed as well as space.
Where the bits go in a number
Every format splits its bits into a sign, an exponent (range) and a mantissa (precision). Pick a format, then flip its bits or store a number to compare how each format holds it.
FP8 E4M3 (8-bit, more precision, 8 bits) · click a bit to flip it
+1 × 211−7 × 1.25 = 20
sign × 2exponent − bias × 1.mantissa
Decoded value 20
Exponent bits buy range
Smallest to largest positive value, log scale.
Pale = subnormals. The orange line is your number. FP32 and BF16 span the same range; FP8 E5M2 gives up a mantissa bit for about 128× more range than E4M3.
Mantissa bits buy precision
Every FP8 E4M3 value from 16 to 32, linear scale.
3 mantissa bits = 23 values per doubling. The next band up has the same count, twice as far apart.
FP8 E4M3: Weights and activations in the forward pass on Hopper/Blackwell. More mantissa, less range. Precision is relative. Each step up in exponent doubles the gap between neighboring values, so a format with few mantissa bits is fine-grained near zero and coarse near its maximum.
The format ladder
Each rung halves the bytes. is the lossless default and FP8 is the current sweet spot for serving. /INT4 go further, using per-block scaling to stay accurate.
Bytes per value, rung by rung
Each bar is drawn to scale in bytes, with a tick per bit. Tap a rung to see what it means for a 70B-parameter model.
Per value
2 B
16 bits
vs FP32
2× smaller
50% of the bytes
70B weights
140 GB
70B × 2 B
Two formats with the same byte count can still hold different numbers. FP16 and BF16 are both 2 B but split their bits differently (see the bit layout above). INT4 is an evenly spaced grid, while FP4 is a tiny float.
Size it: precision vs. what fits
Precision changes a model's footprint a lot. A 70B model needs 4 GPUs at FP32 but fits on a single H100 at INT4. Pick a model and watch the GPU count and the quality cost change.
How many GPUs does it take?
Each box is one GPU's memory (HBM). The weights pour in first, then the KV cache for the workload you pick. Fewer bytes per parameter means fewer boxes.
INT4 (~97% quality). GPTQ/AWQ 4-bit. A small quality hit for a big memory saving.
Llama 3.3-70B at INT4: 35 GB of weights + 21 GB of KV cache (8 × 8K tokens in BF16) → fits one H100. The cache is 38% of what has to fit. Shrinking the weights alone stops paying off here, so quantize the cache too.
Boxes fill in order to keep the picture simple. Real deployments shard weights and cache evenly across GPUs and need headroom for activations. Workload and quality figures are illustrative; actual degradation depends on the task and method. Below INT4, per-block scaling (NVFP4/MXFP4) becomes essential to hold quality.
What, exactly, gets quantized
There are three things you can quantize: the weights, the activations and the KV cache. You can choose each one separately, and each one relieves a different bottleneck.
Three targets in one layer
Each block's width is drawn to scale in bits; the dashed outline is its BF16 size. Pick a scheme to see which tensors shrink.
One layer, one forward step
X activations · W weights · Y output
matmul in BF16, weights dequantized on the fly
one slot per cached token; grows with every request
Weight-only
Quantize weights, keep activations in BF16. Dequantize on the fly.
Cuts the biggest memory cost with minimal quality loss.
You can use any combination of the three in one deployment. Block shapes are illustrative.
How it's done
Methods fall into two families: (fast, no retraining) and (best quality, but it costs extra training). You'll see the method names below in model cards all the time.
PTQ
minutes · no retrainingPost-Training Quantization
Trained BF16 model
frozen weights, already converged
↓
Calibrate on a few batches
measure activation ranges → pick scales
↓
Round weights to low-bit
GPTQ / AWQ / SmoothQuant
↓
Quantized model ships
small quality drop, no GPUs spent
QAT
short extra training · best qualityQuantization-Aware Training
Train with fake-quant inserted
forward pass rounds, gradients stay full-precision
↓
Model learns to tolerate rounding
weights adapt around the coarse grid
↓
Bake in the real low-bit weights
no calibration gap to recover
↓
Quantized model ships
same size and kernels as PTQ, better accuracy at 4-bit
The named recipes, mapped
Columns show when quantization happens and rows show what gets quantized. Tap a recipe (or PTQ and QAT themselves) for details.
after training · minutes
during training · a short extra phase
Weights only
4-bit GPU serving
Weights + activations
W8A8 · W4A8 · FP8
Recover a reasoning model
match the BF16 model
Fine-tune a quantized base
4-bit frozen weights (not QAT)
CPU / edge formats
block-quantized files
GPTQ / AWQ
Weight-only PTQ to 4-bit. GPTQ minimizes layer-wise error; AWQ protects the most salient weight channels. The backbone of 4-bit serving.
For the arithmetic behind these methods, see Quantization Math & QAT. It covers scales and zero points, integer matrix multiplication, clipping, learned rounding and quantization-aware training step by step.
Try it: round the weights yourself
Quantization comes down to snapping each weight onto a coarse grid. Lower the bit-width and the rounding error grows. Switch on per-block scaling and it shrinks again, which is how NVFP4 and MXFP4 work.
Round the weights and watch the error
A weight matrix is just numbers. Quantizing snaps each one onto a grid of allowed values (the faint lines). Fewer bits means a coarser grid and bigger rounding error. Per-block scaling helps by giving each block of 4 its own grid.
Levels
15
16 codes, 1 unused (symmetric)
Bytes / value
0.50
vs 2 B (BF16)
RMS error
0.0279
lower is better
Max error
0.0600
worst single weight
Per-block scaling gives each block of 4 its own range, so a block of small weights doesn't waste its levels on an outlier elsewhere (compare the tighter grid in blocks 2 and 4). Turn it off and the error jumps. NVFP4 and MXFP4 are built on this idea.
Hardware makes low precision fast
On the right silicon, smaller numbers are also cheaper to multiply. Each GPU generation adds native support for a lower format, which roughly doubles throughput. Hopper made FP8 a first-class format (~2× BF16). Blackwell adds FP4/NVFP4 (~2× FP8 again), with per-block micro-scaling to hold accuracy at 4 bits.
Each generation adds a faster, smaller format
Relative Tensor Core throughput, built from the ~2× steps described above. These aren't measured TFLOPS.
BF16
2 B / value
FP8
1 B / value
FP4
0.5 B / value
Tap Hopper to see the ladder before native FP4 arrived.
Quantization composes with everything
Lower precision shrinks weights and the KV cache, and it changes how many GPUs your parallelism plan needs. It's the cheapest lever you have, so set precision first and size the rest around it.