Collection · 6 sites
Learning LLM Systems
How language models generate text, reuse computation and serve requests. Work through Modules 1–4 in order, each building on the one before; Module 0 and the Explorer are optional.
- AI
- LLM systems
Collection · 6 sites
How language models generate text, reuse computation and serve requests. Work through Modules 1–4 in order, each building on the one before; Module 0 and the Explorer are optional.
Module 1Interactive guide
Tokens, prefill, decode, attention, cache memory and prefix reuse through interactive diagrams.
Simplified simulations: no real model runs and no performance is measured.
Built while studying PagedAttention, the Hugging Face cache guide and vLLM prefix caching. Covers prerequisites and related mechanisms, not the entire paper.
Open module →Module 2Interactive module
Derive scaled dot-product attention, trace shapes through MHA, MQA and GQA, and calculate KV-cache memory.
Worked examples use invented toy numbers; memory counts raw KV storage only.
Built while studying Attention Is All You Need, Fast Transformer Decoding, GQA and the vLLM documentation.
Open module →Module 3GPU systems
Map work to threads and memory, derive tiled matrix traffic, then compare prefill and decode with roofline models.
Analytical models in the browser: no GPU required and no speedup measured.
Module 4Efficient attention
Derive online softmax, follow tile residency and IO, then resolve KV block tables, sharing and copy-on-write.
Computed CPU teaching models: no GPU or measured speedup.
Needs from earlier modules: 2.1 and 2.3–2.5 (attention, KV heads, cache, memory), plus 3.3 and 3.5 (tiling; prefill vs decode). Lessons 4.1–4.3 open with the Module 3 terms they use.
Module 0Optional toolkit
Notation, indices, tensor shapes and stable softmax, connected to the attention equations.
Optional checks explain mistakes without scores or gates.
OptionalVisual companion
Open a causal decoder in 3D, trace Q/K/V and head sharing, and inspect tensor shapes.
A schematic: it runs no pretrained model.