Optimization/The Optimization Landscape

Lesson 4.42,714 words

The Optimization Landscape

The loss of a deep network is a non-convex surface in millions of dimensions, so local search carries no global guarantee, yet it works. We classify critical points by the eigenvalues of the Hessian, show that in high dimension nearly all of them are saddle points rather than bad local minima, and read off the practical terrain — plateaus, cliffs, ill-conditioning, and the sharp-versus-flat distinction that ties the geometry of a minimum to how well it generalizes.

╌╌╌╌

Every optimizer in this chapter (SGD, momentum and the adaptive methods) is a rule for walking downhill on the same object: the empirical risk as a function of the parameter vector , with in the millions or billions. This lesson studies the shape of that surface. The shape is what makes optimization hard, and it is also why optimization works at all.1

Non-convexity

A function is convex if the chord between any two points lies on or above its graph; equivalently its Hessian is positive semidefinite everywhere. Convexity is the property that makes linear and logistic regression easy: a convex function has one basin, so any point where the gradient vanishes is a global minimum, and gradient descent is guaranteed to find it.

Deep networks lose this property once they have a hidden layer. The reason is weight-space symmetry: permuting the hidden units of a layer, or flipping the sign convention across a unit, produces a different computing the same function with the same loss. Any minimum therefore comes with an exponential orbit of equivalent minima (at least of them per layer), and a function with many separated global minima cannot be convex.2

A non-convex loss along a 1D slice: the chord dips below the graph, and local search from the left lands in a local, not global, minimum.

There is no algorithm guaranteed to find a global minimum of a general non-convex function in polynomial time. By the symmetry argument the global minimum is anyway not unique, so the goal shifts: we do not need the minimum, only a whose loss is low enough. Empirically, plain local search reliably finds such a point; the rest of this lesson explains why the obstacles that could trap it mostly do not.

Critical points and the Hessian

Local search stalls wherever the gradient vanishes. Such a point is a critical point; its type is decided by the local curvature, which is the Hessian , the symmetric matrix of second partials .

The claim that curvature alone fixes the type follows from the second-order Taylor expansion around any point , displaced by a step :

At a critical point the linear term vanishes because , so the leading behaviour is the quadratic form alone: the surface looks, to second order, like a pure paraboloid centred at . Everything about whether that paraboloid opens upward, downward, or both is encoded in .

Diagonalize (possible because is symmetric, so its eigenvectors are orthonormal and its eigenvalues real) and change coordinates to the eigenbasis, with . Since is orthogonal it preserves lengths, and the quadratic term decouples into a sum of independent parabolas, one per eigendirection:

Along eigendirection the loss curves up if and down if , with steepness set by : the eigenvalue is literally the second derivative of the loss along its eigenvector. The sign pattern across all eigenvalues classifies the point completely.

Critical-point typeHessian eigenvaluesLocal shapeBehaviour of descent
Local minimumall ()bowl, up in every directionattracts; gradient descent settles
Local maximumall ()dome, down in every directionrepels; never reached by descent
Saddle pointmixed signsup in some axes, down in othersdescent stalls, then escapes down a negative direction
Degeneratesome flat in those directionsplateau; second order undecided

With two eigendirections the whole taxonomy fits on one strip: each panel draws the loss profile along and along , and the pair of curvature signs names the point. Both cupped up is a minimum; both cupped down is a maximum; one of each is a saddle.

Critical points by the sign pair of the two Hessian eigenvalues. Each panel shows the loss profile along (blue) and (red). Two ups: minimum. Two downs: maximum. One up, one down: saddle.

The three non-degenerate types are easiest to see as contour insets. A minimum has closed elliptical contours; a maximum has the same closed contours but with the loss decreasing outward; a saddle has the open, hyperbolic contours of .

The three non-degenerate critical points. Minimum: elliptic contours, both . Maximum: elliptic contours, both . Saddle: hyperbolic contours, .

The saddle is the important case, because it dominates high-dimensional loss surfaces. Its descent and escape directions are orthogonal: the gradient pulls the iterate into the saddle along the up-curving axis, where it stalls; the only way out is along the down-curving axis, where the gradient gives no pull until the iterate is displaced.

A saddle point. Contours are hyperbolic; the up-curving axis (descent leads in) and the down-curving axis (the escape direction, ) are orthogonal. The gradient vanishes at the center.

Why saddles, not local minima, are the obstacle

The classical worry, inherited from low-dimensional intuition, is local minima: basins of bad loss that trap the optimizer below the global value. In high dimension this worry is misplaced. The reason is a counting argument on the eigenvalue signs.

At a random critical point, model each eigenvalue's sign as a near-independent coin flip with . A point is a local minimum only if every one of its eigenvalues is positive:

For any short of certainty, collapses to zero as grows. With even a modest , the probability that all signs agree is astronomically small, so critical points are overwhelmingly mixed: saddles. The same vanishing applies to maxima. Local minima do exist, but the counting says they sit only at the very bottom: random-matrix theory makes the relationship sharp.

