Diagramium
🧠 Narrated diagram

How a neural network learns

From a single neuron to backpropagation and epochs — the ideas behind machine learning, narrated one concept at a time.

16 steps3 min readNarrated with a studio voice
How a neural network learnsbegins at thefeeds everyscales inputs bythen adds acombine into theshifts thepasses through anrepeated acrossends in theproducesis scored by theis sent backwards bywhich runswith a step size set byrepeated over manyuntil you haveA key idea or topic — the main building block of the mapNeural networkA narrower idea branching off a conceptInput layerA narrower idea branching off a conceptOne neuronA narrower idea branching off a conceptWeightsA narrower idea branching off a conceptBiasA narrower idea branching off a conceptWeighted sumA narrower idea branching off a conceptActivation functionA narrower idea branching off a conceptHidden layersA narrower idea branching off a conceptOutput layerA narrower idea branching off a conceptThe predictionA narrower idea branching off a conceptLoss functionA narrower idea branching off a conceptBackpropagationA narrower idea branching off a conceptGradient descentA narrower idea branching off a conceptLearning rateA narrower idea branching off a conceptEpochsA concrete example of a concept — drawn as an ovalA trained model
How a neural network learns — the complete diagram. Press Present to watch it build itself.
Step 1 of 16

Neural network

A neural network is not a brain. It is a very large pile of multiplication, and millions of tiny numbers inside it get nudged over and over until the pile happens to turn photographs into the word cat. Here is how that nudging works.

Step 2 of 16

Input layer

Everything begins as numbers. A small grey image of a handwritten digit, twenty eight pixels by twenty eight pixels, becomes seven hundred and eighty four inputs, one per pixel, each a brightness somewhere between zero and one.

Step 3 of 16

One neuron

A single neuron is embarrassingly simple. It takes every incoming number, scales each one, adds the results together, and pushes the total through one small function. Everything a network can ever do is built out of that one move.

Step 4 of 16

Weights

The weights are those scales, one for every connection, and they are the part that actually gets learned. A modern image model can carry tens of millions of them, and at the start they are just small random numbers.

Step 5 of 16

Bias

The bias is one extra number added after the sum. It lets a neuron speak up even when its inputs are quiet, rather like a door that swings open with the lightest push because the hinge is already loaded.

Step 6 of 16

Weighted sum

Multiply every input by its weight, add the bias, and you have one number. A layer of a thousand neurons fed by a thousand inputs needs a million multiplications for a single pass, which is exactly why these models are trained on graphics cards.

Step 7 of 16

Activation function

Now the crucial twist. The sum runs through a rectifier, a function that throws away negatives and passes positives through unchanged. Without that little bend, stacking a hundred layers would collapse into a single straight line and learn nothing interesting.

Step 8 of 16

Hidden layers

Stack those layers and something strange emerges. The first hidden layer finds edges, the next finds corners and curves, deeper ones respond to eyes and wheels and faces. Nobody programs those features; they appear on their own.

Step 9 of 16

Output layer

The final layer holds one neuron per possible answer. For handwritten digits that is ten neurons, and a step called softmax turns their raw scores into probabilities that always add up to exactly one.

Step 10 of 16

The prediction

Now the network commits. It might report an eighty seven percent chance this digit is a seven and a nine percent chance it is a one. Early in training that confident guess is complete nonsense, and that is the point.

Step 11 of 16

Loss function

The loss function scores exactly how wrong the guess was, boiling it down to a single number. Confident and right costs almost nothing; confident and wrong costs a great deal. All of training is driving that one number down.

Step 12 of 16

Backpropagation

Backpropagation runs the network in reverse, using the chain rule from calculus to ask every single weight the same question. If I nudged you upward a little, would the loss go up or down, and by how much?

Step 13 of 16

Gradient descent

The answer is a gradient, an arrow pointing straight uphill. Every weight then takes one small step the opposite way, downhill. It is walking off a mountain in thick fog by feeling the slope under your feet, and it genuinely works.

Step 14 of 16

Learning rate

The learning rate sets how big that step is, often a value like zero point zero zero one. Too large and the model bounces straight back out of the valley; too small and training drags on for weeks instead of hours.

Step 15 of 16

Epochs

One epoch is one complete pass over the training data. Real models run for dozens of epochs across millions of examples, so a single weight can be nudged billions of times before it finally settles somewhere useful.

Step 16 of 16

A trained model

What remains at the end is just an enormous table of numbers. No rules were written and no cat was ever described. The network saw only examples and its own mistakes, and it turns out that is enough.

Watch it explain itself

Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.