How Neural Networks Learn
How neural networks learn: make a prediction, measure error with a loss, and nudge weights using gradient descent and backpropagation.
Artificial Intelligence · Lesson 3
How neural networks learn: make a prediction, measure error with a loss, and nudge weights using gradient descent and backpropagation.
A neural network starts out knowing nothing. Its internal settings, called weights, begin as random numbers, so its first guesses are no better than chance. Yet after seeing many examples the same network can label photos, transcribe speech, or flag spam. Nobody hand-writes the rule it ends up using. Understanding how that transformation happens is the difference between treating these systems as magic and treating them as machinery you can reason about.
The machinery turns out to be a simple loop repeated an enormous number of times. Once you can picture that loop, most of deep learning stops being mysterious. Training a giant language model and training a tiny digit-recognizer are the same idea at different scales.
Give the network an input and it passes those numbers through its layers of weighted connections, producing an output: a prediction. To learn, the network needs to know how wrong that prediction was. A loss is simply a score that measures the gap between the prediction and the correct answer. A big loss means a bad guess; a loss near zero means a good one. The entire goal of training is to make this score smaller.
Imagine the loss as the height of a landscape, and the network's job is to find a low valley. From wherever it currently stands, it asks a local question: which direction is downhill? Then it takes a small step that way. Repeat, and it gradually descends toward lower error. That is gradient descent — the word gradient just names the downhill direction. The step size is called the learning rate: too large and it overshoots the valley, too small and it crawls.
A network can have millions of weights, so which ones should move, and by how much? Backpropagation answers this. After measuring the loss at the output, the error is passed backward through the layers, and each weight learns how much it contributed to the mistake. Weights that pushed the answer in the wrong direction get nudged one way; weights that helped get nudged the other. Every weight receives its own small correction. Forward to predict, backward to assign blame, then nudge — that is one training step.
Show the network a photo of a cat labelled "cat." It outputs 30 percent cat. The loss is high because it should have been near 100 percent. Backpropagation traces that error back through the layers, and every weight is nudged a little to raise the cat score for pictures like this one. Show it a thousand more animals and repeat. No single step fixes much, but the tiny corrections accumulate, and the cat score for real cats climbs while it falls for dogs.
Suppose you set the learning rate far too high. Instead of easing downhill, the network takes wild leaps and the loss bounces around or explodes, never settling. Or suppose you show it the same handful of images forever: it will memorize those exact pictures and fail on anything new. Learning is not just having a loop — it is small, steady steps across enough varied examples. Get either wrong and the loop runs but nothing useful is learned.
Multi-layer networks were understood in principle for years, but a practical way to train the hidden middle layers was the sticking point. In 1986, David Rumelhart, Geoffrey Hinton, and Ronald Williams published a paper in the journal Nature, "Learning representations by back-propagating errors," that showed clearly and influentially how the backpropagation algorithm could train these deeper networks. The core idea was not brand new — related methods had appeared earlier in other fields — but this paper popularized it and demonstrated that the hidden layers could learn useful internal features on their own. It became one of the most cited results in the field and set the template for how nearly all neural networks are trained today.
Start with a network guessing badly, watch the loss reported after each step, and choose whether to raise or lower a weight to shrink the error. Try a reckless learning rate and see the loss bounce instead of settle.
Think Like a Maester: Learning here is not a flash of insight but a patient walk downhill, one small corrected step at a time.
A neural network learns by looping: it makes a prediction, a loss scores how wrong it was, backpropagation sends that error backward so each weight learns its share of the blame, and every weight nudges a little to reduce the error. Gradient descent is the image of rolling downhill toward lower loss, one careful step sized by the learning rate. Repeated over many examples, these tiny corrections turn random weights into a working model. The 1986 backpropagation paper made this practical for multi-layer networks and remains the foundation of modern deep learning.
Mark this lesson complete to track your progress.