Walking downhill
Gradient descent repeats one move: step against the gradient, wk+1=wk−η∇f(wk). The number η>0 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.
f(w)=21aw2 ⇒ wk+1=(1−ηa)wk,∣1−ηa∣<1⟺0<η<a2(1) On the simplest bowl the update multiplies w by 1−ηa each time, so the iterates shrink to zero exactly when ∣1−ηa∣<1, that is when η<2/a. The choice η=1/a lands on the minimum in one step, and any η between 1/a and 2/a still converges but alternates sign on the way. Beyond 2/a the factor has size above one and the iterates explode.
Three steps on f = 3x²Here
f′(x)=6x, so
a=6. Start at
x0=4 with
η=0.1: the factor is
1−0.6=0.4, giving
x1=1.6,
x2=0.64,
x3=0.256. The stability limit is
2/6=0.333. With
η=0.5 the factor is
1−3=−2, so the iterates run
4,−4,8,… and double in size each step.
In several variables the curvature differs by direction. The largest Hessian eigenvalue L caps the usable step (η<2/L) and the smallest μ sets how slowly the flattest direction is crossed. Their ratio κ=L/μ is the condition number. With the best fixed step η=2/(L+μ) the error shrinks by about the factor (κ−1)/(κ+1) 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 33: the factor is 0.941 and cutting the error 100-fold takes about 76 steps.
η∗=L+μ2,∥wk−w∗∥ ≲ (κ+1κ−1)k∥w0−w∗∥,κ=μL(2) - Safe step: η<2/L, where L is the largest Hessian eigenvalue; otherwise the iterates diverge.
- Speed: set by the condition number κ=L/μ; the larger it is, the slower the descent.
- Stopping: stop when ∥∇f∥ is below a tolerance, with a cap on the number of iterations.
Scale the variablesA 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
- 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