Curvature Methods: Newton, Quasi-Newton, and Trust Regions

Dive into Deep Learning · §35.2

Curvature Methods: Newton, Quasi-Newton, and Trust Regions
Newton’s step · affine invariance · quadratic convergence · BFGS · trust-region subproblem

Respecting Curvature vs. Modeling Curvature

Motivation

On f(\mathbf{x}) = \tfrac12(x_1^2 + 1000\,x_2^2) from (1, 1), modeling curvature transforms the iteration count:

  • Gradient Descent (6{,}908 steps): Uses a single scalar ceiling L = 1000, so the steep axis caps \eta < 2/L while the flat axis crawls.
  • Heavy-Ball Momentum (315 steps): Uses \mu = 1, L = 1000 to equalize mode decay to \sqrt{\kappa}.
  • Newton’s Method (1 step): Uses the full Hessian \nabla^2 f = \mathrm{diag}(1, 1000) to rescale each coordinate by its exact curvature.

The Second-Order Taylor Model and Newton Step

Newton’s Method

Newton’s method minimizes the local quadratic Taylor approximation m_k(\mathbf{p}) around \mathbf{x}_k:

m_k(\mathbf{p}) = f(\mathbf{x}_k) + \mathbf{g}_k^\top \mathbf{p} + \tfrac12\,\mathbf{p}^\top \nabla^2 f(\mathbf{x}_k)\,\mathbf{p}

  • Unique bowl minimum: When \nabla^2 f(\mathbf{x}_k) \succ \mathbf{0}, setting \nabla m_k(\mathbf{p}) = \mathbf{0} yields \mathbf{x}_{k+1} = \mathbf{x}_k - (\nabla^2 f(\mathbf{x}_k))^{-1}\nabla f(\mathbf{x}_k).
  • Natural unit step: The inverse Hessian automatically sets both the direction and the physical units of the step (\eta = 1).

Preconditioned Steepest Descent and Geometry

Newton’s Method

For any symmetric positive-definite preconditioner \mathbf{P} \succ \mathbf{0}, the step \mathbf{d} = -\mathbf{P}^{-1}\nabla f(\mathbf{x}) is steepest descent in the Mahalanobis norm \|\mathbf{d}\|_{\mathbf{P}} = \sqrt{\mathbf{d}^\top \mathbf{P}\mathbf{d}}:

\nabla f(\mathbf{x})^\top \mathbf{d} = -\nabla f(\mathbf{x})^\top \mathbf{P}^{-1}\nabla f(\mathbf{x}) < 0

  • Unifies optimization families: \mathbf{P} = \mathbf{I} recovers GD; diagonal \mathbf{P} gives AdaGrad/Adam; \mathbf{P} = \nabla^2 f(\mathbf{x}_k) gives Newton’s method.

Affine Invariance Eliminates the Condition Number

Newton’s Method

Under any invertible coordinate change \mathbf{x} = \mathbf{T}\mathbf{y} with h(\mathbf{y}) = f(\mathbf{T}\mathbf{y}), the gradient and Hessian transform as \nabla h = \mathbf{T}^\top \nabla f and \nabla^2 h = \mathbf{T}^\top \nabla^2 f\,\mathbf{T}, so:

\mathbf{T}\mathbf{y}_{k+1} = \mathbf{x}_k - \big(\nabla^2 f(\mathbf{x}_k)\big)^{-1}\nabla f(\mathbf{x}_k) = \mathbf{x}_{k+1}

  • Complete \kappa-invariance: Because \mathbf{T} = \mathbf{A}^{-1/2} maps any elongated quadratic valley \tfrac12\mathbf{x}^\top\mathbf{A}\mathbf{x} into an isotropic sphere (\kappa = 1), Newton’s trajectory is completely blind to the condition number.

Local Quadratic Convergence: Error Decomposition

Convergence Proof

Near a non-quadratic minimizer \mathbf{x}^\star where \nabla f(\mathbf{x}^\star) = \mathbf{0}, how rapidly does the error \mathbf{e}_k = \mathbf{x}_k - \mathbf{x}^\star shrink?

  • Step 1: Express the new error via the Hessian at \mathbf{x}_k: Subtract \mathbf{x}^\star from the Newton update and factor out (\nabla^2 f_k)^{-1}: \mathbf{e}_{k+1} = \mathbf{e}_k - (\nabla^2 f_k)^{-1}\mathbf{g}_k = (\nabla^2 f_k)^{-1}\Big[\nabla^2 f_k\,\mathbf{e}_k - \big(\nabla f(\mathbf{x}_k) - \nabla f(\mathbf{x}^\star)\big)\Big]
  • Step 2: Apply the fundamental theorem of calculus: Write the gradient difference as an integral of the Hessian along the segment \mathbf{x}^\star + t\mathbf{e}_k: \nabla f(\mathbf{x}_k) - \nabla f(\mathbf{x}^\star) = \int_0^1 \nabla^2 f(\mathbf{x}^\star + t\mathbf{e}_k)\,\mathbf{e}_k\,dt
  • Step 3: Combine inside the integral: The bracketed residual is \int_0^1 \big[\nabla^2 f(\mathbf{x}_k) - \nabla^2 f(\mathbf{x}^\star + t\mathbf{e}_k)\big]\mathbf{e}_k\,dt.

