The Slowest Direction Sets the Pace
The step size you are allowed is fixed by the steepest direction and the number of steps you need is fixed by the flattest, so the cost of gradient descent is their ratio. The same least-squares fit, to the same ten decimal places, takes 1742 steps in one basis, 147 in a rescaled one and exactly 1 in an orthonormal one, and momentum buys back the square root of the ratio rather than the ratio.
Prerequisites: What Actually Makes Training Converge
Fit a quadratic curve to a hundred points with gradient descent. Nothing exotic: the design matrix has columns , and for evenly spaced on , the loss is squared error, the step size is the best constant one for this problem, and the run stops when the loss is within of its minimum, relative to where it started.
It takes 1742 steps.
Now centre and scale the two non-constant columns. Same data, same fit, same minimum. 147 steps.
Now replace the three columns with an orthonormal basis for the same span, which a QR factorisation produces in one call. 1 step.
All three land on the same answer. The residual sums of squares agree to ten decimal places at , and the fitted values agree to , because the three bases span the same space and least squares does not care which one you hand it. The optimiser does.
A. Where the ratio comes from
For a quadratic loss with Hessian , everything is set by two eigenvalues: the largest, , and the smallest, .
limits the step size. Take a step larger than along the steepest eigenvector and the iterate overshoots to somewhere worse than it started; the run diverges.
limits the progress. Along the flattest eigenvector the gradient is small, so a step of the allowed size moves you very little.
You are forced to a step size set by the steepest direction and then have to cross the flattest one with it. With the optimal constant step size , the error falls by a factor of
per step, so the number of steps to a fixed accuracy is proportional to , the condition number. Nothing about how deep the bowl is appears anywhere. A loss can be enormous and easy, or tiny and hard.
For a clean check, take a two-dimensional quadratic with eigenvalues 1 and 100. The formula predicts steps to bring the distance to the optimum down by a factor of . Running it takes 691. (Count on the loss instead and you get half of that, because the loss is the distance squared. The rate describes the distance.)
B. The three bases, measured
The conditioning of the three designs above, and what each costs:
| Basis | Steps | |
|---|---|---|
| 504.54 | 1742 | |
| centred and scaled | 60.81 | 147 |
| orthonormal | 1.0000 | 1 |
The first row is not a pathological design. It is the obvious way to write a quadratic fit, on a tidy interval, with no outliers and no collinearity worth the name. The columns , and simply point in similar directions on : all three are positive and increasing across most of the range, so the Hessian is far from a multiple of the identity.
The last row is the limiting case worth holding on to. When the allowed step size is exactly right for every direction at once, and gradient descent with reaches the minimum of a quadratic in a single step. All the iteration in the first row is the optimiser working around a choice of coordinates.
C. What momentum buys, and what it does not
Heavy-ball momentum adds the previous update to the current one. On a quadratic, tuned optimally, its asymptotic rate is
which replaces by in the step count. On the problem above that predicts 69 steps against gradient descent's 691, and a run measures 93 - slower than the asymptotic bound because the bound describes the tail rather than the transient, but still a factor of 7.43 on the same problem under the same stopping rule.
The figure opens at a condition number of 23.841. Drag it to 100 and plain gradient descent needs 691 steps, as above, while momentum needs 90 from the figure's starting point against 93 from the one used here: step counts depend on where a run starts, and convergence rates do not.
Interactive: what the square root is worth
Both runs at their own optimal settings. Error on a log axis.
- Plain, steps to 1e-6
- 165
- Momentum, steps
- 42
- Momentum rate, asymptotic
- 0.660021
- Momentum rate, measured
- 0.677785
The lesson’s own problem: 165 steps for six digits against 42, a factor of 3.9 where the asymptotic rates predict 4.9. The gap is worth keeping rather than smoothing over. Polyak’s 0.660021 is a limit; measured over steps 20 to 60 the run actually contracts at 0.677785, because Polyak’s tuning gives each curvature direction a repeated root, and a repeated root decays like t times the rate to the power t, not the rate to the power t. That extra factor fades slowly, and on this problem it never does - machine precision arrives first. The honest claim is that momentum turns a kappa problem into a sqrt(kappa) one and that a real run gets most of that, not all.
The square root is the whole benefit, and it is worth being precise about what that means. Momentum does not fix conditioning; it takes the cost from to . On that is the difference between hopeless and slow, not between slow and fast. It also introduces a second hyperparameter whose optimal value depends on , which you do not know.
Rescaling, where it is available, is strictly better: it changes itself, costs one pass over the data, and has no tuning.
D. Why this is everywhere
Once you are looking for the ratio rather than the depth, a lot of standard practice stops looking like folklore.
- Standardising inputs is conditioning work. Rewriting one feature from kilometres into millimetres multiplies its column by and its entry in by , and that factor lands directly in .
- Adaptive methods such as RMSProp and Adam maintain a per-coordinate step size, which is a diagonal preconditioner: an attempt to equalise the eigenvalues cheaply, using only the information a diagonal can carry.
- Normalisation layers keep activations on a comparable scale as the network trains, which keeps the Hessian from drifting into a bad ratio part way through a run.
- Residual connections shorten the path a gradient takes, which keeps the spread of curvature across depth from compounding.
None of these makes the loss smaller. They all make the same loss cheaper to descend, which is a different thing and, on the evidence of the table above, often the larger factor by far.
References & further reading
- Stephen Boyd, Lieven Vandenberghe, Convex Optimization, Cambridge University Press, 2004source ↗
- Ian Goodfellow, Yoshua Bengio, Aaron Courville, Deep Learning, MIT Press (Adaptive Computation and Machine Learning), 2016source ↗
Copyrighted works are cited for reference only and are not hosted here; please consult the publisher for access.