Quantization
Quantization stores weights (and sometimes activations) in a narrower format than BF16/FP16: less VRAM and bandwidth, some accuracy cost. On vLLM the usual families are AWQ, GPTQ, and FP8, plus newer layouts such as compressed-tensors. That is not the same pipeline as Ollama GGUF Q4/Q8—do not expect to pass a .gguf to vllm serve as the default path.
Method enums and kernel names (Marlin, …) move between releases. This page is about choosing a family; flags come from vllm serve --help and the quantization docs.
Three formats (high level)
Roughly: 7B at 16-bit is tens of GB; 4-bit often fits an 8–12 GB card plus KV. Do not skip nvidia-smi. Accuracy hits instruction following, math, and long context first—compare against full precision on your evals.
Do you still need --quantization?
For pre-quantized checkpoints (quantize_config.json or quantization_config in config.json), vLLM often auto-detects the method. A wrong --quantization value can conflict with the checkpoint and crash.
Online quantization (convert BF16/FP16 at load, commonly to FP8) is when you set the flag explicitly. Official docs still document:
Pre-quantized AWQ / GPTQ (swap in a repo you have checked for license and existence):
--quantization / -q accepts a long list (awq, gptq, fp8, Marlin variants, bitsandbytes, …). Run --help before copying an old blog enum.
Practical advice
- Prove the stack on an unquantized tiny model (Qwen 0.5B / OPT-125M in this course).
- For a larger model, prefer a ready-made Hub repo; read the card (license, tool, group size).
- On H100 / L40S-class hardware, evaluate FP8 (throughput vs quality).
- “4-bit is always faster” is not a theorem: kernels, batch size, and KV dtype matter. Measure tokens/s.
- KV cache can have its own dtype flag (often
--kv-cache-dtype—check current docs); that is a separate VRAM lever.
When searching Hugging Face for AWQ / GPTQ, do not make gated Llama your only option; Qwen and some community OPT/GPT repos are easier to download on day one.
vs Ollama quantization
Desktop “pull a q4 and chat” → Ollama. OpenAI-compatible gateway + continuous batching → vLLM and the matching checkpoint.
Troubleshooting
Quantization mismatch on load? Drop the handwritten --quantization, or align it with quantize_config.json.
FP8 unsupported architecture? The GPU is too old; use AWQ/GPTQ or a small full-precision model.
Quality collapsed? Higher-bit checkpoint, or BF16 with a smaller --max-model-len / concurrency.
bitsandbytes / GGUF? Support varies widely by version—not the default here. Read the current quantization chapter.