Local Quadratic Convergence: Doubling Digits

Convergence Proof

When \nabla^2 f(\mathbf{x}) \succeq \mu\mathbf{I} and \nabla^2 f is L_2-Lipschitz near \mathbf{x}^\star, the integral residual is at most \tfrac{L_2}{2}\|\mathbf{e}_k\|^2:

\|\mathbf{e}_{k+1}\| \le \frac{L_2}{2\mu}\,\|\mathbf{e}_k\|^2

  • Doubling accurate digits: Once the scaled error \frac{L_2}{2\mu}\|\mathbf{e}_k\| < 10^{-1}, each Newton step squares the error (10^{-1} \to 10^{-2} \to 10^{-4} \to 10^{-8} \to 10^{-16}).
  • Damped Newton: Far from \mathbf{x}^\star, Armijo backtracking along \mathbf{p}_k ensures descent and automatically accepts \alpha_k = 1 near \mathbf{x}^\star.

Newton’s Method on Valleys and Logistic Loss

Empirical Verification

We test Newton’s method on the \kappa = 1000 quadratic \mathrm{diag}(1, 1000) and on \ell_2-regularized logistic regression (n = 200 examples, d = 5 weights, \nu = 0.1):

Newton on the quadratic: |x_1| = 0.0e+00 after one step
GD at the optimal step contracts by 0.9980; it needs 6908 steps for |x_k| <= 1e-6 |x_0|
Newton iteration 1:  |grad| = 3.5e-01
Newton iteration 2:  |grad| = 4.1e-02
Newton iteration 3:  |grad| = 1.7e-03
Newton iteration 4:  |grad| = 3.0e-06
Newton iteration 5:  |grad| = 9.9e-12
Newton iteration 6:  |grad| = 1.6e-17
max |w - w_star| = 4.4e-16
  • On the \kappa = 1000 valley, 1 Newton step replaces 6{,}908 gradient descent steps.
  • On the non-quadratic logistic loss, \|\nabla f\| squares at each step (10^{-1} \to 10^{-3} \to 10^{-6} \to 10^{-11} \to 10^{-16}), matching 4{,}000 gradient descent steps in 6 linear solves.

Why Exact Newton Fails at Deep Learning Scale

Computational Cost

  • Quadratic memory & cubic compute: Storing \nabla^2 f(\mathbf{x}_k) costs O(d^2) memory and solving (\nabla^2 f_k)\mathbf{p}_k = -\mathbf{g}_k costs O(d^3) FLOPs per step.
  • Scale wall: Manageable for a d = 10^4 linear layer (400\text{ MB}), but a d = 10^8 ConvNet/ViT requires 40\text{ PB} and a d = 10^{11} LLM requires 10^{33}\text{ FLOPs}.
  • Remedy: Low-memory quasi-Newton updates (L-BFGS) and diagonal/Kronecker preconditioners.

Saddle-Point Attraction on Nonconvex Surfaces

Nonconvex Pitfalls

Because Newton jumps to \nabla m_k(\mathbf{p}) = \mathbf{0}, it is attracted to saddles and maxima whenever \nabla^2 f has negative eigenvalues:

y_{k+1} = y_k - \frac{-\sin y_k}{-\cos y_k} = y_k - \tan y_k \approx -\frac{y_k^3}{3}

  • Wrong-way step: On f(x,y) = \tfrac12 x^2 + \cos y at (0.5, 0.3), dividing -\sin y by f_{yy} = -\cos y < 0 flips the update sign and pulls Newton uphill into the saddle (0, 0).

Newton vs. Gradient Descent Near a Saddle

Nonconvex Pitfalls

Starting both methods at (0.5, 0.3) on f(x, y) = \tfrac12 x^2 + \cos y shows how a richer local model can converge to a worse stationary point:

Newton y: [-9.33624961e-03  2.71275924e-07 -6.61744490e-21]   f = 1.0000
GD     y: [0.5955 1.1565 2.0718 2.9489 3.1404 3.1416]   f = -1.0000

