An interactive guide to neural networks

Inside the Network

From one neuron to a tiny GPT,
with nothing hidden.

Nine chapters you can see and touch. The networks learn in front of you, and every weight, gradient and guess can be opened up. Almost every figure is computed live in your browser.

Live in your browser
step 0 of 300loss …… of 160 dots right
Chapter 1's network learns to tell blue dots from orange: 2 inputs, 4 hidden neurons, one output. It runs on the same autograd and the same starting weights as the chapter. The shading is its guess, the line is where it changes its mind, and hollow dots are the ones it still gets wrong. Open it up →

What this is

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

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.

How a network learns
  1. 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. 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. 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. 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
Seeing and hearing
  1. 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
  2. 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
Reading and writing
  1. 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
  2. 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
  3. 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.

  1. The problemWhat the idea is for in the world, and why it is hard. Chapters 5 to 8 open with it.
  2. The questionOne puzzle that the chapter answers.
  3. The toolsThe parts, one at a time, each with a figure you can move.
  4. The secretsExperiments on the trained network that show what it learned. They start in chapter 5.
  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).