Machine Learning · Optimization

Escaping Saddle Points in Nonconvex Optimization

Why a vanishing gradient is not evidence of a minimum in high dimensions, how negative curvature is detected and followed, and what the escape guarantees cost per iteration.

For a convex objective, a small gradient is a certificate: the iterate is close to the optimum, and the distance can be bounded by the gradient norm and the strong convexity constant. For a nonconvex objective, a small gradient certifies almost nothing. The point can be a local minimum, a local maximum, or a saddle, and in high dimension saddles are overwhelmingly more common than either. This is the reason nonconvex optimization has a separate subfield devoted to the geometry of stationary points, and why second-order information enters the analysis even in methods that never form a Hessian.

Why vanishing gradients say so little

Consider a smooth function on R^d and ask what a critical point looks like when the function is generic. The Hessian at a critical point has d eigenvalues, and each is positive or negative with roughly equal probability under the symmetry of a random landscape. The probability that all d are positive is on the order of 2⁻ᵈ, so local minima are exponentially rare among critical points, while the count of saddles with exactly one negative eigenvalue grows rapidly with d. A gradient-based method that stops when ‖∇f‖ ≤ ε therefore stops, with overwhelming probability, at a saddle.

The practical version of this statement is about plateaus. Near a saddle whose negative eigenvalue is small in magnitude, the function is almost flat along the descending direction, so gradient descent makes progress proportional to that eigenvalue; the iterate can linger in the neighbourhood for a long time while the gradient norm is small and the loss is barely changing. Nothing in the trajectory distinguishes this from convergence, which is why training curves that plateau and then resume descending are common in deep learning and why the diagnosis usually requires looking at the curvature rather than the loss.

Negative curvature as the object to detect

The formal condition that excludes saddles is second-order stationarity: ‖∇f(x)‖ ≤ ε and λ_min(∇²f(x)) ≥ −√ε. A point satisfying both is approximately a local minimum. The gap between first-order and second-order stationarity is the negative curvature λ_min < 0, and a descent direction is available along the corresponding eigenvector: the directional second derivative is negative, so a small step in either direction along that eigenvector decreases the function, regardless of the gradient.

The strict saddle property names the well-behaved case: every point that is not a local minimum has a strictly negative Hessian eigenvalue, so there is no flat region where a first-order method can be trapped indefinitely by a vanishing gradient. Functions with this property admit first-order methods that reach approximate second-order stationarity in polynomial time, and the polynomial is mild in the dimension. The condition is not automatic; objectives with degenerate valleys violate it, and so do objectives where the negative curvature appears only at scales larger than the step size.

Perturbation as the escape mechanism

Gradient descent can escape a strict saddle without ever computing a Hessian, provided it is perturbed. The scheme is: run ordinary gradient descent, and when the gradient norm falls below a threshold and the iterate has not been perturbed recently, add a random vector of norm proportional to the threshold and continue. The analysis shows that the perturbed iterate leaves the neighbourhood of the saddle within a number of iterations that scales as the inverse square of the curvature magnitude and only logarithmically in the dimension; the logarithm comes from the probability that a random direction has a useful component along the negative eigenvector, which for a uniformly random direction in R^d is small but not exponentially small. The overall iteration complexity to reach an ε-second-order stationary point in the perturbed scheme is polynomial in 1/ε and polylogarithmic in d, which is the same dependence on the dimension as ordinary gradient descent’s first-order guarantee.

Two implementation details carry the correctness of the argument. The perturbation magnitude must be comparable to the gradient-norm threshold that triggers it, since a perturbation much smaller than the gradient noise level is absorbed without effect and one much larger jumps out of the local quadratic region. And the trigger must be episodic rather than continuous: perturbing every iteration converts the method into stochastic gradient descent with a large constant noise floor, while perturbing once and then letting the deterministic descent reduce the gradient again is what produces escape.

When stochastic noise is too isotropic to help

Stochastic gradients are a natural source of perturbation, and it is tempting to conclude that noise alone escapes saddles. The published analysis of the stochastic case shows a sharper condition. If the noise is isotropic with variance much smaller than the curvature scale, the iterates spend an exponentially long time near the saddle: the same logarithmic-in-dimension argument that gives the perturbed method its speed requires the noise magnitude to be at least on the order of the curvature it is trying to escape, and the escape probability per step falls when it is not. In practice the gradient noise of a mini-batch is neither isotropic nor controlled, and its magnitude changes during training, so a stochastic run that plateaus may be at a saddle whose curvature exceeds the current noise level, or at a genuine flat region, and the two are not distinguishable from the loss alone. Increasing the batch size reduces the noise that would otherwise provide the escape, which is the mechanism behind the observation, consistent with the batch-size analysis of gradient noise and batch size, that very large batches can be harder to train out of plateaus than small ones.

