Backprop Bulletin explainer
What is a loss function?
A loss function gives a prediction a numerical penalty for how far it misses the target. During training, the model’s weights are adjusted to reduce the loss. The choice of penalty determines how much each miss matters.
Two ways to score the same predictions
The target is 3. A prediction of 2 falls short by 1. A prediction of 5 goes over by 2. Absolute error measures the distance from the target in either direction. Squared error multiplies that distance by itself.
| Prediction | Absolute error | Squared error |
|---|---|---|
| 2 | 1 | 1 |
| 5 | 2 | 4 |
Doubling the size of the miss doubles the absolute-error penalty, from 1 to 2. It quadruples the squared-error penalty, from 1 to 4.
Why does the choice matter during training?
Imagine moving each prediction a little closer to 3. Absolute error falls at the same rate for both predictions. Squared error falls twice as fast at 5 as it does at 2. If a weight affects both predictions equally, the larger miss has more influence on the weight update under squared error.
Follow the prediction of 2 through the next two steps. See how backpropagation calculates the gradient of squared error, then how gradient descent uses that gradient to update the weights.