Skip to content
Kudos AI
Lire en français
Neural Networks

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.

5 min readKudos AI

Prerequisites: What Actually Makes Training Converge

A quadratic bowl stretched along one axis, the gradient path zig-zagging across the narrow direction while creeping along the flat one, and the same descent on a rescaled bowl reaching the bottom in a fraction of the steps.

Fit a quadratic curve to a hundred points with gradient descent. Nothing exotic: the design matrix has columns 11, tt and t2t^2 for tt evenly spaced on [0,1][0, 1], 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 10−610^{-6} 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 0.19361963580.1936196358, and the fitted values agree to 1.8×10−151.8 \times 10^{-15}, 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 HH, everything is set by two eigenvalues: the largest, LL, and the smallest, mm.

LL limits the step size. Take a step larger than 2/L2/L along the steepest eigenvector and the iterate overshoots to somewhere worse than it started; the run diverges.

mm 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 α=2/(L+m)\alpha = 2 / (L + m), the error falls by a factor of

κ−1κ+1,κ=Lm,\frac{\kappa - 1}{\kappa + 1}, \qquad \kappa = \frac{L}{m},

per step, so the number of steps to a fixed accuracy is proportional to κ\kappa, 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 ⌈log⁡10−6/log⁡(99/101)⌉=691\lceil \log 10^{-6} / \log(99/101) \rceil = 691 steps to bring the distance to the optimum down by a factor of 10−610^{-6}. 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κ\kappaSteps
1, t, t21,\ t,\ t^2504.541742
centred and scaled60.81147
orthonormal1.00001

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 11, tt and t2t^2 simply point in similar directions on [0,1][0,1]: 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 κ=1\kappa = 1 the allowed step size is exactly right for every direction at once, and gradient descent with α=1/L\alpha = 1/L 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

κ−1κ+1,\frac{\sqrt{\kappa} - 1}{\sqrt{\kappa} + 1},

which replaces κ\kappa by κ\sqrt{\kappa} in the step count. On the κ=100\kappa = 100 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.

11e-6
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 κ\kappa to κ\sqrt{\kappa}. On κ=104\kappa = 10^4 that is the difference between hopeless and slow, not between slow and fast. It also introduces a second hyperparameter whose optimal value depends on κ\kappa, which you do not know.

Rescaling, where it is available, is strictly better: it changes κ\kappa 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 10610^6 and its entry in X⊤XX^{\top}X by 101210^{12}, and that factor lands directly in κ\kappa.
  • 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.

Related reading

10 min readNeural Networks

What Actually Makes Training Converge

A two per cent change in the learning rate separates a converged run from one five orders of magnitude away, a condition number predicts the convergence rate to six decimal places, and stochastic gradient descent with a fixed step never converges at all - it settles into a ball whose radius grows as the square root of the step. Every figure here was computed on a problem whose exact optimum is known.

OptimizationDeep LearningMachine Learning
4 min readProbability Foundations

Which Wrong Distribution Do You Want?

One bimodal target, one Gaussian, and two directions of the same divergence. Minimising KL(P||Q) puts the Gaussian across both modes with almost no mass where the target actually lives; minimising KL(Q||P) puts it on one mode at a value of 0.6931 nats, which is ln 2 to four decimals and not a coincidence. Each fit is judged catastrophic by the other objective, 2.0976 against 15.2799.

Machine LearningMathematics
3 min readProbability Foundations

The Two Features That Look Like Noise

A variable that determines another with a correlation of exactly 0.0000000000, and a pair of features whose every pairwise mutual information with the target is exactly zero while the two together determine it completely. Univariate screening discards both, and the second case is the one that matters: the features it removes are removed because they matter.

Machine LearningMathematics
← Back to all articles