Skip to content

Quantization

Also called: model quantization, quantisation, quantized model, quantized models, LLM quantization

Published:

What does quantization save?

Models are usually loaded in bf16, which takes 2 bytes per parameter [1]. Quantization stores the same numbers in a narrower format such as 8 or 4 bits. Hugging Face gives a concrete case: the weights of an 8-billion-parameter model take about 16 GB in bf16, about 8 GB at 8 bits and roughly 4 to 5 GB at 4 bits [1].

The price is accuracy. Fewer bits cost some accuracy, and each quantization method strikes its own balance between memory, speed and accuracy [1].

How is it applied to large models?

LLM.int8(), published by Dettmers and colleagues in 2022, uses 8-bit integer matrix multiplication in a transformer's feed-forward and attention projection layers [2]. It halves the memory needed for inference and converts a 175-billion-parameter checkpoint to 8 bits without measurable loss in performance [2]. The tricky part is the outlier features that appear in large models. The method isolates those dimensions and computes them in 16 bits, while more than 99.9% of values are still multiplied in 8 bits [2].

How do you use it in practice?

There are two routes. You can quantize a full-precision model as it loads by passing a quantization config, or load a checkpoint that was quantized beforehand [1]. As of November 2026, the Hugging Face Transformers library supports more than 20 quantization methods through the same loading code [1]. Most need no calibration data, though GPTQ calibrates on a dataset while the model loads [1].

Frequently asked questions

Does quantization make a model worse?

It costs some accuracy; how much depends on the method and the bit width. 8-bit usually loses less than 4-bit.

Is quantization the same as distillation?

No. Quantization stores the same model in fewer bits; distillation trains a new, smaller model to imitate a larger one.

Sources

  1. Quantization overview — Hugging Face Transformers
  2. LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale — arXiv