Quantization
A compression technique that lowers the numerical precision of neural network weights and activations (e.g., FP16 → FP8/INT8/INT4) to shrink VRAM footprint and accelerate inference with minimal accuracy loss
Table of Contents
Structure Diagram
2 bytes/param · Reference quality
- Weights VRAM~140 GB (2–4× 80GB GPUs)
- BandwidthHeavy per-token memory reads
- Best ForTraining & lossless reference
0.5–1 byte/param · 2–4× smaller
- Weights VRAM~35–70 GB (fits single 80GB GPU)
- Throughput1.5–2.5× faster decode bandwidth
- QualityFP8 near-lossless; 4-bit ~98%+
What is Quantization?
A compression technique that lowers the numerical precision of neural network weights and activations (e.g., FP16 → FP8/INT8/INT4) to shrink VRAM footprint and accelerate inference with minimal accuracy loss. It is a core concept in Model Architecture within AI / ML.
Core Principles
Autoregressive LLM decoding is memory-bandwidth bound: every token requires streaming all weights from VRAM. Quantization maps 16-bit weights (and optionally activations/KV caches) to 8-bit (FP8/INT8) or 4-bit (INT4/NF4), cutting memory footprint and bandwidth traffic by 2–4×.
Approaches split into PTQ (Post-Training Quantization) like AWQ, GPTQ, and GGUF, versus QAT (Quantization-Aware Training) which adapts weights during training.
Practical Takeaways
- Match format to hardware: Use native FP8 on Hopper/Blackwell GPUs for near-lossless throughput gains, AWQ/GPTQ for 4-bit GPU serving, and GGUF (
Q4_K_M) for CPU/Apple Silicon local runs. - Evaluate small models and strict tasks carefully: 70B+ models tolerate 4-bit well, whereas sub-3B models or strict JSON/coding workloads degrade quickly below 4 bits.
- Protect salient outlier channels: Modern quantizers like AWQ preserve ~1% high-activation channels to keep perplexity nearly unchanged.
Notable Examples
- vLLM & TensorRT-LLM FP8: Cuts serving GPU count nearly in half with negligible benchmark drop.
- Ollama & llama.cpp: Runs quantized GGUF models smoothly on developer laptops.
- QLoRA: Combines 4-bit quantized base weights with 16-bit trainable adapters.