Newton’s method is pulled into the saddle (0, 0) with f = 1 in three steps, whereas gradient descent (\eta = 1) follows the negative gradient downhill to the global minimum (0, \pi) with f = -1.

Inferring Curvature from Gradients: Secant Rule

Quasi-Newton Methods

In 1D, the secant method estimates f''(x_k) from the last two gradients:

h_k = \frac{f'(x_k) - f'(x_{k-1})}{x_k - x_{k-1}}, \qquad x_{k+1} = x_k - \frac{f'(x_k)}{h_k}

  • Superlinear convergence: Errors obey e_{k+1} \approx C e_k e_{k-1}, multiplying accurate digits by the golden ratio \approx 1.618 per step using only first derivatives.

The Multivariate Secant Equation and BFGS

Quasi-Newton Methods

In d dimensions, a quasi-Newton method maintains a symmetric positive-definite approximation \mathbf{M}_k \approx (\nabla^2 f(\mathbf{x}_k))^{-1} and updates it from the observed step and gradient difference:

\mathbf{s}_k = \mathbf{x}_{k+1} - \mathbf{x}_k, \qquad \mathbf{y}_k = \nabla f(\mathbf{x}_{k+1}) - \nabla f(\mathbf{x}_k)

  • The secant equation: On a quadratic \tfrac12\mathbf{x}^\top\mathbf{A}\mathbf{x}, \mathbf{y}_k = \mathbf{A}\mathbf{s}_k, so we require \mathbf{M}_{k+1} to map \mathbf{y}_k back to \mathbf{s}_k: \mathbf{M}_{k+1}\,\mathbf{y}_k = \mathbf{s}_k
  • The BFGS update: Because d equations cannot uniquely determine a d \times d symmetric matrix, BFGS selects the symmetric matrix closest to \mathbf{M}_k (in a weighted Frobenius norm) that satisfies \mathbf{M}_{k+1}\mathbf{y}_k = \mathbf{s}_k: \mathbf{M}_{k+1} = \big(\mathbf{I} - \gamma_k\mathbf{s}_k\mathbf{y}_k^\top\big)\,\mathbf{M}_k\,\big(\mathbf{I} - \gamma_k\mathbf{y}_k\mathbf{s}_k^\top\big) + \gamma_k\mathbf{s}_k\mathbf{s}_k^\top, \qquad \gamma_k = \frac{1}{\mathbf{y}_k^\top \mathbf{s}_k}

How BFGS Preserves Positive Definiteness

Quasi-Newton Methods

With \mathbf{w} = (\mathbf{I} - \gamma_k\mathbf{y}_k\mathbf{s}_k^\top)\mathbf{z} and \gamma_k = 1/(\mathbf{y}_k^\top\mathbf{s}_k), the BFGS quadratic form is:

\mathbf{z}^\top \mathbf{M}_{k+1}\mathbf{z} = \mathbf{w}^\top \mathbf{M}_k\mathbf{w} + \gamma_k(\mathbf{s}_k^\top\mathbf{z})^2

  • Erase-and-write: (\mathbf{I} - \gamma_k\mathbf{y}_k\mathbf{s}_k^\top) zeroes out \mathbf{y}_k, and +\gamma_k\mathbf{s}_k\mathbf{s}_k^\top writes in \mathbf{M}_{k+1}\mathbf{y}_k = \mathbf{s}_k.
  • Curvature condition: Whenever \mathbf{M}_k \succ \mathbf{0} and \mathbf{y}_k^\top\mathbf{s}_k > 0 (enforced by Wolfe line search), \mathbf{M}_{k+1} \succ \mathbf{0} is guaranteed.

BFGS Recovers the Exact Inverse Hessian in d Steps

Quasi-Newton Methods

On \mathbf{A} = \mathrm{diag}(1, 10) from (1, 1) with \mathbf{M}_0 = \mathbf{I} and exact line search, BFGS probes the steep direction on step 1 and recovers \mathbf{A}^{-1} = \mathrm{diag}(1, 0.1) exactly on step d = 2:

step 1: x = [ 0.8991 -0.009 ],  M = [[1.009, -0.0001], [-0.0001, 0.1]]
step 2: x = [0. 0.],  M = [[1.0, -0.0], [-0.0, 0.1]]
A^-1 = [[1.0, 0.0], [0.0, 0.1]],  max |M_2 - A^-1| = 1e-16
  • L-BFGS for large d: Storing a dense d \times d matrix \mathbf{M}_k still costs O(d^2) memory. L-BFGS stores only the m most recent pairs \{(\mathbf{s}_j, \mathbf{y}_j)\}, applying \mathbf{M}_k\mathbf{g}_k in O(md) time and memory—ideal for deterministic problems, though vulnerable to minibatch noise in \mathbf{y}_k.

Trust-Region Methods: Bounding the Model Radius

Trust Regions

Newton’s method ran into the saddle of \tfrac12 x^2 + \cos y because it trusted its local Taylor approximation across all of \mathbb{R}^d. A trust-region method keeps the full quadratic model, including directions of negative curvature, while restricting the step \mathbf{p} to a ball of radius \Delta_k:

\min_{\|\mathbf{p}\| \le \Delta_k} m_k(\mathbf{p}) = f(\mathbf{x}_k) + \mathbf{g}_k^\top\mathbf{p} + \tfrac12\,\mathbf{p}^\top\mathbf{B}_k\mathbf{p}

  • Always well-posed: Because the closed ball \{\mathbf{p} : \|\mathbf{p}\| \le \Delta_k\} is compact and m_k is continuous, a global minimizer of the subproblem always exists, even when \mathbf{B}_k = \nabla^2 f(\mathbf{x}_k) is indefinite or negative definite.
  • Escaping saddles: Along any eigenvector of \mathbf{B}_k with a negative eigenvalue, the quadratic model curves downward, so minimizing m_k inside the ball automatically pushes \mathbf{p} all the way to the boundary \|\mathbf{p}\| = \Delta_k away from the saddle.

Optimality Conditions for the Trust-Region Ball

Trust Regions

A vector \|\mathbf{p}\| \le \Delta globally minimizes m_k(\mathbf{p}) inside the ball iff there exists \tau \ge 0 satisfying:

(\mathbf{B} + \tau\mathbf{I})\,\mathbf{p} = -\mathbf{g}, \quad \mathbf{B} + \tau\mathbf{I} \succeq \mathbf{0}, \quad \tau(\Delta - \|\mathbf{p}\|) = 0

  • Interior (\tau = 0): When \mathbf{B} \succ \mathbf{0} and \|\mathbf{B}^{-1}\mathbf{g}\| \le \Delta, take the pure Newton step.
  • Boundary (\tau > -\lambda_{\min}(\mathbf{B})): Shifts all eigenvalues upward until \mathbf{B} + \tau\mathbf{I} \succ \mathbf{0} and \|(\mathbf{B} + \tau\mathbf{I})^{-1}\mathbf{g}\| = \Delta, flipping negative-curvature directions to escape saddles.

Escaping a Saddle with a Trust-Region Step

Trust Regions

Let us solve the trust-region subproblem by hand at \mathbf{x}_0 = (0.5, 0.3) on f(x,y) = \tfrac12 x^2 + \cos y with radius \Delta = 0.5:

  • Local derivatives: \mathbf{g} = (0.5, -0.296) and \mathbf{B} = \mathrm{diag}(1, -0.955).
  • Positivity threshold: Requiring \mathbf{B} + \tau\mathbf{I} = \mathrm{diag}(1 + \tau,\, \tau - 0.955) \succeq \mathbf{0} forces \tau \ge 0.955 > 0, so the step must lie on the boundary \|\mathbf{p}\| = 0.5.
  • Boundary system: Solve (1 + \tau)p_1 = -0.5 and (\tau - 0.955)p_2 = 0.296 subject to p_1^2 + p_2^2 = 0.25: \tau \approx 1.60, \qquad \mathbf{p} \approx (-0.19,\, +0.46), \qquad \mathbf{x}_1 = \mathbf{x}_0 + \mathbf{p} \approx (0.31,\, 0.76)
  • Comparison with Newton: Unconstrained Newton stepped to (-0.5, -0.31) toward the saddle (0, 0), whereas the shifted matrix (\mathbf{B} + \tau\mathbf{I}) \succ \mathbf{0} flips the sign of p_2 and steps away from the saddle, dropping f from 1.080 to 0.771.

Adaptive Radius Control via Agreement Ratio

Trust Regions

After computing the candidate step \mathbf{p}_k, the algorithm compares the actual loss reduction to the reduction predicted by the quadratic model:

r_k = \frac{f(\mathbf{x}_k) - f(\mathbf{x}_k + \mathbf{p}_k)}{m_k(\mathbf{0}) - m_k(\mathbf{p}_k)}

 k        x            f      |p|    tau      r  Delta
 0 ( 0.500, 0.300)  1.0803  0.500  1.596   0.98  0.50
 1 ( 0.307, 0.761)  0.7711  1.000  1.419   0.87  1.00
 2 ( 0.180, 1.753) -0.1652  2.000  0.311   0.41  2.00
 3 ( 0.043, 3.749) -0.8205  0.696  0.000   0.88  2.00
 4 ( 0.000, 3.054) -0.9962  0.088  0.000   1.00  2.00
 5 ( 0.000, 3.142) -1.0000  0.000  0.000   1.00  2.00
final x = (0.0000, 3.1416),  f = -1.0000
  • When r_k > 0.75 on the boundary, \Delta_k doubles (0.5 \to 1 \to 2); once inside the convex basin (k \ge 3), \tau = 0 and the method becomes pure Newton, reaching (0, \pi) in 6 steps.

Comparing Trajectories: Newton vs. Trust Region

Trust Regions

  • Panel (a): Local saddle surface: At (0.5, 0.3), the quadratic model m_0(\mathbf{p}) is a hyperbolic saddle. Pure Newton jumps to its stationary point at the origin, while minimizing m_0 inside the ball \|\mathbf{p}\| \le 0.5 follows the downward-curving y-axis.
  • Panel (b): Global trajectory: Trust region escapes the indefinite region in three steps, expands \Delta, and enjoys quadratic convergence to the global minimum (0, \pi).
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Concept Check: Curvature, Cost, and Damping

Concept Check

Test your understanding of second-order and quasi-Newton methods:

  1. Suppose Newton’s method has entered its quadratic convergence basin with scaled error \frac{L_2}{2\mu}\|\mathbf{e}_k\| = 10^{-1}. How many Newton steps are needed to reach 10^{-8}, compared with gradient descent at \kappa = 10^3?
  2. In a trust-region subproblem with \mathbf{B} = \mathrm{diag}(1, 4), \mathbf{g} = (1, 4), and radius \Delta = 2, what are the optimal multiplier \tau and step \mathbf{p}?
  3. Why does BFGS require the curvature condition \mathbf{y}_k^\top \mathbf{s}_k > 0?

Answers: (1) 3 Newton steps: The scaled error squares at each step (10^{-1} \to 10^{-2} \to 10^{-4} \to 10^{-8}). Gradient descent at \kappa = 10^3 needs \approx 1{,}150 steps per digit, or roughly 8{,}050 steps for seven digits. (2) \tau = 0 and \mathbf{p} = (-1, -1): Here \mathbf{B} \succ \mathbf{0} and the unconstrained Newton step -\mathbf{B}^{-1}\mathbf{g} = (-1, -1) has norm \sqrt{2} \approx 1.414 < \Delta = 2, so it fits strictly inside the ball. (3) To keep \mathbf{M}_{k+1} \succ \mathbf{0}: In the quadratic form \mathbf{z}^\top\mathbf{M}_{k+1}\mathbf{z} = \mathbf{w}^\top\mathbf{M}_k\mathbf{w} + (\mathbf{s}_k^\top\mathbf{z})^2 / (\mathbf{y}_k^\top\mathbf{s}_k), positive definiteness is preserved if and only if \mathbf{y}_k^\top\mathbf{s}_k > 0.

Summary: Second-Order and Curvature Methods

Key Takeaways

Method Step / Subproblem Convergence Rate Per-Step Memory & Compute Deep Learning Role & Limitation
Pure Newton \mathbf{p}_k = -(\nabla^2 f_k)^{-1}\mathbf{g}_k Quadratic (\|\mathbf{e}_{k+1}\| \le \frac{L_2}{2\mu}\|\mathbf{e}_k\|^2), affine-invariant O(d^2) memory, O(d^3) solve Prohibitive for large d; attracted to saddle points
Damped Newton \mathbf{x}_k + \alpha_k \mathbf{p}_k via Armijo line search Global descent when \nabla^2 f_k \succ \mathbf{0}; local quadratic (\alpha_k = 1) O(d^2) memory, O(d^3) solve Prevents overshooting far from \mathbf{x}^\star, still needs \nabla^2 f_k \succ \mathbf{0}
BFGS / L-BFGS Rank-2 update solving \mathbf{M}_{k+1}\mathbf{y}_k = \mathbf{s}_k Superlinear (d steps on d-D quadratic) BFGS: O(d^2); L-BFGS: O(md) Standard for deterministic medium-scale fits; sensitive to minibatch noise
Trust Region \min_{\|\mathbf{p}\| \le \Delta_k} m_k(\mathbf{p}) \iff (\mathbf{B}_k + \tau\mathbf{I})\mathbf{p} = -\mathbf{g}_k Escapes negative-curvature saddles; local quadratic Subproblem solve per step Motivated spectral damping (\mathbf{B} + \tau\mathbf{I}) in second-order preconditioners