Gradient descent practice
Original practice questions (PDF)
1. Descent at a safe step size
Let be -smooth. For with , use the smoothness upper bound to show
Solution to exercise 1
With , plug into the bound. This gives . Since , the coefficient in parentheses is at least .
2. Termination of Armijo backtracking
Let be -smooth, with . Start from , and multiply by until Show that suffices, and bound the number of backtracks.
Solution to exercise 2
The smoothness bound gives decrease at least . The sufficient inequality is equivalent to . Writing , the number of reductions is at most , the first nonnegative index with .
3. Exact line search on a quadratic
For with , let and . Assuming , find the minimizer of over .
Solution to exercise 3
The line objective equals . It is a strictly convex quadratic minimized at .
4. Gradient descent from an upper model
Assume is -smooth with . Minimize the upper model in . How does the minimizer give the gradient step with step size ?
Solution to exercise 4
The model gradient is . Its unique zero is , the gradient step of length . Since and majorizes , minimizing it controls the actual objective.
5. Gradient and curvature of squared error
For , compute its gradient and Hessian. Prove smoothness with , and give the condition for strong convexity on all of .
Solution to exercise 5
The derivatives are and . The operator norm of the Hessian bounds the Lipschitz constant of the gradient. Strong convexity holds exactly when , equivalently when has full column rank. Its strong-convexity constant is then .
6. Gradient smoothness of logistic loss
Let , where and row of is . Write .
- Show that .
- Bound the gradient Lipschitz constant and give a sufficient condition for strong convexity on a compact convex domain.
Solution to exercise 6
Differentiate the th term to get . Its Hessian is , and . Since , the Hessian is bounded above by , so one may take . On any compact domain these positive continuous weights are bounded below by a common positive constant. If has full column rank, the Hessian is then uniformly positive definite, giving strong convexity there.
7. Exact rate on a scalar-curvature quadratic
For , gradient descent gives . For which do the iterates converge to the minimizer from every starting point? What is the rate?
Solution to exercise 7
Since , convergence for every start holds when , or . The distance contracts by and the objective by per step. At there is one-step convergence. For a nonzero start gives an alternating sequence and gives divergence.
8. The steepest direction
For differentiable , explain why the negative gradient gives the direction of steepest decrease at .
Solution to exercise 8
Among unit directions , the directional derivative is . Cauchy–Schwarz bounds it below by , attained by when the gradient is nonzero. If the gradient is zero, all first-order directional derivatives vanish.
9. The units of a gradient step
If is a position in meters and is energy in joules, what are the units of and the step size in ? What do the units suggest about how problem scaling affects step-size choice?
Solution to exercise 9
Each partial derivative is energy change per displacement, in joules per meter. For to be a displacement, has units square meters per joule. Rescaling the energy or position coordinates changes gradient magnitudes and therefore the numerical step size needed for a similar move.
10. Independent motion in eigendirections
Let with . Show that gradient descent updates each eigendirection independently. If the spectrum lies in , explain how the spectrum determines the convergence rate.
Solution to exercise 10
Along a unit eigenvector of eigenvalue , the coefficient is multiplied by . The distance contraction factor for is at most , and the objective contraction factor is at most its square. At the distance bound is . If , null-space components stay fixed. When , the positive-curvature components decay, so the iterates approach a minimizer.
11. Decrease from minimizing the model
Derive the gradient update by minimizing the smoothness upper bound What is minimized at each step, and why does give descent?
Solution to exercise 11
Minimizing the right-hand quadratic gives . The same upper-bound argument applies for a smaller positive step, because . For the modeled change is negative when , and lies below this model.
12. Oscillation during training
While minimizing a smooth loss with gradient descent, you see the objective decrease for a few steps and then rise. What might the oscillation suggest about the step size? How could a smoothness estimate or the Armijo rule help?
Solution to exercise 12
The current step may be too large for the curvature the iterates encounter. With a valid Lipschitz constant for the gradient, a full-gradient step guarantees decrease away from a stationary point. Without such a constant, backtrack until the trial step gives the Armijo decrease. The oscillation is a reason to check the step size and whether the gradients are exact.