The Hessian's eigenvalues fill a semicircular band whose whole position drifts rightward as the loss drops. At high loss the band straddles zero with most of its mass on the negative side, so the point has a majority of down-directions and is a highly unstable saddle. As the loss falls the band slides right; the count of negative eigenvalues shrinks. Only in the lowest sliver does the entire band clear zero, and only there is the point a true local minimum.

The Hessian eigenvalue spectrum slides right as the loss drops. At high loss (top) the band straddles zero, so many give escape directions — a saddle. At low loss (bottom) the whole band clears zero, — a minimum. The dashed line marks .

The practical consequence: a high-loss critical point almost never traps the optimizer, because it almost always has a downhill escape direction. The escape can be slow, though. Near a saddle the gradient is small in every direction (it must vanish at the center), so plain gradient descent makes little progress there. The surrounding lessons supply the remedies.

MechanismHow it escapes a saddleLesson
Momentumaccumulated velocity carries the iterate through the flat region instead of stallingmomentum
SGD gradient noiseminibatch sampling perturbs the iterate off the saddle's stable manifold onto a descending directiongradient descent and SGD
Adaptive rates (Adam)per-coordinate scaling enlarges steps along low-curvature escape axesmomentum

Why noise escapes is again the per-eigencoordinate recursion. Along an escape direction with , one gradient step scales the displacement by , so any nonzero component grows each step:

If the iterate lands exactly on the saddle's stable manifold — the subspace spanned by the positive-eigenvalue directions, where along every negative axis — it stalls, because there is nothing to amplify. That exact landing has measure zero, and gradient noise from minibatch sampling guarantees a nonzero along the unstable axis. Once seeded, that component blows up geometrically at rate and the iterate slides off the saddle. The stall near the center is real but temporary; the escape time scales with , so the flattest saddles (small ) hold the iterate longest.

The rest of the terrain

Saddles are the dominant feature, but four further features of the surface shape how a step should be taken.

Plateaus

A plateau is an extended region where the gradient is near zero without a critical point in sight: the eigenvalues are small in magnitude, so the surface is nearly flat. Saturating activations create them: a unit deep in the flat tail of a sigmoid or has , so the gradient that reaches its weights is attenuated to almost nothing and progress stalls for many steps.

A plateau. Across the flat middle region the gradient , so descent crawls even though no minimum has been reached; progress resumes only past the shoulder.

Cliffs and exploding gradients

The opposite pathology is a cliff: a near-vertical wall where the loss changes by a large amount over a tiny change in , so the gradient is enormous. Common in recurrent networks, where repeated multiplication by a recurrent weight matrix makes the gradient magnitude grow geometrically with sequence length. A normal-sized learning rate times a huge gradient yields a huge step that throws the iterate far across the surface, undoing many updates of progress.

The standard remedy is gradient clipping: rescale the gradient to a fixed norm before stepping, keeping its direction but capping its length,

so the step is bounded by no matter how steep the wall. The direction (which is correct, pointing along the wall toward lower loss) is preserved; only the magnitude is capped.4

A cliff and gradient clipping. The raw step (red) overshoots past the basin; the clipped step (green) keeps the direction but caps the length.

Ill-conditioning

Even a perfectly convex bowl can be hard to descend if it is stretched: long and narrow rather than round. The stretch is measured by the condition number of the Hessian, the ratio of its largest to smallest eigenvalue,

The reason a large hurts is visible in the decoupled coordinates. On a quadratic bowl , gradient descent with rate updates each eigencoordinate independently,

so coordinate decays geometrically at rate . For every coordinate to converge the rate must satisfy , i.e. — the steep axis sets the ceiling. Plug that largest usable rate into the gentle axis and the decay factor is , which is close to when . The steep axis forces a small step; the gentle axis then crawls, needing on the order of iterations to make the same relative progress. The iterate zig-zags across the narrow valley while inching down its length. This is the structural reason for momentum and for per-coordinate adaptive learning rates, both of which counteract a large .

An ill-conditioned ravine, . The elliptical contours are stretched; gradient descent (red) zig-zags across the steep short axis while creeping along the gentle long axis toward the minimum.
Condition numberGeometryGradient descent
round bowlsteps straight to the minimum
long narrow ravinezig-zags across the valley, crawls along it
degenerate (flat direction)no progress along the flat axis

Sharp versus flat minima

Not all minima generalize equally, and the geometry that distinguishes them is again curvature. A sharp minimum sits at the bottom of a narrow, steep basin (large Hessian eigenvalues); a flat minimum sits in a wide, shallow basin (small eigenvalues). They can have identical training loss yet behave very differently on test data.

The link to generalization is a shift argument. Train and test losses are the same functional shape evaluated on different samples, so the test-loss curve is approximately the train-loss curve shifted by a small displacement . At a sharp minimum the steep walls mean a small horizontal shift produces a large vertical gap — the test loss at the trained is much higher than the train loss. At a flat minimum the same shift barely raises the loss, so train and test nearly coincide.

