Walking downhill
Gradient descent repeats one move: step against the gradient, . The number is the step size, often called the learning rate. A small is safe but slow. A large overshoots the valley and the iterates can bounce further away each time.
On the simplest bowl the update multiplies by each time, so the iterates shrink to zero exactly when , that is when . The choice lands on the minimum in one step, and any between and still converges but alternates sign on the way. Beyond the factor has size above one and the iterates explode.
In several variables the curvature differs by direction. The largest Hessian eigenvalue caps the usable step () and the smallest sets how slowly the flattest direction is crossed. Their ratio is the condition number. With the best fixed step the error shrinks by about the factor per step, so a large means a factor close to one and a slow zig-zag down a long narrow valley. For the covariance matrix of twelve large US stocks since 2010, is about : the factor is and cutting the error 100-fold takes about 76 steps.
- Safe step: , where is the largest Hessian eigenvalue; otherwise the iterates diverge.
- Speed: set by the condition number ; the larger it is, the slower the descent.
- Stopping: stop when is below a tolerance, with a cap on the number of iterations.
A large condition number often comes from variables on very different scales, for example a weight between 0 and 1 beside a volatility in basis points. Rescaling each variable to a similar size lowers and can turn thousands of iterations into dozens. Preconditioning is the general form of the same idea.
Lab · what's graded
7 tasks · 100 pts- The first step15 pts
- The second step10 pts
- The largest stable step15 pts
- A step that is too big15 pts
- A condition number15 pts
- The best contraction factor15 pts
- Why ill-conditioning is slow15 pts