Mixed-Precision Inference
Not every number inside a language model needs the same care. A few weights and a few activation channels carry outsized influence on the answer; the vast majority do not. Mixed-precision inference exploits that unevenness, storing and computing most of the model in a low-precision format while keeping the sensitive parts at higher precision.
How it is arrangedA served model is pulled apart by numeric format rather than by layer. A typical arrangement:
- Linear-layer weights held as 8-bit or 4-bit integers, dequantized on the fly.
- Matrix products accumulated in FP16 or BF16, so rounding errors do not compound across a long generation.
- Normalisation layers, embeddings and the output head left at 16 bits, where quantization hurts most.
- Outlier activation channels routed through a separate 16-bit path — the idea behind LLM.int8().
Serving a large model is bound by memory bandwidth more than by arithmetic: every weight must be hauled out of GPU memory for every token. Halving their size roughly halves that traffic, so tokens per second rise and a model that needed two GPUs may fit on one. On newer hardware, FP8 tensor cores make the arithmetic itself cheaper as well.
Where it goes wrongPushed too far, the damage shows up unevenly: perplexity barely moves while arithmetic, long-context recall or non-English output quietly degrades. The honest check is a task benchmark on the quantized build, not the loss number. bitsandbytes, TensorRT-LLM and llama.cpp all implement these schemes, each with its own choice of what stays precise.
Mixed-precision inference serves a model with different numeric formats in different places: most weights as 8-bit or 4-bit integers, while matrix accumulation, normalisation layers and outlier activation channels stay at 16 bits. Because serving speed is limited by how fast weights move out of GPU memory, shrinking them raises throughput and lets a large model fit on fewer devices. Keeping the sensitive parts precise is what avoids the accuracy loss that uniform low precision causes.
Think about packing for a trip. Your clothes can be squashed into any corner, but the camera lens needs its padded case. Mixed-precision inference treats an AI model the same way. The numbers inside it are stored at reduced detail wherever that is harmless, and at full detail in the few places where rounding would ruin the answer. The point is to fit the model into less memory and get replies faster, without the clumsy mistakes that come from squashing everything equally. It is a large part of why a model that once needed expensive server hardware can now answer from a single graphics card.