Simple Algorithm
Machine Learning · Convergence · 28 min

Nonconvex Optimization & Saddle Points

Stationary points, escaping saddles and benign landscapes.

Finding the global minimum of a general nonconvex function is hopeless, and even certifying that a point is a local minimum can be NP-hard. Yet gradient methods train nonconvex models every day. This lesson makes precise what they can promise: gradient descent almost never converges to a strict saddle, a little noise makes escaping saddles efficient, and some important nonconvex problems have no spurious local minima at all.

What you’ll learn

  • Define first- and second-order stationarity, strict saddles and approximate second-order stationary points, and explain why local optimality is hard to certify in general.
  • Prove, via the stable manifold theorem, that gradient descent from a random start converges to a strict saddle with probability zero, and explain why that alone does not make it fast.
  • Estimate the time to escape a strict saddle from a random perturbation, and state the guarantee of perturbed gradient descent.
  • Prove that 14∥uu⊤−M∥F2\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2 has no spurious local minima, and survey which landscapes are benign and which are not.

What a local method can promise

Stationary pointHessianExample at 0\mathbf 0
strict local minimum≻0\succ0x2+y2x^2+y^2
strict saddlesome eigenvalue <0<0x2−y2x^2-y^2, or the saddle x2+y44−y22x^2+\tfrac{y^4}4-\tfrac{y^2}2
degenerate: minimum⪰0\succeq0, singularx2+y4x^2+y^4
degenerate: saddle⪰0\succeq0, singularx2+y3x^2+y^3, or the monkey saddle x3−3xy2x^3-3xy^2 (Hessian 00)
When the Hessian is singular, second-order information cannot tell a minimum from a saddle: x2+y4x^2+y^4 and x2+y3x^2+y^3 have the same Hessian, diag⁡(2,0)\operatorname{diag}(2,0), at the origin.

Certifying local optimality is hard. Murty & Kabadi (1987) built indefinite quadratic programs with simple constraints and integer data for which checking that a given feasible point is not a local minimum is NP-complete; as a corollary, deciding that a matrix is not copositive is NP-complete. The difficulty survives without constraints: substituting xi=yi2x_i=y_i^2 turns min⁡{x⊤Dx:x≥0}\min\{\mathbf x^\top D\mathbf x:\mathbf x\ge\mathbf 0\} into the quartic q(y)=∑ijDijyi2yj2q(\mathbf y)=\sum_{ij}D_{ij}y_i^2y_j^2, and 0\mathbf 0 is a local minimum of qq exactly when DD is copositive. Degenerate points are where the hardness lives.

So the realistic goal of a local method is a second-order stationary point. That is worth having only when such points are good, which is the theme of the last step.

Check your understanding

At a stationary point of a smooth f(x,y)f(x,y) the gradient is zero and the Hessian is diag⁡(2,0)\operatorname{diag}(2,0). What can you conclude?

  1. It is a strict local minimum
  2. It is a strict saddle
  3. Nothing yet: it could be a local minimum or a saddle, depending on higher-order terms
  4. It must be a local maximum
Show the answer

C. Nothing yet: it could be a local minimum or a saddle, depending on higher-order terms

The second-order necessary condition holds (∇2f⪰0\nabla^2f\succeq0), but the sufficient one fails (the Hessian is singular). x2+y4x^2+y^4 has a minimum there, x2+y3x^2+y^3 and x2−y4x^2-y^4 have saddles, and all three have this Hessian.

Gradient descent avoids strict saddles

