Skip to content

See exactly how LLMs work

From text to tensors to understanding. An interactive guide to the calculations, code, training, and inference behind large language models.
21chapters, about 14 hours
10hands-on labs
3real-model teardowns
118papers, each linked

A small transformer runs in your browser, and every value it computes is on the screen. Nothing is animated for effect: if a number appears, you can see where it came from.

The browser engine is checked against an independent NumPy implementation to within 1e-9, and the hand-written backpropagation is checked against finite differences. The model is deliberately tiny and says so wherever it differs from production systems.

Each chapter opens with a box saying who can skip it, works through numbers before stating general rules, includes widgets you can poke, and ends with the research behind it.

01

Foundations

Functions, gradients, networks, probability and tokens. Everything later is built from these.

  1. 1.Functions, parameters and gradient descent30 min
  2. 2.Neural networks and the multilayer perceptron35 min
  3. 3.Backpropagation and optimizers40 min
  4. 4.Probability, softmax and next-token prediction30 min
  5. 5.Tokens and embeddings30 min
02

The transformer

Attention, the block, position, and the complete model.

  1. 6.Attention45 min
  2. 7.The transformer block40 min
  3. 8.Position and rotary embeddings40 min
  4. 9.The full model and its training loop35 min
03

Fast attention and inference

Why generation is memory-bound, and the designs that cut the cost.

  1. 10.Generating text: the KV cache and inference cost35 min
  2. 11.Grouped-query and latent attention35 min
  3. 12.FlashAttention30 min
  4. 13.Local, sparse and linear attention; state-space models45 min
04

Scaling the network

Experts and low-precision numbers.

  1. 14.Mixture of experts40 min
  2. 15.Floating point and quantization40 min
05

Training

Pretraining at scale, post-training and adaptation.

  1. 16.Pretraining at scale40 min
  2. 17.Post-training: instruction tuning, preferences and reinforcement learning50 min
  3. 18.Adapting models: LoRA, QLoRA and distillation25 min
06

Systems

Prompting, retrieval, tools and agents.

  1. 19.Prompting, retrieval, tools, agents and MCP40 min
07

Security and evaluation

The attacks and defenses, tied back to the papers, and how to measure any of it honestly.

  1. 20.Attacks on language models and their defenses60 min
  2. 21.Evaluating models and systems45 min

Every paper links to arXiv, and every id and title was checked against the arXiv API. Statements about specific models come from their technical reports or model cards, and anything that could not be confirmed is marked. Reading progress stays private to this browser.