The Problem: Millions of Dials, One Score
At the end of Module 1, we left the model with a loss score: a number measuring how wrong its prediction was. The question is: what do you do with that number? You need to adjust the weights to make the loss smaller. But a large model has hundreds of millions of weights. You cannot manually adjust each one. You need a systematic method for figuring out which direction to nudge each weight, and by how much.
That method is called gradient descent. And despite the mathematical-sounding name, the intuition behind it is something you understand from everyday life.
Gradient Descent: Finding the Valley in the Dark
Imagine you are dropped blindfolded onto a hilly landscape, and your goal is to find the lowest valley. You cannot see anything. What do you do? You feel the ground under your feet. If it slopes downward to your left, you step left. If it slopes downward in front of you, you step forward. You always step in the direction the ground is going down. Step by step, you work your way toward lower ground.
Gradient descent is exactly this. The "landscape" is the loss landscape from Module 1: a surface where the height at any point represents how wrong the model is with that combination of weights. The model cannot see the whole landscape. But at any given point, it can feel which direction is downhill by calculating the slope of the loss. It then takes a small step in that direction. After millions of such steps, the model has descended to a valley: a set of weights where the loss is low and the predictions are good.
You are lost in foggy mountains. Your goal: reach the lowest valley. Your only tool: you can feel the slope of the ground right where you are standing. You step downhill. Then you feel the slope again and step downhill again. You cannot see the whole mountain. You just keep stepping downhill, one small step at a time.
Gradient descent is a blindfolded hiker. The mountain is the loss landscape. Each step is one weight update. The valley is a set of weights that makes good predictions.
What "Gradient" Actually Means
The word "gradient" is just a technical term for slope. When you calculate the gradient of the loss with respect to a weight, you are asking: "if I increase this weight by a tiny amount, does the loss go up or down, and by how much?" The answer tells you which direction to nudge that weight.
If increasing a weight makes the loss go up, you should decrease it. If increasing it makes the loss go down, you should increase it more. The gradient gives you both the direction (up or down) and the steepness (a small nudge or a large one). Every weight in the model gets its own gradient, telling it exactly how to change.
Backpropagation: How the Blame Gets Shared
Here is a subtle question. The model makes a prediction, we calculate the loss at the output, and we want to update the weights. But in a deep network, there might be 50 layers between the input and the output. How does a weight deep inside the network know that its tiny contribution to the final answer was slightly off, and in which direction to change?
The answer is backpropagation. After calculating the loss at the output, the model works backwards through the network, layer by layer, passing blame back toward the input. Each layer receives information about how much its output contributed to the final mistake, and passes a portion of that blame back to the layer before it.
Think of a factory assembly line. A finished product comes out broken. You start at the end and ask: which step in the assembly line caused this? The inspector traces back: the problem was introduced at station 4, because station 3 fed it a slightly warped part, which itself came from station 2 using the wrong material. Each station learns its share of the blame. Each one adjusts its process a little. The next product comes out better.
Backpropagation is the mathematical version of this blame-tracing. It is efficient: instead of testing every weight individually to see how it affects the loss, backpropagation calculates every gradient in a single backwards pass through the network. One forward pass to get the prediction, one backward pass to get the gradients for every weight at once.
The Learning Rate: How Big a Step to Take
Once the model knows which direction to nudge each weight, it still has to decide how far to nudge it. This is the learning rate: a small number (typically something like 0.001 or 0.0001) that controls the size of each step.
Too large a learning rate and the model takes giant steps. It might step right over the valley and land on the other side of the hill, then step back over again, oscillating without ever settling. The loss bounces around instead of descending. Training fails.
Too small a learning rate and the model shuffles forward in tiny steps. It will eventually find the valley, but it will take an impractically long time to get there. Training works but is painfully slow.
The right learning rate sits in between: large enough to make meaningful progress, small enough to step carefully and not overshoot. Finding it is part science, part experience, and a major focus of modern research. Many practical systems use a learning rate schedule: start with a larger rate to make fast early progress, then gradually reduce it as training continues, like slowing down as you approach the valley.