01 · THEORY PATH
Understand how LLMs work
Build a system-level picture: data, representations, Transformer, prediction, and generation.
Start with the panoramaUnderstand language models by connecting intuition, mathematics, code, and verifiable experiments.
OBSERVE · EXPLAIN · VERIFY
Large language models (LLMs) are a family of neural models trained on large amounts of text. Many current models use an autoregressive Transformer that predicts the next token, but LLMs are not limited to one architecture or to this single objective.
LLM Lab connects these mechanisms to their mathematical explanations and observable behaviour. The goal is not to trust an intuition because a diagram looks convincing: it is to understand what a component computes, verify what can be tested, and identify what remains an assumption or limitation.
Choose between two independent primary paths: understand LLMs theoretically or build a small GPT. They share canonical concepts, but have distinct goals, progressions, and prerequisites. Neither is a required continuation of the other. The resource and concept map lets you navigate freely between them. The Understand path assumes comfort with vectors and matrices and basic probability; derivatives and the chain rule appear in the loss and gradients lessons, and the code examples use basic Python and NumPy.
01 · THEORY PATH
Build a system-level picture: data, representations, Transformer, prediction, and generation.
Start with the panorama →02 · INDEPENDENT BUILD PATH
Build and verify a small GPT in implementation-dependency order, without completing the Theory path first. Reference inference is tested; complete training remains to be implemented.
Explore the build path →03 · DEEPEN
Consult mathematical derivations, architectures, and technical references without treating them as prerequisites.
Explore deep dives →AT ANY TIME · PRACTICE
Verify through calculation and experimentChallenge explanations with exercises, implementations, and documented evaluation protocols.
Lessons use three markers to distinguish different kinds of material:
These markers describe the evidence available; they do not make all evidence equivalent. A diagram makes a structure readable but does not prove a property; a derivation establishes a result under stated assumptions; a test checks the cases it covers; an experiment compares configurations under a documented protocol, metrics and limitations.
The same predictive computation produces a conditional distribution. This distribution supports three distinct operational uses: generate a token, score an observed target, or learn by updating parameters. Evaluation is cross-cutting: it aggregates measurements on data under a defined protocol. The diagram details the generation and learning loops; scoring is distinguished immediately below. To watch a token extend the prefix and trigger the next distribution, explore the next-token loop in the overview.
Evaluation: it is not a fourth equivalent branch. It reuses scoring on held-out data among other methods and aggregates results under a protocol; it can also evaluate generated outputs.
In LLM Lab: Glossary · Exercises · Transformer history · Experimental evaluation · Annotated bibliography.
External references: 3Blue1Brown — Transformers for visual intuition; Sebastian Raschka — LLMs from Scratch for implementation detail; Jay Alammar — Illustrated Transformer and Illustrated GPT-2 for visual explanations.
For the complete programme, see the curriculum map and learning path.