See how a language model turns text into a prediction
See how a language model turns text into a prediction.
Follow a prompt through a working model, from tokens to attention to next-word probabilities. Change the inputs, inspect the actual numbers, and understand what each step does. It all runs in your browser.
Start in the browser. Follow the equations and reproduce the measurements in Python when you want more depth.
Live computations. Downloadable weights. Reproducible code.
Inspect the evidence behind the modelExplore a specific concept.
Each experiment runs the teaching model with editable inputs and explains the computed result.
All experimentsSmall by design.
Open to inspection.
Our 4,496-parameter transformer makes its calculations visible. The experiments use the same model, weights, and engine as the Model Explorer.
The browser engine is checked against an independent NumPy implementation to within 1e-9. Hand-written backpropagation is checked against finite differences.
This model learns a tiny synthetic grammar. It does not have the capabilities of a production LLM. Each investigation explains what its evidence supports; architecture comparisons show where larger models differ.
Prefer a structured read?
Build the foundations in order, or use the chapters as a reference beside an experiment.
Start with the foundationsBrowse all 21 chapters
Foundations
Functions, gradients, networks, probability and tokens. Everything later is built from these.
The transformer
Attention, the block, position, and the complete model.
- 6Attention45 min
- 7The transformer block40 min
- 8Position and rotary embeddings40 min
- 9The full model and its training loop35 min
Fast attention and inference
Why generation is memory-bound, and the designs that cut the cost.
Scaling the network
Experts and low-precision numbers.
- 14Mixture of experts40 min
- 15Floating point and quantization40 min
Training
Pretraining at scale, post-training and adaptation.
Systems
Prompting, retrieval, tools and agents.
Security and evaluation
The attacks and defenses, tied back to the papers, and how to measure any of it honestly.
Spotted a mistake, a confusing explanation or a broken widget? Report a problem with this page