A living introduction to language models
How do we build intelligence?
Language models from first principles.
Through mathematics, code, and experiment.
Illustrative neural signalling; connection changes are accelerated.
Drag to orbit · right-drag or two fingers to pan · scroll or pinch to zoom
The journey
From signals to language models.
The illustration begins with biological neurons, but the book studies artificial systems. We start with text and prediction, build neural networks and Transformers from their smallest parts, then follow the path through pretraining, adaptation, reinforcement learning, inference-time computation, agents, and bounded self-improvement loops.
Learning
The chapters we plan to build.
Lessons
Learn each idea through explanation, worked examples, and short exercises.
Problems
Work through a precise question with the tools at hand.
Projects
Build, measure, and investigate a larger working model.
- 01IntelligenceMake the question concrete.
- 02Text DataShape raw text into trustworthy examples.
- 03Count ModelsPredict the next token from counts.
- 04Likelihood and LossMeasure how well predictions fit.
- 05Tensor ComputationExpress small computations with tensors.
- 06Neural NetworksBuild a predictor from learned layers.
- 07DifferentiationTrace how loss changes each parameter.
- 08OptimizationUse gradients to improve the model.
- 09Learned RepresentationsTest what the network has learned.
- 10Automatic DifferentiationLet software carry the gradients.
- 11Sequence ModelsCarry information through a sequence.
- 12AttentionLet each position choose what matters.
- 13The TransformerAssemble and train a complete decoder.
- 14Modern DecodersRefine the decoder for modern practice.
- 15PretrainingScale prediction across data and compute.
- 16Model AdaptationChange a base model for a purpose.
- 17Policy GradientsLearn actions from sampled rewards.
- 18Preference ModelsTurn comparisons into a learned signal.
- 19Preference OptimizationUse preferences to update behavior.
- 20Verifiable RewardsTrain against outcomes we can check.
- 21Inference-Time ComputationSpend computation to improve an answer after training ends.
- 22AgentsConnect models to actions and consequences.
- 23Self-Improving SystemsBuild and audit bounded improvement loops.