How a large language model actually generates text, and every mechanism a serving engine is built from: tokenisation, prefill and decode, the KV cache and its arithmetic, MQA, GQA and MLA, context length, batching from static to continuous, chunked prefill, PagedAttention, prefix caching, speculative decoding, sampling, streaming and capacity maths.
Lessons#
| # | Lesson | Time |
|---|---|---|
| 12.a | Transformer Inference Overview | 60 min |
| 12.b | Tokenization and Its Consequences | 60 min |
| 12.c | Prefill vs Decode | 120 min |
| 12.d | Autoregressive Generation | 60 min |
| 12.e | The KV Cache | 120 min |
| 12.f | KV Cache Math | 90 min |
| 12.g | MQA, GQA, and MLA | 75 min |
| 12.h | Context Length and How It Scales | 75 min |
| 12.i | Batching: Static and Dynamic | 75 min |
| 12.j | Continuous Batching | 120 min |
| 12.k | Chunked Prefill | 60 min |
| 12.l | PagedAttention | 120 min |
| 12.m | Prefix and Prompt Caching | 90 min |
| 12.n | Speculative Decoding | 90 min |
| 12.o | Sampling and Decoding Strategies | 75 min |
| 12.p | Streaming Inference | 60 min |
| 12.q | Capacity Math: Worked Examples | 120 min |
Previous: Models as Computation · Next: Optimization