Skip to main content

Quantization

Quantization lowers the numeric precision of a model's weights and activations to cut memory and speed inference, trading some accuracy.

Quantization is a compression technique that represents a model's numbers, such as weights and activations, with fewer bits than the original format. Converting from 16- or 32-bit floating point down to 8-bit or even 4-bit integers dramatically reduces the model's memory footprint and can speed up computation.

How It Works

Quantization maps a range of high-precision values onto a smaller set of low-precision levels using a scale and sometimes an offset. Post-training quantization applies this to an already-trained model, which is fast but can lose some accuracy. Quantization-aware training simulates low precision during training so the model adapts, usually preserving accuracy better. Common targets include 8-bit and 4-bit integer formats, and specialized schemes handle outlier values that are sensitive to rounding.

Why It Matters

Large models are expensive to serve, and quantization is one of the most effective ways to fit them on smaller or cheaper hardware, reduce latency, and run models on edge devices. The trade-off is a potential drop in quality, so teams measure accuracy after quantizing and choose the precision that meets their requirements. It complements other efficiency methods such as distillation and pruning.

Related Terms

Quantization optimizes a large-language-model for cheaper inference, can follow training, and is often combined with distillation to shrink models further.