Sharp versus flat minima. Shifting the train loss (blue) to the test loss (red) opens a large gap at the sharp basin but a small one at the flat basin.

This is why the implicit bias of SGD toward flat regions (small batches inject more gradient noise, and noise cannot rest in a narrow basin) is widely believed to be part of why deep networks generalize at all.5 The formal version of the train-test-gap argument is developed in generalization theory.

The landscape, made quantitative

Every claim in this lesson that Goodfellow states qualitatively has a public paper that made it quantitative.

  • Saddles, counted. Dauphin et al. gave the random-matrix argument behind the sliding-spectrum figure and turned it into an algorithm — saddle-free Newton, which uses to escape saddles that both gradient descent and raw Newton get stuck near. Choromanska et al. connected the deep loss surface to the spin-glass models of statistical physics, making high-loss critical points are saddles a theorem about a tractable proxy.67
  • Flat minima and generalization, measured. Keskar et al. showed empirically that large-batch training lands in sharper minima that generalize worse, and quantified sharpness by the loss increase in a small neighborhood — the shift-argument figure made into a metric. Sharpness-Aware Minimization (Foret et al.) then turned the observation into an optimizer that explicitly seeks flat regions.89
  • Mode connectivity, made visible. The remark above is Garipov et al.'s and Draxler et al.'s finding: independently trained minima are joined by low-loss curves. Li et al.'s loss-landscape visualizations are the source of the now-standard pictures of wide flat basins versus chaotic sharp ones.1011

The pattern across these is that high-dimensional geometry is benign in a way low-dimensional intuition does not predict: isolated deep local minima are vanishingly rare, and the real obstacles (saddles, sharp basins, ill-conditioning) all have standard remedies.

Takeaways

  • The deep loss surface is non-convex (weight-space symmetries alone force exponentially many equivalent minima), so local search has no global guarantee; the realistic goal is a with low enough loss, which local search reliably finds.
  • Critical points () are classified by the Hessian eigenvalues: all positive minimum, all negative maximum, mixed signs saddle.
  • In high dimension the chance that all eigenvalues share a sign is , so almost every critical point is a saddle, not a bad local minimum; high-loss critical points have many escape directions, and momentum and SGD noise carry the iterate past them.
  • The remaining terrain — plateaus (vanishing gradients), cliffs (exploding gradients, cured by gradient clipping to a fixed norm), and ill-conditioning (large ) — explains why the plain step needs momentum and adaptive rates.
  • Flat minima generalize better than sharp ones: a small train-test shift opens a large gap in a steep basin and a small one in a wide basin, and mode connectivity shows the good minima form one connected low-loss region.

Footnotes

  1. Goodfellow, Deep Learning, §8.2 — Challenges in Neural Network Optimization: ill-conditioning, local minima, plateaus, saddles, and cliffs as the obstacles a step must navigate.
  2. Goodfellow, Deep Learning, §8.2.2 — Local Minima: weight-space symmetry (unit permutations, sign flips) forces exponentially many equivalent minima, ruling out convexity.
  3. Goodfellow, Deep Learning, §8.2.3 — Plateaus, Saddle Points and Other Flat Regions: in high dimension critical points are overwhelmingly saddles, and high loss correlates with more negative-curvature escape directions.
  4. Goodfellow, Deep Learning, §8.2.4 — Cliffs and Exploding Gradients: steep walls produce giant steps, tamed by norm-based gradient clipping that caps length while preserving direction.
  5. Chollet, Deep Learning with Python, §2.4 — The Engine of Neural Networks: SGD's noise as an implicit regularizer biasing solutions toward flatter, better-generalizing basins.
  6. Dauphin et al., Identifying and Attacking the Saddle Point Problem in High-Dimensional Non-Convex Optimization, NeurIPS 2014 — the random-matrix saddle argument and the saddle-free Newton method.
  7. Choromanska et al., The Loss Surfaces of Multilayer Networks, AISTATS 2015 — a spin-glass model of the deep loss surface predicting a band of low-loss minima above a floor of saddles.
  8. Keskar et al., On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima, ICLR 2017 — large batches find sharper minima that generalize worse, with a sharpness metric.
  9. Foret, Kleiner, Mobahi & Neyshabur, Sharpness-Aware Minimization for Efficiently Improving Generalization, ICLR 2021 — SAM, an optimizer that minimizes the worst-case loss in a neighborhood to seek flat minima.
  10. Garipov et al., Loss Surfaces, Mode Connectivity, and Fast Ensembling of DNNs, NeurIPS 2018 — low-loss curves connecting independently trained minima.
  11. Li, Xu, Taylor, Studer & Goldstein, Visualizing the Loss Landscape of Neural Nets, NeurIPS 2018 — filter-normalized visualizations of flat versus sharp basins.

╌╌ END ╌╌