Loss Landscapes
Saddles, lazy versus rich training, and why overparameterized networks are easy to train.
For decades the fear was that gradient descent on a neural network would get stuck in a bad local minimum. Real landscapes turned out stranger and kinder: high-loss critical points are mostly saddles, very wide networks can train like linear models, the learning rate caps how sharp a minimum can be, and with more parameters than examples the minima form vast manifolds. This lesson derives each picture and shows how to look at a landscape without being fooled by it.
What you’ll learn
- Classify critical points by their Hessian eigenvalues, derive how long gradient descent lingers near a strict saddle, and state what is proven about saddles and bad local minima.
- Read one- and two-dimensional views of a landscape, explain filter normalization, and use a loss barrier between two solutions as a certificate of nonconvexity.
- Derive the function-space dynamics of a linearized network, and explain the neural tangent kernel, lazy training and how it differs from feature learning.
- Derive the stability threshold , describe the edge of stability, and show that overparameterized networks have manifolds of minima and a PL inequality set by the tangent kernel.
Saddles, not traps
A network with parameters has a loss landscape over . Its critical points are where , and near one of them, , the Hessian decides the shape. Write with orthonormal eigenvectors . If every the point is a strict local minimum; if the signs are mixed it is a saddle point. The fraction of negative eigenvalues is the point's index (Morse theory counts them instead of taking the fraction), and a saddle with at least one strictly negative eigenvalue is a strict saddle.
On the quadratic model the gradient is , so a step acts on each eigen-coordinate on its own:
A negative curvature multiplies its coordinate by at every step, so any nonzero offset grows until it leaves the quadratic region, of size say. Starting from an offset , that takes
The delay grows only logarithmically as the start approaches the ridge, but inversely with the curvature: a saddle whose negative eigenvalues are tiny shows up as a long plateau in the loss curve. Gradient descent converges to the saddle only from starts with no component along any negative direction, a set whose dimension is the number of nonnegative eigenvalues, so it has measure zero.
Why expect saddles rather than bad minima? At a high-loss critical point of a random function of variables, all curvatures being positive is exponentially unlikely. For random Gaussian fields, critical points concentrate on a curve along which the index rises with the loss (Bray & Dean, 2007), and Dauphin et al. (2014) found the same qualitative picture for small networks, with many near-zero eigenvalues that turn saddles into plateaus. That is an analogy, not a theorem about networks. Deep linear networks provably have no spurious local minima (Kawaguchi, 2016; Learning Dynamics of Deep Linear Networks), but two-layer ReLU networks with units fit to a same-size teacher on Gaussian inputs do, and random starts often reach them; mild overparameterization made them far rarer (Safran & Shamir, 2018).
On this saddle the offset from the ridge grows by a factor per step (, curvature ). If gradient descent starts ten times closer to the ridge, how many extra steps does it spend near the saddle?
Show the answer
47
steps. Each factor of ten costs the same delay, so a start exponentially close to the ridge costs only linearly more time. The curvature matters far more: with a negative eigenvalue of , the same factor of ten costs about steps even at .
Seeing a landscape
Lines. The cheapest picture evaluates on the segment from the initialization to the trained weights. Goodfellow, Vinyals & Saxe (2015) found that for a variety of state-of-the-art networks the loss falls along this line without meeting any significant obstacle: whatever detours SGD takes, a smooth downhill path exists. This monotonic linear interpolation is common but not a law: Lucas et al. (2021) produced violations systematically with large learning rates, Adam and batch normalization, all of which carry the weights far from their start.
Planes. Two random directions give the slice . Raw Gaussian directions mislead, because weight scale is partly arbitrary: by the rescaling symmetry of ReLU networks, and the scale invariance that normalization layers create, a network with large weights can compute the same function as one with small weights, yet a perturbation of fixed size barely affects the first and wrecks the second. Li, Xu, Taylor, Studer & Goldstein (2018) therefore rescale each filter of a random direction (for a fully connected layer, each unit's incoming weights) to the norm of the same filter in :
Two solutions. The third picture joins two networks trained from different random starts. A convex loss stays below the chord between the end values, so a positive barrier certifies nonconvexity. Permutation symmetry makes barriers unavoidable: reorder the hidden units of with their weights and you get a second minimum computing the same function, while the average of the two mixes unrelated units.
What the pictures hide. A random unit direction is nearly orthogonal to the few sharpest Hessian eigenvectors, and its curvature is close to the average eigenvalue : slices show the bulk of the curvature and can look convex where the Hessian has negative eigenvalues. Training trajectories are nearly invisible in random planes, since they move in a very low-dimensional subspace (Training in a Tiny Subspace). Pictures are evidence, not proof.
Lazy versus rich training
How far do the weights move during training? If not far, the network is well described by its first-order Taylor expansion around the initialization :
Stack the outputs on the training inputs into , with Jacobian and residual . Gradient flow on moves the parameters along , and the chain rule turns this into an equation for the outputs:
is the tangent-kernel matrix. If it stays constant, as it does exactly for the linearized model, the equation is linear: the residual decays along each eigenvector of at a rate equal to its eigenvalue.
A new input moves by , with . Integrating, with invertible, the trained network is kernel regression with the NTK, started from the initial function:
When does the kernel stay constant? Jacot, Gabriel & Hongler (2018) proved that as the widths of a network in the NTK parameterization (each layer's output scaled by one over the square root of its fan-in) tend to infinity, the NTK becomes deterministic and stays constant over any fixed training horizon; for data on a sphere and a non-polynomial activation it is positive definite, so the loss goes to zero and the result is the kernel regressor above. The reason is a separation of scales: at width the Hessian of the output has norm of order in a ball of fixed radius around the initialization, while its gradient stays of order one, so the gradient, and with it the kernel, barely changes anywhere in that ball (Liu, Zhu & Belkin, 2020). The weights do travel a distance of order one; it is the curvature that is small, not the movement, even though each single weight moves by only . The network fits the data without changing its features: lazy training.
Chizat, Oyallon & Bach (2019) showed that laziness comes from scale, not width as such: multiply a model's centered output by and divide the loss by , and the quantity bounding the departure from the linearization falls like , so any model trains lazily for large . For a two-layer network , the NTK choice becomes lazy as , while the mean-field choice keeps the units moving. Laziness is not what makes practical networks good: on CIFAR-10, widened VGG-11 and ResNet models trained lazily reached 61.7% and 56.7% test accuracy, against 89.7% and 91.0% when trained normally.
Networks trained with standard settings change their hidden representations, which is what feature learning means. How SGD Learns Features proves what this buys, μP & Hyperparameter Transfer keeps features moving as width grows, and Spectral Bias & Fourier Features uses the kernel dynamics above to explain why networks fit low frequencies first.
import torch
from torch.func import functional_call, jacrev, vmap
def empirical_ntk(model, X):
params = {k: v.detach() for k, v in model.named_parameters()}
def f(p, x): # scalar output for one input
return functional_call(model, p, (x.unsqueeze(0),)).squeeze()
grads = vmap(jacrev(f), in_dims=(None, 0))(params, X) # one gradient per input
J = torch.cat([g.reshape(len(X), -1) for g in grads.values()], dim=1) # n × P
return J @ J.T # K_ij = ∇f(x_i) · ∇f(x_j)
model = torch.nn.Sequential(torch.nn.Linear(10, 1024), torch.nn.Tanh(),
torch.nn.Linear(1024, 1)).double()
X = torch.randn(64, 10, dtype=torch.float64)
K = empirical_ntk(model, X) # 64 × 64, from P = 12,289 parameters
mu = torch.linalg.eigvalsh(K)[0] # λ_min(K), the PL constant of ½‖u − y‖²The empirical NTK of a finite network with torch.func: one gradient per training input, stacked into the Jacobian, and . Its smallest eigenvalue returns in the last step as a PL constant. For inputs of very low dimension and a smooth activation, can be so ill-conditioned that rounding swamps its smallest eigenvalue, hence the 64-bit floats.
Which change pushes the training of a network toward the lazy regime?
- Switching a two-layer network from the NTK output scaling to the mean-field scaling
- Multiplying all initial weights of a two-layer ReLU network without biases by
- Multiplying the network's centered output by and dividing the loss by
- Narrowing the network while keeping the NTK parameterization
Show the answer
C. Multiplying the network's centered output by and dividing the loss by
Scaling the centered output by shrinks the quantity that measures departure from the linearization by (Chizat, Oyallon & Bach, 2019): the weights need to move times less to fit the data, so the Jacobian hardly changes. The other three changes make training less lazy.
Sharpness and the stability threshold
Near a minimum every curvature is nonnegative, and the eigen-decomposition from the first step decides whether gradient descent settles there or is thrown out.
With and , each eigen-coordinate is multiplied by per step. It shrinks only if ; beyond that it flips sign and grows.
Every positive curvature must satisfy this, so the sharpest one binds: the stability threshold. Directions with , the flat directions along a valley of minima, neither grow nor shrink.
Read backwards, the inequality is a selection rule: gradient descent with step cannot settle at a minimum whose sharpness exceeds , because any small perturbation along the top eigenvector grows. A larger learning rate can only end in flatter minima. SGD's noise tightens the constraint further: a minimum stays stable under SGD only if the per-example curvatures also roughly agree (low non-uniformity), and the smaller the batch, the stricter that requirement (Wu, Ma & E, 2018; the noise itself is analyzed in Gradient Noise, Batch Size & Scaling Rules).
At a minimum the Hessian's nonzero eigenvalues are , and . What is the largest learning rate at which gradient descent can converge to it?
Show the answer
0.05
Every positive curvature needs , and the sharpest binds: . Even near that limit the flattest direction contracts by only per step, about steps per factor : the sharpest curvature sets the limit, and the ratio of the largest to the smallest sets the speed.
The edge of stability. Cohen, Kaur, Li, Kolter & Talwalkar (2021) tracked the sharpness during full-batch gradient descent across architectures and tasks. Below it tends to keep rising (progressive sharpening). Once it reaches the iterates oscillate along the top eigenvector, yet training does not diverge: the sharpness hovers at or just above , and the loss rises and falls over short timescales while decreasing over long ones. For standard CIFAR-10 networks this happened at every reasonable step size. This edge of stability contradicts the classical picture, and what pins the sharpness near is an active topic of theory. Under SGD the sharpness does not settle at a fixed value, but larger steps and smaller batches both steer training toward flatter regions.
So the learning rate limits the sharpness of the regions training can occupy, and a sharpness value means little without the learning rate that produced it or a fixed parameterization (rescaling symmetries change the Hessian without changing the function). Whether flat minima generalize better is the subject of Sharpness-Aware Minimization.
Why overparameterized networks are easy to train
Suppose a network with a smooth activation can fit its data exactly: parameters, examples with scalar targets, squared loss. The zero-loss set is cut out by equations in unknowns, and Cooper (2018) proved that for it is generically (after an arbitrarily small change to the data) empty or a smooth manifold of dimension . The global minima of an overparameterized network are not isolated points but enormous continuous families. At each of them the residuals vanish, so the Hessian is exactly the Gauss–Newton matrix : at most positive eigenvalues and at least zeros, the directions along the manifold.
Liu, Zhu & Belkin (2022) drew a sharp consequence: the manifold of solutions is curved, so the loss is not convex in any neighborhood of a global minimizer, and local-convexity arguments fail exactly where an underparameterized analysis would use them. What replaces convexity is a lower bound on the gradient.
With and , the squared gradient is a quadratic form in the tangent kernel :
So wherever , the loss satisfies the Polyak–Łojasiewicz inequality with , which Liu, Zhu & Belkin call PL*: the gradient can be small only where the loss is. is with rank at most , so this needs . Overparameterization is what makes a well-conditioned kernel possible.
On a -smooth loss a step lowers the loss by at least (the argument of Mini-Batch SGD & Momentum, without noise). PL turns that into linear convergence to zero loss, with no convexity anywhere:
The catch is that changes as the weights move. Liu, Zhu & Belkin (2022) proved that if PL* holds with constant on a ball around the initialization of radius , with a Lipschitz constant of the map from weights to outputs, then the ball contains a global minimizer and gradient descent with a small enough step converges to one linearly; and that wide enough networks satisfy PL* on such balls when their initial tangent kernel is well-conditioned. Du, Zhai, Póczos & Singh (2019) had shown this for two-layer ReLU networks with width polynomial in , by bounding how far the kernel matrix drifts. These proofs live near the lazy regime; that feature-learning networks also drive their training loss to near zero, even on random labels (The Generalization Puzzle), is observed far more widely than it is proven.
A network with parameters fits scalar targets exactly under the squared loss, and its Jacobian has full rank at the solution. How many eigenvalues of the Hessian are exactly zero there?
Show the answer
9000
has rank , so eigenvalues vanish, one for each direction of the -dimensional manifold of solutions through that point. Measured Hessians of trained classifiers show the same structure, a huge bulk of eigenvalues at or near zero (The Hessian of a Deep Network).
Key takeaways
- Near a strict saddle the offset along a negative direction grows by per step: escape time is logarithmic in the start's distance from the ridge but inversely proportional to . Random starts almost surely avoid strict saddles, perturbations make escape efficient, and high-loss critical points are believed to be mostly saddles.
- Landscapes are viewed along the line from initialization to solution, on filter-normalized random planes and on the segment between two solutions. Raw directions confuse sharpness with weight scale, and any barrier between two solutions certifies nonconvexity.
- A linearized network trains by with the neural tangent kernel . When stays fixed (infinite width in the NTK parameterization, or a large output scale) training is lazy kernel regression; practical networks learn features and do much better.
- Gradient descent can converge only to minima with ; in full-batch training the sharpness rises to about and hovers there, the edge of stability.
- With the zero-loss set is generically a -dimensional manifold with at least zero Hessian eigenvalues. If the loss satisfies PL and gradient descent converges linearly, which wide networks provably achieve near their initialization.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
At a critical point the Hessian has eigenvalues , and , and gradient descent runs with . What happens to an iterate that starts close to this point?
- It converges to the point, a local minimum, because most eigenvalues are positive
- It escapes along the negative direction, but slowly: the offset there grows by only a factor per step
- It diverges, because one eigenvalue is negative
- It escapes at once along the direction with eigenvalue
Show the answer
B. It escapes along the negative direction, but slowly: the offset there grows by only a factor per step
One negative eigenvalue makes this a strict saddle. Along it the offset grows by per step, so growing an offset of to size takes about steps: a plateau, not a trap.
Which statement describes the lazy (kernel) regime of training?
- The tangent kernel stays nearly constant, so the trained network is kernel regression on the fixed features
- The weights do not change at all during training
- The network cannot reach zero training loss
- Only networks of infinite width can be in it
Show the answer
A. The tangent kernel stays nearly constant, so the trained network is kernel regression on the fixed features
The weights move enough to fit the data but too little to change the Jacobian, so with a fixed : a kernel method, which reaches zero training loss when is positive definite.
The PL argument above bounds with . Why does it require at least as many parameters as training examples?
- Because the Hessian must be positive definite
- Because is an matrix of rank at most , so whenever
- Because gradient descent needs at least steps
- Because with fewer parameters than examples the loss would be convex
Show the answer
B. Because is an matrix of rank at most , so whenever
with , so its rank cannot exceed . With fewer parameters than equations some residual direction lies in the null space of , the bound degenerates, and zero loss is in general not even reachable.
Full-batch gradient descent runs with . Late in training you measure a sharpness , while the loss keeps decreasing, though not monotonically. What is the best interpretation?
- A bug: a sharpness above means the run must diverge within a few steps
- The minimum is flat, since is a small number
- The learning rate is too small to matter
- Training is at the edge of stability: the sharpness rose until it reached about and now hovers just above it
Show the answer
D. Training is at the edge of stability: the sharpness rose until it reached about and now hovers just above it
Cohen et al. (2021) found exactly this across architectures: progressive sharpening up to , then a long phase with the sharpness just above the threshold and a loss that oscillates over short timescales but decreases over long ones. The quadratic theory predicts divergence only on a region of fixed curvature, which this is not.
Go deeper
- Mode Connectivity & Permutation Symmetry · Low-loss paths between solutions, weight matching and linear interpolation.
- The Hessian of a Deep Network · Bulk and outliers, Gauss–Newton structure and what the spectrum reveals.
- Training in a Tiny Subspace · Intrinsic dimension, low-rank gradients and the contested claim that training lives in a tiny subspace.
Further reading
- Y. Dauphin, R. Pascanu, C. Gulcehre, K. Cho, S. Ganguli & Y. Bengio, "Identifying and attacking the saddle point problem in high-dimensional non-convex optimization," NeurIPS (2014).
- H. Li, Z. Xu, G. Taylor, C. Studer & T. Goldstein, "Visualizing the loss landscape of neural nets," NeurIPS (2018).
- L. Chizat, E. Oyallon & F. Bach, "On lazy training in differentiable programming," NeurIPS (2019).
- J. Cohen, S. Kaur, Y. Li, J. Z. Kolter & A. Talwalkar, "Gradient descent on neural networks typically occurs at the edge of stability," ICLR (2021).
- C. Liu, L. Zhu & M. Belkin, "Loss landscapes and optimization in over-parameterized non-linear systems and neural networks," Applied and Computational Harmonic Analysis (2022).