On this page
Quantisation is the most effective single change you can make to LLM serving cost, and also the easiest to get subtly wrong. The right format depends on your GPU, your batch sizes and how much quality you can afford to risk. This guide is for serving on data-centre GPUs; for local GGUF quants, see which quantisation should you pick.
#What quantisation actually changes
There are two kinds, and they speed up different things:
- Weight-only quantisation (for example INT4 weights with 16-bit activations, often written W4A16): weights are stored in fewer bits and converted to 16-bit inside the matmul kernel. The maths still runs at 16 bits.
- Weight-and-activation quantisation (W8A8 in FP8 or INT8, W4A4 in FP4): both inputs to the matmul are low precision, and the tensor cores run low-precision maths, which has higher peak FLOPs.
Map that onto the two phases of inference (prefill vs decode):
| Decode (bandwidth bound) | Prefill (compute bound) | |
|---|---|---|
| Weight-only INT4 | Large gain: about a quarter of the bytes per token | Little gain, sometimes a loss (dequantisation work) |
| FP8 or INT8 weights and activations | Good gain: half the bytes | Good gain: FP8 tensor cores have twice the BF16 peak |
| FP4 weights and activations | Largest gain: a quarter of the bytes | Largest gain on GPUs with FP4 tensor cores |
So weight-only 4-bit is great for latency-bound, low-batch decode. FP8 helps both phases. FP4 helps both, on hardware that supports it.
#The formats
| Format | Bits | How it works | Native tensor-core support |
|---|---|---|---|
| BF16 / FP16 | 16 | Baseline | All recent GPUs |
| FP8 (E4M3) | 8 | Floating point with per-tensor or per-channel scales | Hopper (H100, H200), Ada (L4, L40S), Blackwell, recent AMD |
| INT8 (W8A8) | 8 | Integers with scales; outlier handling such as SmoothQuant | Turing and later; widely used on Ampere |
| INT4 weight-only (AWQ, GPTQ) | 4 | Integers in groups of 64 or 128 weights, each with a scale | Dequantised in kernels; works on most GPUs |
| FP4 (NVFP4, MXFP4) | 4 | Tiny floats with a scale per small block (16 or 32 values) | Blackwell (B200, GB200 and later) |
#Inside the bits
FP8 E4M3 has 1 sign bit, 4 exponent bits and 3 mantissa bits. Its largest value is 448, and it has only 8 steps between each power of two, so values need a scale to sit in the useful range. (A sister format, E5M2, trades precision for range and is mostly used for gradients in training.)
INT4 with group scales stores each weight as a 4-bit integer and keeps one 16-bit scale (and often a zero point) per group of 128 weights. That adds about 0.125 to 0.25 bits per weight, so "4-bit" is really about 4.1 to 4.25.
FP4 (E2M1) has 1 sign bit, 2 exponent bits and 1 mantissa bit: it can represent only the values 0, 0.5, 1, 1.5, 2, 3, 4 and 6 (and their negatives). Everything rides on the block scales:
- MXFP4 (an Open Compute Project standard) gives each block of 32 values a power-of-two scale stored in 8 bits: about 4.25 bits per value.
- NVFP4 (NVIDIA's format) gives each block of 16 values an FP8 scale, plus one scale for the whole tensor: about 4.5 bits per value. The smaller blocks and finer scales generally preserve quality better.
The pattern is the same everywhere: the smaller the group, the better the quality and the more space the scales take.
■ representable ■ actual weights
Relative error
1.7%
Weights rounded to 0
0
Bits per weight
8
8-bit formats have enough values that one scale per tensor (or per channel) usually works.
128 weights from a normal distribution plus two outliers (as LLM layers have), scaled so the largest maps to the format's maximum. Dots: values the format can represent, mapped to weight units (positive side, log scale).
#Why quantisation is hard: outliers
If every value in a tensor were similar in size, quantisation would be easy. The trouble is outliers. LLM activations have a few channels with values many times larger than the rest, and weights have a small fraction that matter far more than others. A scale large enough for the outliers leaves too few steps for everything else.
The main methods each attack this differently:
- SmoothQuant (for W8A8) moves difficulty from activations to weights: it divides outlier activation channels by a factor and multiplies the matching weights by the same factor, which leaves the maths unchanged but makes both easier to quantise.
- AWQ (activation-aware weight quantisation) finds the weights that matter most, judged by the activations they meet, and scales them up before quantising so they keep more precision.
- GPTQ quantises weights one column at a time and adjusts the remaining weights to compensate for each rounding error, using second-order information from calibration data.
- Fine-grained block scales (as in NVFP4 and MXFP4) contain outliers to a small block, so one large value only affects its 16 or 32 neighbours.
All of these use a small calibration set (a few hundred samples of representative text) to measure activation ranges. Calibration data that looks like your real traffic gives better results.
#The memory maths
For a 70B model, weights alone:
| Precision | Bytes per weight | Weight memory |
|---|---|---|
| BF16 | 2 | about 140 GB |
| FP8 / INT8 | 1 | about 70 GB |
| INT4 / FP4 (with scales) | about 0.5 to 0.56 | about 35 to 40 GB |
Two consequences. You need fewer GPUs to hold the model, and every GB saved becomes KV cache space for more concurrent users (KV cache explained). The KV cache can be quantised separately, usually to FP8, which halves it.
#A worked example on H100s
How the choice changes a 70B deployment on 80 GB H100s:
| Precision | Minimum GPUs | KV room (rough) | Batch-1 decode, at 70% of bandwidth |
|---|---|---|---|
| BF16 | 2 (tensor parallel) | about 0 to 5 GB: barely usable | about 30 ms per token, plus communication |
| FP8 | 2 (tensor parallel) | about 75 GB | about 15 ms per token, plus communication |
| INT4 weight-only | 1 | about 30 GB | about 16 ms per token, no communication |
INT4 turns a two-GPU replica into a single-GPU one, which removes tensor-parallel communication and doubles the number of independent replicas per node. FP8 on two GPUs has much more KV room, so it serves more concurrent users per replica and is faster at prefill. Which is better depends on whether you're limited by latency at low batch or by throughput at high batch.
#How much faster?
For decode at small batch, speed scales roughly with bytes read per token, so 4-bit weights can approach 3 to 4 times BF16 speed, and FP8 about 2 times. In practice the gain is smaller:
- Kernel quality decides a lot. A format without a well-tuned kernel for your GPU and batch size can be slower than BF16.
- Launch overhead shows up. Smaller weights mean shorter kernels, and fixed per-kernel CPU costs become a bigger share (CUDA graphs and launch overhead).
- At large batch, weight-only 4-bit loses its edge, because the work becomes compute bound and the maths still runs at 16 bits.
Measure at the batch sizes you'll actually serve.
#Producing and serving a quantised model
Three routes, from least to most effort:
- Download a pre-quantised checkpoint. Many model authors publish official FP8 or FP4 versions, and community AWQ and GPTQ versions are common. Prefer the author's own where one exists.
- Quantise on the fly. vLLM can quantise BF16 weights to FP8 at load time with
--quantization fp8, with no calibration. It's a quick way to test, though calibrated checkpoints usually do slightly better. - Quantise yourself with calibration. Tools such as the vLLM project's LLM Compressor and NVIDIA's Model Optimizer take a model and a calibration set and write a quantised checkpoint that engines load directly.
Serving is then a matter of pointing the engine at the checkpoint (it reads the format from the model's config) and, usually, enabling an FP8 KV cache:
vllm serve your-org/Llama-3.1-70B-Instruct-FP8 --tensor-parallel-size 2 --kv-cache-dtype fp8#Quality: what to expect and how to check
Rough expectations, which you must verify for your model and task:
- FP8 (W8A8) with a good recipe is usually very close to BF16 for large models. It's the default choice for serving on Hopper-class GPUs.
- INT4 weight-only with AWQ or GPTQ and group size 128 is usually acceptable for chat, with more risk on maths, code and long reasoning.
- FP4 with fine-grained block scales is newer; quality depends heavily on the recipe, and some models ship FP4 checkpoints prepared by their authors.
- Smaller models degrade more than larger ones at the same bit width.
Validate with:
- Your own task evaluation on a few hundred real examples, not only perplexity.
- Sensitive capabilities: maths, code, tool calling, long context, non-English text.
- Side-by-side comparisons of BF16 and quantised outputs on the same prompts, scored by an evaluator you trust.
- Determinism checks for structured output: a quantised model that produces invalid JSON 1% more often may matter more than a point of benchmark accuracy.
#A decision guide
| Situation | Good first choice |
|---|---|
| Hopper or Ada GPUs, general serving | FP8 weights and activations, FP8 KV cache |
| Ampere (A100) GPUs | INT8 W8A8 for throughput, or INT4 weight-only for low-batch latency |
| Memory-limited, low batch, latency-focused | INT4 weight-only (AWQ or GPTQ) |
| Blackwell GPUs | FP4 where a good checkpoint exists, otherwise FP8 |
| AMD MI300X | FP8 (check the checkpoint's FP8 variant matches; see MI300X vs H100) |
| Quality is critical and memory isn't tight | BF16, or FP8 after careful evaluation |
#Common mistakes
- Quantising and shipping without a task evaluation.
- Expecting weight-only INT4 to speed up prefill. It mostly speeds up decode.
- Choosing a format your GPU can't run natively, so it's emulated slowly.
- Benchmarking only at batch 1 and generalising.
- Forgetting the KV cache, which can be most of memory at long context.
- Calibrating on text unlike your traffic, such as English Wikipedia for a code or multilingual model.
#FAQ
Is FP8 always better than INT8? On GPUs with FP8 tensor cores, FP8 is usually easier to get good quality from, because its floating-point spacing suits LLM value distributions. On Ampere, which lacks FP8, INT8 is the 8-bit option.
Can I mix formats? Yes, and it's common: FP8 or FP4 weights, FP8 KV cache, and sensitive layers (such as the first and last, or attention) kept at higher precision.
Does quantisation help MoE models? Very much, because experts hold most of the bytes (MoE inference explained).
#Go deeper
Quantisation in depth covers the formats and calibration methods, and low-precision serving with FP8 and FP4 covers serving them on current GPUs. The FP8 lab walks through quantising a model and validating it before shipping. The quantisation explorer shows memory for any model and format.
quantisationfp8fp4int4servinginference-engineering
Found this useful?
Send it to someone who is learning the same thing.
Preparing for an interview?
Next: learn it step by step, free
Capacity planning and cost
Turn traffic and latency targets into a GPU count and a monthly bill. A free lesson with step-through diagrams and a quiz.