3.2 How networks learn (weights and feedback)
How networks learn (weights and feedback)
A fresh network has random weights and produces nonsense. Learning is the process of correcting those weights using feedback from its mistakes. The mechanism has a few moving parts that are worth understanding in plain language.
The forward pass
First, the network makes a guess. Data flows in at the input, through the layers, and out as a prediction. This is the forward pass. With random weights, the prediction is wrong.
Measuring the error
We compare the prediction to the correct answer and compute the loss — a single number measuring how wrong the network was. The entire goal of learning is to make this number small, across all the training examples.
Backpropagation and gradient descent
Now the clever part. The network needs to know which weights to change, and in which direction, to reduce the loss. Backpropagation answers this: it works backward from the error through the layers, computing how much each weight contributed to the mistake. Then gradient descent nudges every weight a small step in the direction that reduces the loss. Repeat this — guess, measure, adjust — over millions of examples, and the weights gradually settle into values that produce good predictions.
The hill-descent picture
The standard intuition: imagine the loss as a landscape of hills and valleys, where height is error and your position is the current setting of all the weights. Gradient descent is like walking downhill in small steps, always heading in the steepest downward direction, trying to reach a low valley of small error. The learning rate is your step size — too big and you overshoot the valley, too small and you crawl forever.
A worked example
Picture tuning a sound system with thousands of knobs to match a target song, blindfolded. You play it (forward pass), hear how far off it is (loss), and someone tells you which way to turn each knob to get closer (backpropagation), and you turn each a little (gradient descent). After enough rounds the sound matches. Training a neural network is that, automated, with billions of knobs and no human turning them.
