Guide

Quantizing well

Rounding weights well takes some care, and there are a few well-known ways to do it.

Scales and calibration

A scale is the size of one rounding step, fitted to the numbers being rounded. Often each small group of weights, like 128, gets its own scale. Smaller groups fit better but store more scales. A calibration set is a small set of sample texts run through the model. It shows which numbers are typical and which matter, so the method can pick good scales. Use sample text that looks like your real traffic.

GPTQ and AWQ

Both are common 4-bit weight-only methods. GPTQ rounds a few weights at a time and nudges the rest to make up for the error. AWQ (activation-aware) finds the small share of weights, around 1% or less, that meet large activations, and protects them before rounding.

SmoothQuant

A few activation values are huge outliers, and they ruin an 8-bit scale. SmoothQuant divides those activations by a factor and multiplies the matching weights by the same factor. The math gives the same result, but both now fit 8-bit, so the math can run in INT8.

KV cache quantization

The KV cache can be stored in fewer bits too, like FP8 instead of BF16. That halves the cache, so the same memory holds twice the tokens: more users or longer chats. Check quality, especially on long inputs.

Evaluating a quantized model

Run the baseline (the unquantized model) and the quantized one on your real tasks, and compare. Record the method, bits, group size, what was quantized, and the calibration set. "INT4" alone is not a full description.

Remember

  • Scales are picked per group, guided by calibration text.
  • GPTQ fixes errors as it goes; AWQ protects key weights.
  • SmoothQuant moves outliers into the weights for 8-bit.
  • An FP8 KV cache holds twice the tokens.
  • Always test against the baseline on your own tasks.