Book a 30-min callBook a call

LLM quantization explained: number formats, scales, outliers, GPTQ, AWQ and the KV cache

How LLM quantization works: FP8, INT8, INT4 and NF4, scales and group sizes, outliers, GPTQ, AWQ, SmoothQuant, KV-cache quantization and quality checks.

A tall bar of sixteen thin slices narrowing through an arrow into a short bar of four thicker slices, with a small scale circle attached to each group of slices.
Written by
BYD Tech
Published
Topic
Deep dives
Reading time
20 min read

Questions people ask

Does quantization make a model faster or only smaller?

Usually both, but not always. Decoding is limited by memory bandwidth, so reading 4-bit or 8-bit weights instead of 16-bit ones speeds up each step when the kernels are efficient. Weight-only formats help little in compute-bound prefill, and a format without fast kernels on your hardware can be smaller and slower. Measure tokens per second at your real batch sizes.

Is 4-bit good enough for production use?

Often, with a good method and a sensible group size: GPTQ and AWQ report small accuracy losses at 4 bits on large models. Smaller models and hard tasks such as math, code and strict structured output tend to lose more. Decide with your own task evaluations, not with perplexity or a published benchmark alone.

Should I use GPTQ or AWQ?

Both produce group-wise INT4 weights that common serving engines can run, and both need calibration data. GPTQ adjusts the remaining weights to cancel rounding error with second-order information; AWQ rescales the channels that large activations depend on and needs no backpropagation. Quantize your model both ways if you can, and pick the one that does better on your evaluations at the same group size.

Can I fine-tune a quantized model?

Yes, by training adapters rather than the quantized weights. QLoRA keeps the base model frozen in 4-bit NF4 and trains LoRA adapters in 16-bit on top of it. Evaluate the exact artifact you deploy, because merging an adapter into a re-quantized or 16-bit copy gives a result close to, not identical with, what you trained.

What is the difference between INT4 and NF4?

Both use 16 levels and a scale per block of weights. INT4 spaces its levels evenly across the scaled range, which suits fast integer kernels. NF4 places its levels at quantiles of a normal distribution, dense near zero where most weights are, which the QLoRA authors found more accurate than INT4 and FP4 in their comparison. NF4 is mostly used for frozen base weights during fine-tuning.

Building something like this?