Quant Memo
Advanced

Ill-Conditioning and the Hessian Spectrum

When a loss surface curves far more steeply in some directions than others, gradient descent is forced into a slow, zig-zagging path — the ratio between the steepest and gentlest curvature, the condition number, sets how bad that zig-zag gets.

Prerequisites: The Hessian and Second-Order Behavior, Saddle Points and Plateaus

Gradient descent takes one step size and applies it in every direction at once, which works fine if the loss surface curves about the same amount in every direction — like the bottom of a round bowl. It works badly if the surface is shaped like a narrow ravine, curving steeply on the sides and gently along the floor, because the single step size that is safe for the steep direction is far too small to make real progress along the gentle one. That mismatch — ill-conditioning — is measured directly by the Hessian's eigenvalues.

The analogy: a round bowl versus a narrow ravine

Rolling a ball down a round, symmetric bowl, it heads straight for the bottom no matter which side it starts on. Rolling the same ball down a long, narrow ravine — steep walls, a nearly flat floor — it instead bounces back and forth between the walls, only slowly drifting along the floor toward the actual low point, because most of its motion gets absorbed zig-zagging across the narrow direction rather than progressing along the long one. Gradient descent on an ill-conditioned loss surface behaves exactly like that ball in the ravine: it oscillates across the steep-curvature directions while crawling along the gentle ones.

The condition number

The Hessian's eigenvalues describe curvature along each principal direction of the loss surface. The condition number is their ratio:

κ=λmaxλmin\kappa = \frac{\lambda_{\max}}{\lambda_{\min}}

where λmax\lambda_{\max} and λmin\lambda_{\min} are the largest and smallest eigenvalues. In words: κ\kappa measures how lopsided the bowl is — κ=1\kappa=1 means perfectly round (equally steep in every direction), while κ1\kappa \gg 1 means one direction is far steeper than another. Plain gradient descent's usable step size is capped by the steepest direction (a step too large there causes overshoot and divergence), roughly η<2/λmax\eta < 2/\lambda_{\max}, even though that same step size is needlessly tiny for making progress along the gentlest direction — the larger κ\kappa is, the worse this mismatch, and the more iterations are needed to converge.

Worked example 1: the safe step size and its cost

Suppose a quadratic loss has Hessian eigenvalues λmax=100\lambda_{\max}=100, λmin=1\lambda_{\min}=1, giving κ=100\kappa = 100. The safe learning rate bound is η<2/100=0.02\eta < 2/100 = 0.02. Using η=0.05\eta = 0.05 (bigger than the bound) along the steep direction causes the iterate to overshoot and oscillate with growing amplitude — diverging rather than converging. Using the safe η=0.02\eta=0.02 instead, progress along the gentle direction (with curvature λmin=1\lambda_{\min}=1) advances by roughly η×λmin=0.02\eta \times \lambda_{\min} = 0.02 of the remaining distance per step — needing on the order of 100 steps just to meaningfully close that gap, purely because the step size had to be set small enough for the other direction.

Worked example 2: convergence speed scales with κ\kappa

For gradient descent on a quadratic, the number of iterations needed to shrink the error by a fixed factor scales roughly with κ\kappa. At κ=1\kappa=1 (perfectly conditioned), convergence takes on the order of a handful of iterations. At κ=100\kappa=100, it takes on the order of 100 times as many. At κ=10,000\kappa=10{,}000 — not unusual for a poorly-scaled neural network loss — it takes on the order of 10,000 times as many iterations to reach the same accuracy, all else equal. This single ratio, more than the raw size of the gradient, is what actually predicts how painfully slow plain gradient descent will be on a given loss surface.

round bowl (κ≈1): direct path narrow ravine (κ≫1): zig-zag path
A wide, round loss surface (low condition number) lets gradient descent head straight for the minimum; a narrow, elongated one (high condition number) forces the same algorithm into a zig-zag.

Matrix explorer
dashed = before · solid = after
det 1.25trace 2.50λ 1.81, 0.69area scales by 1.25×

Drag the matrix parameters here until the unit circle becomes a long, thin ellipse — that is exactly what a high condition number looks like geometrically: the eigenvector along the ellipse's long axis is the gentle direction, the short axis is the steep one.

The Hessian's condition number, the ratio of its largest to smallest eigenvalue, measures how lopsided a loss surface is. Plain gradient descent's step size is bounded by the steepest direction, so a large condition number forces small steps everywhere, producing slow, zig-zagging convergence even when the gradient's magnitude looks reasonable.

What this means in practice

Ill-conditioning is a major reason adaptive optimizers (RMSProp, Adam, AdamW) and second-order methods exist — they effectively rescale each direction by its own local curvature, rather than using one global step size, directly attacking the mismatch a large condition number creates. Feature scaling and normalization layers also help indirectly, by keeping different parts of the network's loss surface from ending up with wildly different local curvatures in the first place.

The common mistake is diagnosing slow or oscillating training purely from the size of the loss or the gradient norm, and concluding the learning rate is simply "too big" or "too small" in some absolute sense. The right learning rate is relative to the steepest curvature direction, which a small gradient norm can hide entirely — a loss surface can have a small gradient right now and still be badly ill-conditioned, oscillating wildly the moment training approaches a steep direction the current point happens to be far from.

Related concepts

Practice in interviews

Further reading

  • Goodfellow, Bengio & Courville, Deep Learning (2016), ch. 8
  • Nocedal & Wright, Numerical Optimization (2006)
ShareTwitterLinkedIn