BackpropagationLesson 2 of 6
From partials to an update
Gradients, predicted changes, and simultaneous updates
For with x = 2, y = 5, and w = b = 1, the prediction is 3 and the loss is 2. We found two rates:
Together they form the gradient: . The entry order follows the parameter order (w, b).
What happens if both parameters change?
Section titled “What happens if both parameters change?”For small changes and , the loss change is approximately
This is a dot product: combine each parameter’s change with its own rate. If both increase by 0.01, the predicted loss change is −0.06. The exact new loss is 1.94045, a change of −0.05955.
The gradient describes local changes. It does not give an exact prediction for an arbitrarily large move.
Choose a step size
Section titled “Choose a step size”Gradient descent subtracts a positive learning rate times each partial derivative. Use the rates at the same starting point for every parameter:
Subtracting a negative increases the parameter. With both new values, the prediction is , and the loss is . It was 2.
Computing the gradient and taking the step are separate jobs. Backpropagation will compute the gradient; the update rule decides how to use it.
A bigger step can be worse
Section titled “A bigger step can be worse”Reset to w = b = 1 and use . The parameters become (3, 2), the prediction becomes 8, and the loss becomes 4.5. We overshot the target and increased the loss.
A nonzero gradient gives a downhill direction for sufficiently small steps on a differentiable loss. The useful step size still matters.
Why use the opposite of the gradient?
For a step vector , the first-order prediction is . Among steps with the same Euclidean length, this is smallest when the step points opposite to the gradient.
For , the predicted change is , which is negative when and the gradient is nonzero. This is a local statement. The Calculus gradient diagram shows the geometry.
Read a lecture-style question
Section titled “Read a lecture-style question”“Given and , perform one gradient-descent update with .” What are the new parameters and loss, starting from (1,1)?
Translate and calculate
θ is just the list of parameters. lists the loss derivatives with respect to those parameters. Subtract 0.05 times each entry:
, . The prediction is 3.5; the loss is .
The derivative is (−4,−2), the parameter change is (0.2,0.1), and the new parameter vector is (1.2,1.1). These are three different objects.
Next: calculate the derivatives without expanding the whole loss.