Cubic regularisation and the cost of second-order guarantees

Second-order methods replace the perturbation argument with an explicit curvature model. The cubic-regularised Newton method minimises f(x) + ∇f(x)ᵀp + ½pᵀ∇²f(x)p + (M/6)‖p‖³ over the step p, with M a bound on the Lipschitz constant of the Hessian. The cubic term makes the subproblem globally solvable even when the quadratic term is indefinite, and the method finds an ε-second-order stationary point in O(ε^{-3/2}) iterations, which is the known worst-case bound and is optimal in that class. Trust-region methods achieve similar guarantees by constraining ‖p‖ ≤ Δ and shrinking the radius when the model proves inaccurate; the trust-region size discussed in step sizes and the descent lemma plays the same role as the cubic coefficient here.

Neither method requires the Hessian as a matrix. Both require products of the Hessian with a vector, and for a scalar objective a Hessian-vector product costs about the same as a gradient: one additional pass over the computation graph with a different initialisation of the backward recurrence. That makes the smallest eigenvalue accessible through iterative methods: a few iterations of Lanczos or the power method on the shifted Hessian suffice to detect strong negative curvature, and the resulting approximate eigenvector supplies the escape direction when the gradient alone is uninformative. The detect-and-escape family of algorithms formalises this: run first-order steps while the gradient is large, and when it is small, run a small number of Hessian-vector products to check the curvature, escaping along the computed direction if it is sufficiently negative and declaring convergence if it is not. Methods without any curvature access, such as the per-coordinate approximations of adaptive step sizes, have no corresponding detector: their preconditioner is a diagonal built from gradient history, which cannot distinguish a shallow valley from a saddle whose negative curvature lies in a direction the diagonal does not represent.

def f(x):                                  # a concrete smooth objective
    return 0.5 * sum((xi - 1.0) ** 2 for xi in x) + (x[0] * x[1]) ** 2

def grad_f(x, h=1e-6):                     # central differences, one coordinate at a time
    g = []
    for i in range(len(x)):
        xp, xm = list(x), list(x)
        xp[i] += h
        xm[i] -= h
        g.append((f(xp) - f(xm)) / (2 * h))
    return g

def hvp(x, v, h=1e-5):
    """Finite-difference Hessian-vector product; reverse-mode autodiff gives it exactly."""
    g1 = grad_f([xi + h * vi for xi, vi in zip(x, v)], h)
    g0 = grad_f(x, h)
    return [(a - b) / h for a, b in zip(g1, g0)]

What the guarantees do and do not cover

The escape results cover the path to second-order stationarity. They say nothing about the quality of the point reached: an approximate local minimum of a nonconvex objective may have a much worse value than the global optimum, and nothing in the analysis bounds the gap. They also say nothing about how the total time to a good solution compares with a first-order run that never encounters a problematic saddle, and in the absence of negative curvature, curvature detection and cubic subproblem solves are pure overhead. The regime where second-order machinery is decisive is specific: objectives with many strict saddles whose curvature exceeds the noise level, where first-order methods stall for long periods. That regime is common in matrix and tensor decomposition problems, and it is the setting in which the tensor-decomposition escape analyses were first formulated. In large network training the evidence is mixed and problem-dependent, and the practical recipe that survives most of the time is a first-order method with a perturbation mechanism whose magnitude is tied to the batch size and the loss scale, an arrangement whose effectiveness rests on the analysis above but whose constants are chosen empirically rather than derived.

References

  1. How to Escape Saddle Points Efficiently — Jin, Ge, Netrapalli, Kakade & Jordan, ICML 2017
  2. Escaping From Saddle Points -- Online Stochastic Gradient for Tensor Decomposition — Ge, Huang, Jin & Yuan, COLT 2015
  3. Cubic regularization of Newton method and its global performance — Nesterov & Polyak, Mathematical Programming, 2006
  4. Fast Exact Multiplication by the Hessian — Barak Pearlmutter, Neural Computation, 1994