AI engineering · 26 of 42

Quantization

Fewer bits per number, same shape

Scroll

Fewer bits per number, same shape

A model's weights are numbers, and they do not all need full precision. Quantization stores them in fewer bits — eight, or four — shrinking the model without changing its shape.

The gain is not only disk. A smaller model fits cheaper hardware and leaves more room for the KV cache, which is usually what actually limits how many people you can serve.

Quality loss is small on average and not evenly distributed. It tends to show up on the hardest and rarest inputs — exactly the ones a benchmark average hides. Run your own difficult cases before and after, not just an aggregate score.

Inference
FEWER BITS PER NUMBER, SAME SHAPE 16-bit 0.4127 the weights as trained 8-bit 0.41 usually indistinguishable 4-bit 0.4 smaller, faster, and now you must measure A quarter of the memory means the model fits on cheaper hardware and leaves more room for the KV cache, which is often the real win. Quality loss is small on average and not evenly spread: check your own hard cases.
The same weight stored at sixteen, eight and four bits, losing precision and memory together.