DerivationProof sketch
  1. ∥g(x)−g(y)∥ ≥ ∥x−y∥−η∥∇f(x)−∇f(y)∥ ≥ (1−ηL)∥x−y∥\norm{g(\mathbf x)-g(\mathbf y)}\ \ge\ \norm{\mathbf x-\mathbf y}-\eta\norm{\nabla f(\mathbf x)-\nabla f(\mathbf y)}\ \ge\ (1-\eta L)\norm{\mathbf x-\mathbf y}

    The gradient map g(x)=x−η∇f(x)g(\mathbf x)=\mathbf x-\eta\nabla f(\mathbf x) is a diffeomorphism. Its Jacobian I−η∇2f(x)I-\eta\nabla^2f(\mathbf x) has all eigenvalues at least 1−ηL>01-\eta L>0, and gg is injective:

  2. Dg(x⋆)=I−η∇2f(x⋆),λmax⁡(Dg(x⋆))=1−ηλmin⁡(∇2f(x⋆))>1Dg(\mathbf x^\star)=I-\eta\nabla^2f(\mathbf x^\star),\qquad\lambda_{\max}\big(Dg(\mathbf x^\star)\big)=1-\eta\lambda_{\min}\big(\nabla^2f(\mathbf x^\star)\big)>1

    At a strict saddle, the Jacobian has an eigenvalue 1+η∣λmin⁡∣>11+\eta\abs{\lambda_{\min}}>1: the fixed point x⋆\mathbf x^\star of gg is unstable along at least one direction.

  3. {x near x⋆: gk(x) stays near x⋆ ∀k}⊆W,dim⁡W≤d−1\big\{\mathbf x\ \text{near}\ \mathbf x^\star:\ g^k(\mathbf x)\ \text{stays near}\ \mathbf x^\star\ \forall k\big\}\subseteq W,\qquad\dim W\le d-1

    The center–stable manifold theorem: the points near x⋆\mathbf x^\star whose forward orbits stay near x⋆\mathbf x^\star lie on a local manifold WW of dimension at most d−1d-1, a set of Lebesgue measure zero.

  4. {x0: xt→x⋆} ⊆ ⋃k≥0g−k(W)has measure zero\{\mathbf x_0:\ \mathbf x_t\to\mathbf x^\star\}\ \subseteq\ \bigcup_{k\ge0}g^{-k}(W)\quad\text{has measure zero}

    An orbit that converges to x⋆\mathbf x^\star eventually stays near it, so it enters WW after finitely many steps. Preimages under a diffeomorphism of a null set are null, and a countable union of null sets is null. ■\blacksquare

Escaping saddles efficiently

DerivationHow long does escaping take? (a heuristic calculation)
  1. ut+1=(1+ηγ) ut⟹∣ut∣=(1+ηγ)t∣u0∣u_{t+1}=(1+\eta\gamma)\,u_t\qquad\Longrightarrow\qquad\abs{u_t}=(1+\eta\gamma)^t\abs{u_0}

    Near a strict saddle, ff is close to its quadratic model. Let v\mathbf v be the eigenvector of the most negative eigenvalue −γ-\gamma. The component of xt−x⋆\mathbf x_t-\mathbf x^\star along v\mathbf v grows geometrically:

  2. tescape≈ln⁡(R/r0)ln⁡(1+ηγ)≈ln⁡(R/r0)ηγt_{\text{escape}}\approx\frac{\ln(R/r_0)}{\ln(1+\eta\gamma)}\approx\frac{\ln(R/r_0)}{\eta\gamma}

    Escaping to distance RR from an initial offset r0r_0 therefore takes a number of steps that is only logarithmic in 1/r01/r_0:

  3. tescape≲1ηγ ln⁡Rdδ rt_{\text{escape}}\lesssim\frac{1}{\eta\gamma}\,\ln\frac{R\sqrt d}{\delta\,r}

    A uniformly random perturbation of radius rr in Rd\R^d has a component along v\mathbf v of typical size r/dr/\sqrt d; the probability that it is smaller than δr/d\delta r/\sqrt d is of order δ\delta. So with probability about 1−δ1-\delta the escape time is

  4. The dimension and the failure probability enter only through a logarithm. Bad starting points form a thin slab around the stable manifold, and a random kick lands in it only with small probability.

Predict before you look

