← All animations

🧠 How a Neural Network Learns

A neural network is just numbers flowing through weighted connections. It learns by guessing, measuring how wrong it is, and nudging every weight in the direction that makes the error a little smaller — over and over. Scroll through the three animations to see the forward pass, gradient descent, and the two working together to fit real data.

1. The forward pass — information flows through the layers

Inputs enter on the left and ripple rightward. Each connection has a weight: thickness shows its strength, color shows its sign (blue + / pink −). A neuron adds up its weighted inputs and lights up by how active it becomes. Hit New inputs to feed the network a fresh signal.

Pulse propagating…

2. Gradient descent — learning is rolling downhill

"Wrongness" is a loss. Plot it against a weight and you get a valley; the goal is the bottom. Each step moves opposite the slope (the gradient), scaled by the learning rate. Too small and it crawls; too large and it overshoots, oscillates, or flies off entirely. Press Train and watch.

Idle

3. Putting it together — a model learns to fit the data

Here a model (slope + intercept) starts off wrong and trains by gradient descent on the squared error to the scattered points. Watch the line swing into place as the loss curve plummets — that downhill march is exactly what "training" means.

Epoch 0 · loss —