Before you readYour gradient points uphill. If one downhill step crosses the bottom of the valley, does the next step necessarily bring you closer to it?
Training repeats three operations: run the forward pass, use backprop to compute the gradient of the loss, then move the parameters against that gradient. For all the weights and biases collected in θ, a gradient descent step is
θ←θ−η∇θL.
The learning rateη scales the update. The gradient changes after every step. For one weight with loss L(w)=21(w−2)2, the slope is w−2. Starting at w=0, a rate of 0.1 takes you to 0.2, a rate of 1 takes you to 2, and a rate of 2 takes you to 4. With that last rate, the next step goes back to 0: the gradient reverses sign but not size.
w=1.50L(w)=0.13
The filled dot is the current weight. Compare rates of 0.1, 1, 2 and 2.1: small steps, one step to the bottom, an oscillation, and steps that move away.
Recall
Can a gradient descent step increase the loss even when it moves against the gradient?
One update, one batch
For a large dataset, computing the exact gradient over all examples at each update is costly. Mini-batch gradient descent uses the mean loss over a small group of examples instead. Backprop gives its gradient; the optimiser uses it for one update. An epoch is one pass through the training set, usually with the examples shuffled before batching. With 1,000 examples and batches of 100, that’s ten updates in one epoch.
A network’s loss over its parameters need not have a single valley like the figure. Reaching a lower training loss isn’t a guarantee of a better model either. Measure the loss on held-out validation examples without updating on them. If training loss keeps falling while validation loss rises, the network may be overfitting.
Recall
What gets averaged before a mini-batch gradient descent update, and what makes one epoch?
Exercise
In the figure's loss L(w)=21(w−2)2, start at w=0 with η=1.5. What are the weights after the first and second updates?
Exercise
Train for two epochs on 960 examples with batches of 128. Keep the last batch even if it's smaller. How many examples are in the last batch of each epoch, and how many updates are there in total?