A strict saddle has most negative eigenvalue −γ=−0.01-\gamma=-0.01, the step is η=0.1\eta=0.1, and a perturbation leaves you 10−610^{-6} from the stable manifold. About how many steps until the escaping component reaches 11?

Show the answer

13800 steps

ln⁡(106)/ln⁡(1+0.001)≈13.82/0.0009995≈13,800\ln(10^6)/\ln(1+0.001)\approx13.82/0.0009995\approx13{,}800. Weak negative curvature, not bad luck, is what makes saddles slow: each factor of 10 closer to the manifold costs only ln⁡10/0.001≈2,300\ln10/0.001\approx2{,}300 more steps, but halving γ\gamma doubles everything.

Stochastic gradients bring their own perturbations: Ge et al. (2015) proved that noisy SGD escapes strict saddles and reaches a local minimum in polynomially many iterations for strict-saddle functions, with orthogonal tensor decomposition as the application. Second-order methods can use negative curvature directly: Newton's method with cubic regularization (Nesterov & Polyak, 2006) finds approximate second-order stationary points in O(ε−3/2)\order{\varepsilon^{-3/2}} iterations, each needing Hessian information.

Benign landscapes

If every local minimum of ff is global and every other stationary point is a strict saddle, then "find a second-order stationary point", which perturbed gradient descent does efficiently, means "find a global minimum". The prototype is principal component analysis written as a nonconvex factorization problem. Let MM be symmetric positive semidefinite with eigenvalues λ1>λ2≥⋯≥λd≥0\lambda_1>\lambda_2\ge\dots\ge\lambda_d\ge0 and orthonormal eigenvectors vi\mathbf v_i, and minimize over u∈Rd\mathbf u\in\R^d

f(u)=14∥uu⊤−M∥F2=14(∥u∥4−2 u⊤Mu+∥M∥F2)f(\mathbf u)=\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2=\tfrac14\big(\norm{\mathbf u}^4-2\,\mathbf u^\top M\mathbf u+\norm{M}_F^2\big)
DerivationEvery local minimum is global; every other stationary point is a strict saddle
  1. ∇f(u)=∥u∥2u−Mu,∇2f(u)=∥u∥2I+2 uu⊤−M\nabla f(\mathbf u)=\norm{\mathbf u}^2\mathbf u-M\mathbf u,\qquad\nabla^2f(\mathbf u)=\norm{\mathbf u}^2I+2\,\mathbf u\mathbf u^\top-M

    Differentiate. Stationary points satisfy Mu=∥u∥2uM\mathbf u=\norm{\mathbf u}^2\mathbf u, so u=0\mathbf u=\mathbf 0 or u\mathbf u is an eigenvector with ∥u∥2\norm{\mathbf u}^2 equal to its eigenvalue: u=±λi vi\mathbf u=\pm\sqrt{\lambda_i}\,\mathbf v_i for λi>0\lambda_i>0.

  2. v1⊤∇2f(λivi)v1=λi−λ1<0,v1⊤∇2f(0)v1=−λ1<0\mathbf v_1^\top\nabla^2f\big(\sqrt{\lambda_i}\mathbf v_i\big)\mathbf v_1=\lambda_i-\lambda_1<0,\qquad\mathbf v_1^\top\nabla^2f(\mathbf 0)\mathbf v_1=-\lambda_1<0

    At u=±λivi\mathbf u=\pm\sqrt{\lambda_i}\mathbf v_i with i≥2i\ge2, look along v1\mathbf v_1 (orthogonal to u\mathbf u): negative curvature, a strict saddle. At u=0\mathbf u=\mathbf 0 the Hessian is −M-M, negative along v1\mathbf v_1: also strict.

  3. ∇2f(λ1v1)=λ1I+2λ1v1v1⊤−M ≻ 0\nabla^2f\big(\sqrt{\lambda_1}\mathbf v_1\big)=\lambda_1I+2\lambda_1\mathbf v_1\mathbf v_1^\top-M\ \succ\ 0

    At u=±λ1v1\mathbf u=\pm\sqrt{\lambda_1}\mathbf v_1 the Hessian has eigenvalue 2λ12\lambda_1 along v1\mathbf v_1 and λ1−λj>0\lambda_1-\lambda_j>0 along each other vj\mathbf v_j: strict local minima.

  4. Their value is the smallest of all stationary values, f(±λivi)=14∑j≠iλj2f(\pm\sqrt{\lambda_i}\mathbf v_i)=\tfrac14\sum_{j\ne i}\lambda_j^2, minimized at i=1i=1: the best rank-one approximation of MM (Eckart–Young). Since f→∞f\to\infty as ∥u∥→∞\norm{\mathbf u}\to\infty, the global minimum is a stationary point, so these are the global minima. ■\blacksquare

