LLM Quantization
From the Bits Up by Hatem M.A build-it, break-it, measure-it approach — every concept built from scratch, every number measured.
17 Chapters 6 Parts 50+ Figures 100% MeasuredPart I Foundations
- 0Notation, Tools, and the Baseline
- 1The Economics of Bits the memory wall, the roofline, what shrinking actually buys
- 2The Quantization Map the affine map, symmetric vs asymmetric, rounding and clipping
- 3Granularity
Part II The Mathematics of Loss
- 4Quantization Noise the Δ²/12 law and 6.02 dB per bit, derived and verified
- 5Error Propagation why output error, not weight error, is the right objective
Part III The Outlier Problem
- 6Weights versus Activations
- 7Emergent Outliers why one bad channel destroys a whole layer
- 8Taming Outliers: LLM.int8() and SmoothQuant
Part IV The PTQ Algorithms
- 9RTN and Calibration
- 10GPTQ derived from Optimal Brain Surgeon, implemented from scratch
- 11AWQ and Rotation
Part V Representation and Kernels
- 12GGUF K-Quants, Byte by Byte the llama.cpp format reconstructed byte for byte
- 13Dequantization and Direct Block Matmul
Part VI Measuring and Breaking
- 14The Quality Cliff where low-bit quantization collapses, and exactly why
- 15KV-Cache Quantization
- 16Capstone: Quantizing a Model End to End the full size × accuracy × speed table, every number explained
