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.