Skip to content

What is model quantization?

Quantization represents model values with fewer bits, reducing the memory footprint but introducing a quality trade-off that must be verified case by case.

Quantization is a technique that represents model values with fewer bits by approximating the original numbers. It can apply to weights, the values learned by the model, or to activations, the intermediate values produced as the model handles a request. Lower precision can reduce memory needs and make a model usable on hardware with less memory. However, approximation can change the model's answers: the outcome depends on the model, method, and task. Conversion either happens after training or is simulated during further training, letting the model adapt. The choice therefore affects both quality and the resources used during inference, when the model produces answers. The bit count alone is not enough: teams need to test on the software and hardware planned for deployment, with requests typical of everyday work, comparing results against the original version.

See also: SLMAn SLM is a compact language model, general-purpose or specialized, best chosen by weighing task quality, resource requirements, and deployment constraints.

How it works

Post-training quantization starts with an already trained model. Some methods calibrate on representative examples to choose the range of values to represent. The PyTorch static quantization guide explains that this range stays fixed, while dynamic quantization recalculates it for each batch of requests.

Another route is quantization-aware training: rounding is simulated during training or fine-tuning, and the model is converted afterward. A separate PyTorch guide describes this process, which requires additional training work. Post-training conversion is the first step when a model already exists; quantization-aware training is an alternative if results fall short of the required quality and further training is feasible.

An enterprise example

A company wants to extract contract data on an internal server. It compares the original model with two quantized versions on confidential documents and hard cases cleared for testing. It measures errors in critical fields, response time, and actual memory use, including the KV cache, temporary memory used during generation. Quantizing only the weights does not shrink the KV cache. If the more compact version gets important fields wrong, the company rejects it even if it fits on the server.

Why it matters for decision makers

The payoff depends on the whole system, not just the weights file. In the GPTQ paper, the authors report speedups of about 3.25 and 4.5 times over FP16, a 16-bit representation, for a 175-billion-parameter model at 3 bits, using purpose-built GPU code on NVIDIA A100 and A6000 GPUs respectively. These are experimental results, not a guarantee for every deployment. The LLM.int8() paper, by contrast, reports that conversion overhead can slow models under 6.7 billion parameters compared with FP16. Before purchasing, ask the vendor whether the hardware and software support the format and how it ran its tests, and set acceptable error thresholds in advance. For in-house deployment, see also local LLM.

Frequently asked questions

It can change the model's answers, but the effect depends on the model, method, and task, and must be measured against the original version.

No. Speed also depends on the format, software, hardware, and workload, so it must be measured in the target environment.
  • SLMAn SLM is a compact language model, general-purpose or specialized, best chosen by weighing task quality, resource requirements, and deployment constraints.
  • LoRALoRA adapts a pretrained model by freezing its weights and training updates built as the product of two small tables of numbers. It must be tested on the task.
  • InferenceAI inference applies a trained model to new data to produce predictions or responses; latency and cost depend on the workload and the infrastructure behind it.
  • BitNet b1.58 (1-bit LLM)BitNet b1.58 is a language model whose ternary weights (-1, 0, 1) are trained natively at 1.58 bits per parameter, so it can run on a CPU with no dedicated GPU.
  • Local LLMA local LLM is a language model whose open weights run on hardware you control through a runtime like Ollama, so prompts and responses never leave your network.

See it in the universe

If you need the AI in production, not in a demo, that is my job.

See AI integrations

Or write to me.