Predict before you look

For f(u)=14∥uu⊤−M∥F2f(\mathbf u)=\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2 with M=diag⁡(3,1)M=\operatorname{diag}(3,1), the point u=(0,1)\mathbf u=(0,1) is stationary. What is the smallest eigenvalue of the Hessian there?

Show the answer

-2

∇2f=∥u∥2I+2uu⊤−M=I+diag⁡(0,2)−diag⁡(3,1)=diag⁡(−2, 2)\nabla^2f=\norm{\mathbf u}^2I+2\mathbf u\mathbf u^\top-M=I+\operatorname{diag}(0,2)-\operatorname{diag}(3,1)=\operatorname{diag}(-2,\,2). The eigenvalue λ2−λ1=−2\lambda_2-\lambda_1=-2 points toward the global minimizers (±3,0)(\pm\sqrt3,0), so this is a strict saddle that gradient descent escapes.

ProblemLandscapeSource
Linear autoencoder (PCA) with squared errorall local minima global; other critical points saddlesBaldi & Hornik (1989)
PSD matrix completion, regularized, incoherent target, enough random entriesw.h.p. every local minimum is globalGe, Lee & Ma (2016)
Deep linear networks, squared lossevery local minimum global; every other critical point a saddle, but with more than one hidden layer some saddles have no negative curvatureKawaguchi (2016)
Two-layer ReLU networks fitted to a target network of the same form (6 to 20 hidden units)in high input dimension, nearly all targets of the relevant sizes give spurious local minimaSafran & Shamir (2018)
Benign results need structure: symmetry, incoherence, enough data, or linearity. Kawaguchi's non-strict saddles fall outside the saddle-escape theorems, and nonlinear networks can have genuinely bad minima; overparameterization, initialization and noise are part of why training succeeds anyway.

Frontier

The global picture that emerges: in nonconvex optimization, gradient descent is guaranteed a stationary point at the 1/T1/T rate, generically a second-order one, efficiently one with a little noise, and a global minimum only when the landscape is benign. Whether training succeeds is then a property of the problem, often helped by overparameterization, as much as of the algorithm. The Initialization lesson's heuristic, that a flat point in high dimension usually has some downhill direction, is why the saddle-escape results of this lesson matter so much in practice.

