What this is
- A path, not a survey. Each chapter builds on the one before. It starts with a single neuron and a few dots, and it ends with a GPT of 4 blocks that writes children's stories and can carry on an invented name it never saw in training. Chapter 5′ is a side branch into sound.
- Live, in your browser. The networks train and run in the page's own JavaScript, on your CPU. There is no server, no GPU and no machine-learning library. When a network takes too long to train while you watch, the page loads weights trained in advance with its own code, and says so.
- Nothing hidden. Click a neuron, a weight or a token to see its numbers. Gradients are checked against a second calculation, often the slow way: nudge a weight and measure. A Words · Math · Code switch in every chapter explains each step in all three.
- Honest numbers. Every number a page states is measured, most of them while you read. Near its end, each chapter has a section called "What runs where", which says what is live and what was computed in advance. Weak results are reported as they are. For example, overall, chapter 6's network does only about as well as counting what followed the last few tokens, and the page says so.
It is written for beginners: you need no calculus and no machine learning, only patience with a few numbers. If you already work in the field, the experiments in chapters 5 to 8 and the training write-ups hold the details, such as switching heads off, the logit lens, and when an induction head appears during training.
What this isn't
- Not a course in a library. There is no PyTorch or TensorFlow here, apart from one PyTorch example in chapter 3 to compare against. Every part is built by hand, so you see what a library does for you.
- Not a real language model. The networks are small on purpose, sized so that each mechanism shows. Chapter 8's GPT has 461,136 weights and has read only short children's stories. The smallest GPT-2, from 2019, has about 124 million.
- Not the whole field. This is one road to a GPT, with one branch into sound. Recurrent networks, image generation, reinforcement learning, fine-tuning and training chatbots are left out.
- Not a math textbook. Each idea comes first as a picture you can move, then in words. Formulas and code are a switch away, for those who want them.
- Not a product. It is a non-commercial working prototype, made in October 2026, with no ads and no sign-up. You may share and adapt it: the code is under MIT, and the text and figures are under CC BY 4.0.
The chapters
Each chapter adds a part. Chapter 8 puts them together: weights, a loss, gradients by backprop, layers, embeddings, attention, and blocks stacked with residual connections and layer norms make a GPT.
-
1
A network you can touch
A network with 4 hidden neurons learns to tell blue dots from orange ones, where no single straight line can. A film follows one dot through the forward pass, the loss, the backward pass and the update. Then you train it yourself and drag any weight by hand.
New part: neurons and weightsa training step -
2
Loss and gradients: walking downhill
Why a network trains on a loss instead of counting its mistakes, and what a gradient is. A neuron with two weights turns its loss into a landscape you can see, and gradient descent into a ball rolling downhill.
New part: the lossgradient descent -
3
Backprop, one operation at a time
What happens inside the Backward click. Local slopes, the chain rule and a tape build up the algorithm, and a playground steps through it one operation per click, checking every gradient by nudging.
New part: backpropagation -
4
Going deeper: why layers help
Two narrow hidden layers learn some shapes far faster than one wide layer with more weights. Each layer gives every dot new coordinates for the next. The chapter also measures the price of depth: gradients that fade on their way down.
New part: layers
-
5
Seeing: convolutional networks
A small network reads handwritten digits by sliding a few stencils over every part of the image. Its stencils turn into stroke detectors that nobody designed. Gradient ascent shows what it thinks a 3 looks like, and a faint haze of pixels fools it.
New part: convolution -
5′
Listening: spectrograms and soundBranch
Turn a sound into a picture, and chapter 5's network, with the same code, recognizes spoken digits. It shows where the network listens, and why shifting a word in time barely matters to it while shifting it in pitch does. Then it pulls one sound out of a mix by painting a mask. The playground listens to your microphone, and the sound never leaves your browser.
New part: spectrograms
-
6
Words as vectors: tokens and embeddings
Text is cut into tokens, each token gets a row of 32 numbers, and a small network guesses the next token from the last 8. Over training, words that are used alike gather together. Directions between the rows can carry meaning, but every word gets only one row, whatever it means in its sentence.
New part: tokensembeddingsAdam -
7
Attention: looking back over the whole story
Attention lets every position look back over the story and choose what to read. A step-by-step animation shows queries, keys and values on numbers small enough to follow. One layer of it remembers who a story is about. Where the hero's name comes back after more than 8 tokens, it guesses the name 45.3% of the time, against 2.6% for chapter 6's network.
New part: attentionheads -
8
A tiny GPT, trained in your browser
Four transformer blocks, built by hand. A previous-token head in block 1 and an induction head in block 2 work together to carry on invented names whose pieces never came in that order in training. At later mentions of such a name, its first guess is the right next piece 61.4% of the time, against 0.0% for chapter 7's one-layer network. You can train your own GPT from scratch.
New part: residual connectionslayer normthe stack
How a chapter goes
Most chapters follow the same order, and each page has a link to skip straight to its playground.
- The problemWhat the idea is for in the world, and why it is hard. Chapters 5 to 8 open with it.
- The questionOne puzzle that the chapter answers.
- The toolsThe parts, one at a time, each with a figure you can move.
- The secretsExperiments on the trained network that show what it learned. They start in chapter 5.
- The playgroundTrain your own network, and poke at every number.
Run it, check it
Every page is plain HTML and JavaScript. To run the site on your own machine, get the source on GitHub and serve its folder. The pages read some of their own code to display it, and browsers block that for files opened straight from disk.
python3 -m http.server 8000 # then visit http://localhost:8000
The scripts that built every chapter's data and trained its networks are in tools/. For chapters 6, 7 and 8, write-ups explain how each network was trained, measured and checked: chapter 6, chapter 7 and chapter 8.
Working prototype, October 2026. The figure at the top of this page is a live computation.
Source on GitHub · code under MIT, text and figures under CC BY 4.0. The chapters also use the MNIST digits (Yann LeCun and Corinna Cortes, CC BY-SA 3.0), the Speech Commands recordings (Pete Warden, Google, CC BY 4.0) and the TinyStories stories (Ronen Eldan and Yuanzhi Li, Microsoft Research, CDLA-Sharing-1.0).