Skip to main content
How LLM serving worksLesson 5 of 9

Making a Model Smaller (Quantization)

Quantization stores a model's numbers in fewer bits, for example 8 or 4 bits instead of 16. The model then needs fewer accelerators, leaves more memory for the KV cache, and writes tokens faster. In return, it gives up a little accuracy, and you have to measure how much.

Weight size140 GB
Accelerators2+ (does not fit 1)
KV cache room—
Decode speedBaseline
AccuracyBaseline
One accelerator · 80 GBBF16 checkpoint70B · 140 GBQuantizerCalibration dataQuantized ckptAWQ · GPTQ · FP8Inference enginee.g. vLLMWeightsFixed sizeKV cacheWhat is leftTensor coresFP8 · INT8 · FP4Your eval setSame promptsLoad 140 GB
RequestResponse / reportAppears in a later step

What you will learn

  • Weight memory is parameters times bytes per parameter
  • How a scale factor maps weights to fewer bits, and why outliers hurt
  • Weight-only INT4 versus FP8 weights and activations
  • Why freed memory and fewer bytes per token mean more users and faster tokens
  • KV cache precision is a separate knob, and accuracy must be measured

Precision and weight size​

Sizes are for the weights of a 70B model only. KV cache and working memory come on top.

PrecisionBytes per parameter70B weightsNotes
FP324~280 GBUsed in training, not for serving
BF16 / FP162~140 GBThe usual baseline checkpoint
FP8 (W8A8)1~70 GBFP8 tensor cores on Hopper, Ada, Blackwell. Usually close to baseline accuracy
INT8 (W8A8 or W8A16)1~70 GBINT8 tensor cores also on Ampere. W8A8 needs care with activation outliers (e.g. SmoothQuant)
INT4 (W4A16: AWQ, GPTQ)0.5 + scales~35–40 GBBiggest memory saving and faster decode. Math stays 16-bit. More accuracy risk
FP4 (e.g. NVFP4, MXFP4)0.5 + scales~35–40 GBFP4 tensor cores on Blackwell

Running it on Kubernetes​

  • Quantize once, offline, and store the result as its own checkpoint in your model registry or as an OCI artifact. Loading it is then the same as loading any model, and a smaller checkpoint also downloads faster on cold start.
  • A pre-quantized checkpoint usually describes itself (in vLLM, the quantization_config in config.json), so the engine picks the right kernels without a flag. Pass --quantization only to force a method or to quantize at load time.
  • Put the format in the Deployment's node selection. An FP8 model on a node with no FP8 tensor cores still runs, but without the speedup you planned for.
  • Watch the same engine metrics as before: KV cache usage, waiting requests, TTFT and TPOT. If quantization worked, KV cache usage drops at the same load, or each replica handles more requests.

Try it yourself​

vllm serve Qwen/Qwen2.5-7B-Instruct-AWQ # Pre-quantized 4-bit checkpoint; method read from config.json
vllm serve <model> --quantization fp8_per_tensor # Quantize BF16 weights to FP8 at load time (older vLLM: fp8)
vllm serve <model> --kv-cache-dtype fp8 # KV cache in FP8, separate from weight precision
nvidia-smi --query-gpu=name,memory.used,memory.total --format=csv # Example: NVIDIA. GPU model and memory
curl -s http://<engine>:8000/metrics | grep -E 'vllm:(kv_cache_usage_perc|num_requests_running)' # KV room at the same load

Check yourself

  1. Roughly how much memory do the weights of a 70B model take in 4-bit, compared with BF16?
  2. You deploy an FP8 model on a GPU without FP8 tensor cores. What happens?
  3. A 4-bit model scores well on general benchmarks. What should you do before putting it in production?

Further reading: vLLM quantization · AWQ paper · GPTQ paper · SmoothQuant paper · FP8 formats for deep learning · How the KV Cache Fills Up · Reading the Question, Writing the Answer (Prefill and Decode) · Until a Model First Starts (Cold Start)