VFlash: Fast, Accurate Visual Planning via Flash Primitive Decoding
u_Unrolled
D12: Inference Serving & vLLM · Quantization — Fewer Bits per Number, Measured Honestly

Quantization — Fewer Bits per Number, Measured Honestly

30 min read·Staff+ Tier· Unrolled Pro
Quantization — Fewer Bits per Number, Measured Honestly

You already know: decode is memory-bandwidth bound, so bytes per token decide speed (Inference fundamentals); KV cache size per token (KV cache engineering); how floating point represents numbers (D1 C++ & memory, D2 Linear algebra); QLoRA's 4-bit base model (D6 Parameter-efficient fine-tuning); KL divergence (D2 Information theory).

Why this matters for Atlas. Quantization stores weights (and sometimes activations and the KV cache) in fewer bits: 8, 4, even fewer, instead of 16. Since decode reads every weight for every token, halving the bytes nearly halves the time per token, and the model fits on fewer GPUs. The cost is rounding error, which is usually tiny, occasionally catastrophic, and always task-dependent. This lesson builds the number formats and quantizers in NumPy, shows exactly where error comes from (outliers), explains GPTQ, AWQ and SmoothQuant by the problem each solves, and ends with how to evaluate a quantized model before shipping it.


1. Number formats: range versus precision

The question. What do BF16, FP8 and INT4 actually give up?

Start from nothing. A number format spends its bits on range (how large and small it can go: exponent bits) and precision (how finely it divides each range: mantissa bits). Integer formats have no exponent: evenly spaced values, with a separate scale stored alongside.

That's the preview. The full lesson, with its code and exercises, is part of Unrolled Pro.
Staff AI & Pro Tier Lesson

Unlock "Quantization — Fewer Bits per Number, Measured Honestly"

The foundations are free forever. Unrolled Pro unlocks the complete lesson, production architectures, and 55 battle-tested ML system design case studies.

Everything included with Pro:
All 234+ Deep-Dive Lessons across transformer internals, inference, RAG & agents
55 Staff-Level ML & System Design Case Studies with mathematical capacity estimates
AI Engineer Sheet & Exercises with worked solutions, self-checks, and code
100 Landmark Research Papers guided walkthroughs & progress tracking
14-Day Money-Back Guarantee — 100% full refund if you aren't satisfied
View Plans & Unlock All Lessons

From ₹167/mo (~$2/mo) · Cancel anytime · Instant activation

100% Risk-Free: 14-day no-questions-asked money-back guarantee
Build Atlas · Part 9 of 9: Serve it fastUse this lesson in the project: Add a KV cache to TinyGPT, measure what batching buys, simulate static against continuous batching on real traffic, and turn throughput into a cost per token.