Skip to content
nonconvexcard

Newton, Quasi-Newton and Conjugate Gradient

Local quadratic convergence, the BFGS update, L-BFGS memory, and why second-order methods are rare in deep learning.

Advanced OptimizationGraduate⏱ 3 hours9 min readnewtonquasi-newtonbfgslbfgsconjugate gradient
4 problems →

Newton's method

DefinitionNewton's method
xt+1=xt−[∇2f(xt)]−1∇f(xt).x_{t+1} = x_t - \big[\nabla^2f(x_t)\big]^{-1}\nabla f(x_t).

Equivalently: minimise the second-order Taylor model of ff at xtx_t exactly, rather than the quadratic upper bound of the descent lemma.

TheoremLocal quadratic convergence

Let ff be twice differentiable with ∇2f\nabla^2f being MM-Lipschitz, and let x⋆x^\star satisfy ∇f(x⋆)=0\nabla f(x^\star)=0 and ∇2f(x⋆)⪰μI\nabla^2f(x^\star)\succeq\mu I with μ>0\mu>0. Then there is r>0r>0 such that whenever ∥xt−x⋆∥2≤r\norm{x_t-x^\star}_2\le r,

∥xt+1−x⋆∥2≤Mμ∥xt−x⋆∥22.\norm{x_{t+1}-x^\star}_2 \le \frac{M}{\mu}\norm{x_t-x^\star}_2^2 .

Key idea

Quadratic convergence means the number of correct digits doubles each step: 10−210^{-2}, 10−410^{-4}, 10−810^{-8}, 10−1610^{-16}. In the local regime Newton's method essentially terminates in five or six iterations regardless of conditioning. The hypotheses are what cost: the theorem is local, requires a nondegenerate Hessian, and says nothing about how to reach the neighbourhood.

PropositionAffine invariance

Let TT be invertible and f~(z)=f(Tz)\tilde f(z) = f(Tz). If x~t=T−1xt\tilde x_t = T^{-1}x_t then the Newton iterates of f~\tilde f from x~0\tilde x_0 satisfy x~t=T−1xt\tilde x_t = T^{-1}x_t for all tt. No such statement holds for gradient descent.

This is why no condition number appears in the Newton rate and no step size needs tuning: the method does not see the coordinate system. Everything a rescaling could break, it is immune to.

Quasi-Newton: BFGS and L-BFGS

Newton's method needs ∇2f\nabla^2 f (O(d2)O(d^2) memory) and a solve (O(d3)O(d^3) time). Quasi-Newton methods build an approximation Bt≈∇2f(xt)−1B_t \approx \nabla^2f(x_t)^{-1} from gradient differences alone.

DefinitionSecant condition

Let st=xt+1−xts_t = x_{t+1}-x_t and gt=∇f(xt+1)−∇f(xt)g_t = \nabla f(x_{t+1})-\nabla f(x_t). A curvature approximation Ht+1≈∇2fH_{t+1}\approx\nabla^2f should satisfy the secant condition Ht+1st=gtH_{t+1}s_t = g_t, which is the exact relation for a quadratic.

PropositionThe BFGS update

The BFGS update to the inverse approximation Bt≈Ht−1B_t \approx H_t^{-1} is

Bt+1=(I−stgt⊤gt⊤st)Bt(I−gtst⊤gt⊤st)+stst⊤gt⊤st.B_{t+1} = \left(I - \frac{s_tg_t^\top}{g_t^\top s_t}\right)B_t\left(I-\frac{g_ts_t^\top}{g_t^\top s_t}\right) + \frac{s_ts_t^\top}{g_t^\top s_t}.

It satisfies Bt+1gt=stB_{t+1}g_t = s_t (the secant condition in inverse form), preserves positive definiteness when gt⊤st>0g_t^\top s_t>0, and is the solution of min⁡B∥B−Bt∥W\min_B \norm{B - B_t}_W subject to B=B⊤B = B^\top and Bgt=stBg_t = s_t for a particular weighted Frobenius norm.

The variational characterisation is proved in Nocedal–Wright and is quoted here. Two consequences matter:

  • gt⊤st>0g_t^\top s_t > 0 is a curvature condition; it holds automatically for strongly convex ff and must be enforced by a line search otherwise. If it fails, the update is skipped — a detail that matters in practice.
  • Each update is a rank-two modification, so applying BtB_t costs O(d2)O(d^2) rather than O(d3)O(d^3).