Key takeaways

  • Local methods aim for second-order stationary points: ∇f=0\nabla f=\mathbf 0 and ∇2f⪰0\nabla^2f\succeq0, or approximately ∥∇f∥≤ε\norm{\nabla f}\le\varepsilon and λmin⁡≥−ρε\lambda_{\min}\ge-\sqrt{\rho\varepsilon}. Degenerate points are where certifying local optimality becomes NP-hard.
  • For C2C^2, LL-smooth ff and η<1/L\eta<1/L, gradient descent from a random start converges to a strict saddle with probability zero, because the gradient map is a diffeomorphism and stable manifolds are null sets. This says nothing about speed.
  • The escaping component grows like (1+ηγ)t(1+\eta\gamma)^t, so random perturbations escape in O(log⁡(d/δ)/(ηγ))\order{\log(d/\delta)/(\eta\gamma)} steps. Perturbed gradient descent finds ε\varepsilon-second-order points in O~(ℓΔf/ε2)\tilde{\mathcal O}(\ell\Delta_f/\varepsilon^2) iterations.
  • Benign landscapes, where second-order stationary means globally optimal, include PCA as 14∥uu⊤−M∥F2\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2, linear autoencoders and regularized matrix completion; deep linear networks have non-strict saddles, and ReLU networks can have spurious minima.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Gradient descent with step η<1/L\eta<1/L starts from a Gaussian random point on a C2C^2, LL-smooth function whose saddle points are all strict and countably many. What is guaranteed?

  1. It reaches a global minimum
  2. With probability 1 it does not converge to a saddle point; if it converges, the limit is almost surely a local minimizer
  3. It escapes every saddle within a number of steps polynomial in the dimension
  4. It converges to a local minimizer for every starting point
Show the answer

B. With probability 1 it does not converge to a saddle point; if it converges, the limit is almost surely a local minimizer

That is the Lee–Simchowitz–Jordan–Recht theorem. The bad starts form a measure-zero set (preimages of stable manifolds), but nothing is said about speed, nor that the iterates converge at all.

Question 2

Why does the time to escape a strict saddle grow only logarithmically as the starting offset from the stable manifold shrinks?

  1. Because the gradient is large near a saddle
  2. Because the offset along the negative-curvature direction grows geometrically, by 1+ηγ1+\eta\gamma per step
  3. Because the Hessian is singular at a strict saddle
  4. Because a small learning rate makes each step more accurate
Show the answer

B. Because the offset along the negative-curvature direction grows geometrically, by 1+ηγ1+\eta\gamma per step

The escaping component multiplies by 1+ηγ1+\eta\gamma every step, so going from r0r_0 to RR takes ln⁡(R/r0)/ln⁡(1+ηγ)\ln(R/r_0)/\ln(1+\eta\gamma) steps: each halving of r0r_0 costs the same constant number of extra steps.

Question 3

Which of these landscapes is benign: every local minimum global and every other stationary point a strict saddle?

  1. 14∥uu⊤−M∥F2\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2 for symmetric PSD MM with λ1>λ2\lambda_1>\lambda_2
  2. The squared loss of a deep linear network with three hidden layers
  3. The squared loss of a small two-layer ReLU network fitted to a target network of the same form
  4. A general indefinite quadratic over the nonnegative orthant
Show the answer

A. 14∥uu⊤−M∥F2\tfrac14\norm{\mathbf u\mathbf u^\top-M}_F^2 for symmetric PSD MM with λ1>λ2\lambda_1>\lambda_2

Its stationary points are 0\mathbf 0 and ±λivi\pm\sqrt{\lambda_i}\mathbf v_i; all but ±λ1v1\pm\sqrt{\lambda_1}\mathbf v_1 have the negative-curvature direction v1\mathbf v_1, and those two are global minima.

Further reading

  • J. D. Lee, M. Simchowitz, M. I. Jordan & B. Recht, "Gradient descent only converges to minimizers," Proceedings of the 29th Conference on Learning Theory, PMLR 49, 1246–1257 (2016).
  • R. Ge, F. Huang, C. Jin & Y. Yuan, "Escaping from saddle points — online stochastic gradient for tensor decomposition," Proceedings of the 28th Conference on Learning Theory, PMLR 40, 797–842 (2015).
  • C. Jin, R. Ge, P. Netrapalli, S. M. Kakade & M. I. Jordan, "How to escape saddle points efficiently," Proceedings of the 34th ICML, PMLR 70, 1724–1732 (2017).
  • R. Ge, J. D. Lee & T. Ma, "Matrix completion has no spurious local minimum," Advances in Neural Information Processing Systems 29 (2016).
  • P. Jain & P. Kar, "Non-convex optimization for machine learning," Foundations and Trends in Machine Learning 10(3–4), 142–336 (2017).