Data −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The four dots are the outputs of a logic gate; at the start exclusive or. Reds are 1, blues 0. Tap a dot to change its expected output. A single neuron could not learn exclusive or; now a network with 3 hidden neurons will try.
Random start −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
The weights were drawn at random from seed 1. The background is the network's decision: it says 1 in the red region and 0 in the blue one. The loss is 0.711, 2 of the four dots are right; the ringed dots are wrong.
One epoch −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
An epoch is four jobs: the forward pass predicts the four dots, the cross-entropy loss is computed, backpropagation finds the gradient of every weight, and the weights are updated with η = 2. This loop will run 800 times.
Training goes on −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Epoch 50: the loss is 0.677, 2 of the four dots are right. The background is redrawn as the weights change.
Training goes on −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Epoch 100: the loss is 0.566, 3 of the four dots are right. The background is redrawn as the weights change.
Training goes on −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Epoch 200: the loss is 0.132, 4 of the four dots are right. The background is redrawn as the weights change.
Training goes on −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Epoch 400: the loss is 0.022, 4 of the four dots are right. The background is redrawn as the weights change.
Training goes on −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
Epoch 800: the loss is 0.007, 4 of the four dots are right. The background is redrawn as the weights change.
Learned −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
After 800 epochs all four dots are right; the loss fell from 0.711 to 0.007. Nobody told the network the rule; it found the weights from the data itself.
Why it matters −0.50 0 0.50 1 1.50 −0.50 0 0.50 1 1.50 x₁ x₂
All of deep learning is this loop: forward, loss, backward, update. Real networks split the data into small batches and have millions of weights, but the loop stays the same.