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
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.
| Precision | Bytes per parameter | 70B weights | Notes |
|---|---|---|---|
| FP32 | 4 | ~280 GB | Used in training, not for serving |
| BF16 / FP16 | 2 | ~140 GB | The usual baseline checkpoint |
| FP8 (W8A8) | 1 | ~70 GB | FP8 tensor cores on Hopper, Ada, Blackwell. Usually close to baseline accuracy |
| INT8 (W8A8 or W8A16) | 1 | ~70 GB | INT8 tensor cores also on Ampere. W8A8 needs care with activation outliers (e.g. SmoothQuant) |
| INT4 (W4A16: AWQ, GPTQ) | 0.5 + scales | ~35–40 GB | Biggest memory saving and faster decode. Math stays 16-bit. More accuracy risk |
| FP4 (e.g. NVFP4, MXFP4) | 0.5 + scales | ~35–40 GB | FP4 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_configinconfig.json), so the engine picks the right kernels without a flag. Pass--quantizationonly 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
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)