Algorithm — L-BFGS two-loop recursion
  1. State. The last mm pairs (si,gi)(s_i, g_i), typically m∈[5,20]m \in [5,20]. Never form BtB_t.
  2. First loop (newest to oldest): q←∇f(xt)q \leftarrow \nabla f(x_t); for each ii, set αi=ρisi⊤q\alpha_i = \rho_i s_i^\top q with ρi=1/(gi⊤si)\rho_i = 1/(g_i^\top s_i), then q←q−αigiq \leftarrow q - \alpha_i g_i.
  3. Scale. r←γqr \leftarrow \gamma q with γ=(slast⊤glast)/(glast⊤glast)\gamma = (s_{\text{last}}^\top g_{\text{last}})/(g_{\text{last}}^\top g_{\text{last}}).
  4. Second loop (oldest to newest): β=ρigi⊤r\beta = \rho_i g_i^\top r, then r←r+(αi−β)sir \leftarrow r + (\alpha_i - \beta)s_i.
  5. Return −r-r as the search direction; take a line search along it.

Cost per iteration: O(md)O(md) time and memory. That is the whole reason L-BFGS is the default general-purpose optimiser for smooth deterministic problems of moderate size.

Conjugate gradient

TheoremConjugate gradient minimises over Krylov subspaces

For f(x)=12x⊤Ax−b⊤xf(x) = \tfrac12x^\top Ax - b^\top x with A≻0A\succ0, the conjugate gradient iterates satisfy

xt=arg min⁡{f(x):x∈x0+span⁡{r0,Ar0,…,At−1r0}},r0=b−Ax0,x_t = \argmin\Big\{f(x) : x \in x_0 + \operatorname{span}\{r_0, Ar_0,\dots,A^{t-1}r_0\}\Big\}, \qquad r_0 = b - Ax_0,

and consequently

∥xt−x⋆∥A∥x0−x⋆∥A≤2(κ−1κ+1)t,\frac{\norm{x_t-x^\star}_A}{\norm{x_0-x^\star}_A} \le 2\left(\frac{\sqrt\kappa-1}{\sqrt\kappa+1}\right)^t ,

with exact termination at t=dt = d in exact arithmetic, and at t=t = (number of distinct eigenvalues) in general.

Quoted from Nocedal–Wright / Trefethen–Bau. Note the rate is the same κ\sqrt\kappa as acceleration — and for good reason: CG solves the optimal-polynomial problem exactly, adaptively, and acceleration solves it with a fixed schedule. CG is the accelerated method for quadratics; Nesterov's contribution was extending the rate to general convex functions.

Why these are rare in deep learning

Empirical observationSecond-order methods are rarely used at scale

Empirical observation — a regularity seen in experiments. No theorem on this page establishes it in general.

Adam and SGD with momentum dominate deep learning; L-BFGS and Newton-type methods do not, despite their superior rates on the problems where those rates apply.

What this does not say

The reasons are specific, and none of them is "second-order methods do not work":

  1. Cost. d∼109d \sim 10^9 makes O(d2)O(d^2) memory impossible. L-BFGS's O(md)O(md) is affordable, so cost alone is not decisive.
  2. Stochasticity. L-BFGS's curvature pairs (st,gt)(s_t, g_t) are built from gradient differences. With mini-batch gradients, the difference of two noisy gradients is dominated by noise unless the batch is large, and the secant condition becomes meaningless. This is the binding obstacle.
  3. The local regime never arrives. Newton's quadratic convergence is a statement about a neighbourhood of a nondegenerate minimiser. Deep networks are trained for a fixed budget and stopped far from any such point; the Hessian at the stopping point is typically singular, with a large number of near-zero eigenvalues.
  4. Non-convexity. Where the Hessian is indefinite the Newton step can point uphill. Trust-region and cubic-regularised variants fix this in theory and are the subject of active research; they are not yet competitive at scale.

Hessian-free and Kronecker-factored (K-FAC) methods are serious attempts to get second-order information cheaply, and they do help on some problems. The honest summary is that the question is open in practice and the theory does not currently favour either side.

Problems

Local quadratic convergence of Newton's methodProof · Advanced · 1 hour Newton's method is affine invariantProof · Intermediate · 30 min Conjugate gradient and Krylov optimalityProof · Advanced · 1 hour The BFGS update satisfies the secant conditionProof · Advanced · 30 min

References

  • BookJorge Nocedal and Stephen J. Wright (2006). Numerical OptimizationThe standard reference for everything on this page, with full proofs of the quasi-Newton and trust-region theory.
  • BookStephen Boyd and Lieven Vandenberghe (2004). Convex OptimizationChapters 9–11 for Newton's method, self-concordance and interior-point methods.
  • PaperJames Martens (2010). Deep learning via Hessian-free optimization

These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.

Results stated on this page

Problems (4)

All problems

Papers that use this mathematics