Notes

8-bit Quantization

Trained weights do not need all the precision they were trained with. 8-bit quantization is the cautious way of exploiting that: half the memory of 16-bit weights, for a quality cost close enough to zero that it reads as a default rather than an optimization.

What the eight bits hold

Each weight is mapped to one of 256 integer levels, with a scale factor recorded per row or per small block so the levels cover that block's actual range. 256 levels is generous enough that most of a trained network's weights land very close to where they started, which is why int8 weights rarely change a model's answers in a way a benchmark can see.

The outlier problem

The difficulty was never the weights but the activations flowing through them. A few hidden dimensions in large models carry values an order of magnitude bigger than the rest, and a single scale stretched to cover them crushes everything else toward zero. LLM.int8() fixed this by keeping those outlier dimensions in 16-bit and running the remaining ones in int8 — the result that made 8-bit dependable above a few billion parameters.

Where it pays
  • Memory: a 13B model drops from roughly 26 GB to 13 GB, fitting a single 16 GB card.
  • Throughput: int8 matrix units on modern accelerators do the multiply natively, so unlike 4-bit this is a genuine compute saving as well as a memory one.
  • Serving cost: smaller weights leave more room for the KV cache, so more requests fit per GPU.

Hugging Face Transformers and vLLM both load int8 weights behind a single flag. The usual reason to go further down to 4 bits is a model that still will not fit.

8-bit quantization stores model weights, and sometimes activations, as 256-level integers instead of 16-bit floats, halving memory for a quality loss that is usually negligible. It is the safest precision reduction available, because int8 matrix multiplication runs natively on modern accelerators, so compute improves alongside memory. LLM.int8() made it reliable at scale by keeping a handful of outlier activation dimensions in higher precision. A 13B model becomes serveable on one 16 GB GPU.

Imagine writing down every price in a shop to the nearest rupee instead of to four decimal places. The list gets much shorter, and you can still shop perfectly well. 8-bit quantization does that to the billions of numbers inside a language model: each one is recorded a little less precisely, so the whole model takes up half the space. The answers it gives stay essentially the same. This is the gentle version of the trick — enough saving to fit a model onto a single, cheaper graphics card, with almost nothing given up in return.