Walk me through post-training quantization for LLM serving: INT8, INT4 (AWQ/GPTQ), and FP8 trade-offs
Written by the mlprep team · Updated
You're asked to cut GPU serving costs by 2× on an LLM deployment using post-training quantization. Compare weight-only quantization (W4A16 like AWQ/GPTQ) vs. weight-and-activation quantization (W8A8 INT8 and FP8). When does each actually speed up inference vs. slow it down?
Two different bottlenecks, two different quantization families#
To pick the right quantization scheme, start from the hardware bottleneck:
- Decode (low-to-medium batch): Memory-bandwidth-bound. The bottleneck is loading weights from HBM. Shrinking weights from 16-bit to 4-bit cuts bytes read by 4×, directly speeding up decode even if math still runs in FP16.
- Prefill & large-batch decode: Compute-bound. Tensor Core throughput is the bottleneck. You only get faster compute if the GPU has native low-precision Tensor Cores (like FP8 or INT8 on Hopper/Ada/Blackwell) and both weights and activations are quantized.
1. Weight-only quantization: W4A16 (AWQ, GPTQ, Marlin kernels)#
- Weights are stored in 4-bit integers (with per-group FP16 scale/zero-point, typically group size 128); activations stay in FP16/BF16. During matrix multiplication, fused kernels (like Marlin) dequantize INT4 weights to FP16 on the fly in registers.
- GPTQ: Uses second-order Hessian information (approximate inverse Hessian) on a small calibration set to quantize weights sequentially while adjusting remaining weights to compensate for rounding error.
- AWQ (Activation-aware Weight Quantization): Observes that ~1% of salient weight channels correspond to large activation magnitudes. Instead of mixed-precision storage, it scales up those salient channels before INT4 quantization (and inversely scales activations), preserving accuracy with simpler, faster hardware execution.
- Best for: Small-to-medium batch decode and fitting a 70B model onto fewer GPUs (e.g., 1–2 GPUs instead of 4).
- Weakness: In compute-bound prefill or very large batches, dequantization overhead + FP16 math means W4A16 gives no compute speedup (and can even be slightly slower than FP8).
2. Weight + Activation quantization: W8A8 (INT8 SmoothQuant vs. FP8)#
- W8A8 INT8 (SmoothQuant): Activations in LLMs have massive channel-wise outliers (100× larger than typical values), which ruin uniform INT8 quantization precision. SmoothQuant migrates quantization difficulty from activations into weights via a per-channel smoothing factor. Gives ~2× compute throughput on Ampere/Hopper INT8 Tensor Cores, but requires careful calibration and can degrade on sensitive tasks.
- W8A8 FP8 (E4M3 on H100/H200/B200): Floating-point exponent bits handle dynamic range and outliers far more gracefully than INT8, achieving near-lossless quality with minimal or zero calibration while doubling Tensor Core FLOPs and halving HBM bandwidth. On Hopper+ GPUs, FP8 is the modern production default for high-throughput serving.
Scheme | Weight Size | Decode Speedup (Low B) | Prefill/High-B Speedup | Quality Risk
---------|-------------|------------------------|------------------------|-------------
FP16/BF16| 1× | Baseline | Baseline | Baseline
W8A8 FP8 | 0.5× | ~1.6–1.9× | ~1.5–1.8× (H100+) | Very low
W8A8 INT8| 0.5× | ~1.5–1.8× | ~1.4–1.7× | Low–Medium
W4A16 | 0.25× | ~2.5–3.2× | ~1.0× (no FLOP gain) | Medium
Beyond weights, what about quantizing the KV cache (e.g., FP8 KV cache)? And how do you evaluate whether quantization silently degraded model quality before shipping?
KV cache quantization (FP8 KV cache)#
At long contexts (16k–128k tokens) or large batch sizes, KV cache memory dominates HBM — not weights. Quantizing K and V tensors to FP8 (with static or per-head dynamic scaling factors) immediately doubles effective KV cache capacity and halves KV memory-bandwidth reads during attention, allowing 2× larger batches with minimal accuracy drop. Going down to INT4 KV cache is riskier and typically requires channel-wise/token-wise scaling (like KIVI) to avoid long-context recall degradation.
Evaluating quantization regressions properly#
Never rely on WikiText perplexity alone — a 0.1 perplexity shift can hide catastrophic failures on reasoning, tool calling, or long-context recall. Validate across:
- Task-specific benchmarks matching your traffic: Structured JSON/tool-call adherence, math/code exact-match, and needle-in-a-haystack long-context retrieval (especially when quantizing KV cache).
- KL divergence / logit agreement on a golden slice of real production prompts (measures distribution drift directly against the BF16 reference).
- Shadow traffic + LLM-as-a-judge / human spot-checks on tail-difficulty prompts before full rollout.
Senior/staff considerations#
- Quantization reduces required Tensor Parallelism: Moving a 70B model from BF16 (
TP=4) to FP8 (TP=2) doesn't just save 2 GPUs — it cutsAllReducecommunication overhead and doubles the number of independent replicas on an 8-GPU node. - Calibration set distribution matters: For GPTQ/AWQ/SmoothQuant, calibrating on generic English web text when you serve SQL/code or multilingual prompts can degrade production quality noticeably.
Interview red flags#
- Claiming W4A16 gives a 4× speedup on prefill (it shrinks HBM traffic, not FP16 Tensor Core FLOPs).
- Ignoring GPU generation compatibility (FP8 Tensor Cores require Hopper/Ada/Blackwell; on A100s, FP8 falls back to software dequantization and loses its compute advantage).
- Evaluating quantized models solely with perplexity instead of downstream task accuracy and long-context/tool-use tests.
Go deeper: Model compression overview covers pruning, distillation, and quantization compared.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
Choose quantization by bottleneck and hardware: W4A16 (AWQ/GPTQ) maximizes memory-bandwidth speedup for low-batch decode and shrinks GPU count, while W8A8 FP8 accelerates both prefill and decode with near-lossless accuracy on Hopper+ GPUs. Pair with FP8 KV cache when long contexts or large batches are HBM-bound, and validate with task-specific and KL-divergence evals rather than perplexity alone.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- Why are activation outliers much harder to quantize in INT8 than weight matrices, and how does SmoothQuant address this?
- On an A100 vs. an H100, how does your quantization recommendation change?
- What is the trade-off of smaller group sizes (e.g., 32 vs. 128) in W4A16 quantization?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions
How does prefix caching (RadixAttention) speed up multi-turn and agentic LLM workloads?
What is model quantization and why does it matter for deployment?
Explain PagedAttention and how vLLM eliminates KV cache memory fragmentation
How does continuous batching work and why does static batching waste GPU utilization?