Second-Order & Approximate Methods
Newton's method reads the curvature of the loss off its Hessian and jumps to the minimum of the local quadratic in a single step, rescaling away the ill-conditioning that slows first-order descent. We derive it, then explain the three obstacles that keep it out of deep learning: a Hessian for in the billions, an attraction to saddle points, and minibatch noise.
╌╌╌╌
Every optimizer so far (SGD, momentum, and the adaptive methods) is first-order: it sees only the gradient and steps . The gradient is a flat plane tangent to the loss; it gives the downhill direction but nothing about how the surface curves. A second-order method also reads the curvature (the Hessian ) and uses it to choose both direction and step length at once. On the ill-conditioned ravines that make first-order descent crawl, that extra information is decisive. The problem is its cost, and most of this lesson is about approximations that capture a fraction of it cheaply.1
Newton's method
Expand the loss to second order around the current iterate . Writing the step as , Taylor's theorem gives the local quadratic model
This is a paraboloid in . If it has a unique minimum, found by setting the gradient of the right-hand side to zero:
The minimizer of the quadratic is one step away, and that step is the Newton step. Taking it as the update gives Newton's method.
The model being minimized is a bowl, not a plane. First-order descent fits the loss with its tangent plane and can only report a direction of decrease; the plane has no bottom, so the step length has to come from a separately tuned learning rate. The second-order model adds the quadratic term , which closes the surface into a paraboloid with a definite minimum. Minimizing that bowl fixes direction and length together, and is the vector from the current point to its floor.
The geometry explains the advantage. Gradient descent steps along , perpendicular to the contours of as drawn in raw coordinates; on a stretched bowl that direction does not point at the minimum. Newton multiplies by , which rescales each direction by its curvature (stretching the gently curved axes and shrinking the steep ones), so that in the rescaled coordinates the bowl is round and aims straight at the bottom.
Because the rescaling cancels the eigenvalue spread of , Newton's method is invariant to the condition number : a bowl stretched a thousand-to-one is solved as fast as a round one. This removes exactly the problem that momentum and adaptive rates only mitigate.2 To see the one-step claim algebraically, take an exact quadratic , for which :
The invariance runs deeper than the condition number. Newton's method is affine invariant: reparametrize by any invertible linear map , and the iterates it produces are the exact images under of the iterates on the original problem. A quick check: under the gradient transforms as and the Hessian as , so the Newton direction is
the original step carried through . Gradient descent has no such property — the direction does not equal , so a bad choice of units alone can make first-order descent crawl. Newton reads geometry, not coordinates, which is why the same step handles a bowl stretched a thousand-to-one and a round one alike.
The cost is high. Forming needs the second derivative with respect to every pair of parameters — distinct entries — and solving the linear system (whether by inverting or by Cholesky factorization) costs arithmetic and storage. For a network, alone is numbers; the factorization is operations, per step. The entire remainder of the lesson is a catalog of ways to keep the curvature information while retreating from that / cost.
Why second-order methods are rare in deep learning
Newton's method works well on small, smooth, deterministic problems. In deep learning all three properties fail at once, and each failure alone rules the method out.
The Hessian is
The first wall is sheer size. The Hessian of a network with parameters is a symmetric matrix (one entry per pair of parameters), so its storage grows as and forming its inverse costs by Gaussian elimination.
The numbers are far from feasible. The table quantifies the gap: a gradient that fits in memory pairs with a Hessian that cannot be stored on any hardware.
| (parameters) | gradient entries | Hessian entries | inversion cost |
|---|---|---|---|
Even storing once for a modest -parameter network needs a terabyte at single precision; inverting it is hopeless. And the optimizer must do this every step.
Newton is attracted to saddle points
The second wall is qualitative, and worse: where it does run, Newton's method walks toward the very saddle points that dominate high-dimensional loss surfaces. Diagonalize and resolve the Newton step into the eigenbasis. Along eigendirection , with eigenvalue and gradient component , the step is
Here is the defect. The first-order step always moves downhill along axis . The Newton step divides by , and dividing by a negative eigenvalue flips the sign — turning a downhill move into an uphill one, straight toward the critical point. Newton does not distinguish whether a critical point is a minimum, a maximum, or a saddle; it converges to all of them, because it solves rather than minimizing .3
| Eigendirection | first-order step | Newton step | effect | |
|---|---|---|---|---|
| up-curving | downhill | downhill, rescaled | toward minimum (correct) | |
| down-curving | downhill | uphill (sign flips) | toward saddle (wrong) | |
| flat | small | blows up () | catastrophic step |
Since high-loss critical points are overwhelmingly saddles, an unmodified Newton step is not merely useless but actively harmful. The fix is to force the curvature positive: saddle-free Newton replaces with (take the absolute values of the eigenvalues), and classic damping (Levenberg–Marquardt) solves , adding until the matrix is positive definite. Both restore descent, but both still need .
Minibatch noise corrupts the estimate
The third wall is statistical. Deep nets are trained on minibatches, so both and are noisy estimates from a sample. First-order steps tolerate this (noise averages out over many steps), but the Newton step divides by the Hessian estimate, and a ratio amplifies error in the denominator. A small eigenvalue estimated with even modest relative error produces a huge swing in . The very curvature information Newton depends on is the part the noise corrupts most.
| Assumption Newton needs | Reality in deep learning | Consequence |
|---|---|---|
| small and storable | up to , is | cannot form or invert |
| (a bowl) | mostly saddles, mixed-sign | attracted to saddles |
| exact | minibatch estimates, noisy | division amplifies the noise |
| problem deterministic | stochastic objective | step direction unstable |
The rest of the lesson is the response: methods that capture some curvature without ever forming, storing, or inverting .
Conjugate gradients
Steepest descent on a quadratic wastes effort because successive steps are orthogonal, and on a stretched bowl orthogonal steps zig-zag, each step partly undoing the progress of the last along the previous direction. Conjugate gradients (CG) fixes this by choosing search directions that are conjugate with respect to , so that minimizing along a new direction never disturbs the minimization already achieved along the old ones.
The new direction reuses the previous one, bent just enough to be conjugate to it. The combining coefficient (the Fletcher–Reeves form ) is computed from gradients alone, so CG never touches explicitly. Each step needs one gradient and one line search.
- 1
- 2first direction is steepest descent
- 3for do
- 4line search along
- 5
- 6
- 7if thenconverged
- 8return
- 9Fletcher-Reeves coefficient
- 10bend to be conjugate to
On a strictly quadratic objective CG terminates in at most steps; on a general nonlinear loss it is run with periodic restarts and remains a strong batch optimizer, though minibatch noise in the line search limits its use in pure deep learning.4
Quasi-Newton: BFGS and L-BFGS
Newton needs but the cost is prohibitive. Quasi-Newton methods learn an approximation as they go, reading curvature off the change in the gradient. The secant condition anchors the construction: over a step, the gradient's change encodes the curvature along that step. Writing
a first-order expansion of gives , so must satisfy . BFGS updates at each step so it reproduces this relation on the latest pair while changing as little as possible (a rank-two correction):
The step is then , a Newton-like move that never forms or inverts , only matrix–vector products and a line search.
The rank-two form is engineered to satisfy three demands at once: it reproduces the secant relation , it keeps symmetric and positive definite whenever (the curvature condition, guaranteed by a proper line search), and among all matrices meeting the secant relation it is the closest to in a weighted Frobenius norm. Positive definiteness matters: it forces every step to be a descent direction, so unlike raw Newton, BFGS cannot sign-flip toward a saddle. The curvature is learned, one pair at a time, and it accumulates the effect of many past pairs into a single matrix.
The remaining problem is memory: is still . L-BFGS (limited-memory BFGS) never stores at all. It keeps only the last pairs (typically to ) and reconstructs the action on the fly by a two-loop recursion over those vectors: a backward sweep peels off the recent curvature corrections into scalars , a scaling by approximates the bulk of , and a forward sweep folds the corrections back in. Each sweep is inner products and vector updates, so one matrix–vector action costs rather than . Memory drops from to , the same order as the gradient. That is what makes a quasi-Newton method usable at deep-learning scale (in the full-batch regime).5
The reason L-BFGS is still uncommon on deep nets is the same noise wall Newton hit, now in a subtler place. The secant pair is built from the difference of two gradients. Under minibatching those gradients are computed on different samples, so mixes the true curvature signal with the difference of two independent noise terms. That noise does not average away inside the BFGS update the way it does across SGD steps — it corrupts the very curvature estimate the method accumulates, and a stale or noisy can point the step in a wrong direction. L-BFGS works best with large or full batches, where the gradients are clean enough; on noisy minibatch gradients the first-order methods are preferable.
| Method | Hessian use | Memory | Per-step cost | Reaches quadratic min in |
|---|---|---|---|---|
| Newton | exact , inverts it | step | ||
| Conjugate gradients | implicit (via products) | + line search | steps | |
| BFGS | approximates from | steps | ||
| L-BFGS | last curvature pairs | superlinear, steps |
Gauss-Newton and the Fisher matrix
Before the natural gradient there is a simpler positive-semidefinite stand-in for . For a loss that is a sum of squared residuals , write the Jacobian of the residual vector as . The exact Hessian is
The Gauss-Newton approximation drops the second term and keeps only . That term is the part carrying the residual curvature ; near a good fit the residuals are small, so dropping it costs little, and what remains is an outer product that can never be indefinite. Gauss-Newton gets the same immunity to saddles that damping enforces by hand, and it needs only first derivatives of the residuals.
The Fisher information matrix generalizes this to probabilistic models. When the loss is the negative log-likelihood of the model's output distribution , the Fisher is the expected outer product of the score,
Two facts make attractive. It equals the expected Hessian of the negative log-likelihood (so it is curvature, not a crude substitute), and being an expectation of outer products it is positive semidefinite by construction — no sign-flips toward saddles. For the exponential-family output layers used in practice, coincides with the Gauss-Newton matrix , tying the two views together.
Natural gradient, K-FAC, and Hessian-free
The natural gradient preconditions by instead of , measuring distance in the space of the model's output distributions rather than its raw parameters:
The motivation is invariance. Ordinary gradient descent moves fastest in the direction of steepest descent measured by Euclidean distance in parameter space, but a parameter is an arbitrary label — reparametrize the network and the same distance means something different. The natural gradient instead takes the steepest-descent direction under the Kullback–Leibler divergence between output distributions, a quantity that does not depend on how the parameters are named. To second order that divergence is , so plays exactly the role played in the Taylor bowl, and is the step that descends the loss per unit of distributional change. Because is positive semidefinite, that step never climbs toward a saddle the way can.
is still , so like it is used only through approximations.
| Method | Curvature matrix | Trick that makes it affordable |
|---|---|---|
| Natural gradient | Fisher information | curvature in output-distribution space, always |
| K-FAC | block-diagonal | factor each layer's block as a Kronecker product |
| Hessian-free | Hessian (implicit) | inner CG using products via autodiff |
For a layer with inputs and outputs, its weight has parameters and its Fisher block is . K-FAC models that block as , where is the covariance of the layer's inputs and is the covariance of its output gradients. Storing and inverting two factors of size and costs instead of the of the full block — a difference of many orders of magnitude for a wide layer. The Kronecker structure is an assumption (it holds exactly only if inputs and output-gradients are statistically independent), but it captures between-parameter curvature that a diagonal preconditioner throws away.
Hessian-vector products without forming
The trick under Hessian-free optimization is that the whole matrix is never needed — only its action on chosen vectors, which inner CG consumes one at a time. And is itself a gradient. For any fixed ,
because differentiating (a scalar, with held constant) with respect to contracts the second derivative against . Pearlmutter's trick computes this at the cost of one extra backward pass: run the ordinary backward pass to get , take the scalar , and backpropagate that. No entry of is ever materialized, storage stays , and each CG iteration inside the inner solve costs one forward–backward pair.
Curvature is accessible — just never as a stored matrix.6
A ladder of approximations
Every method here occupies one rung of a single ladder that trades curvature accuracy against cost per step. At the bottom is plain gradient descent, which uses no curvature and costs . Each rung up costs more and captures more of : a diagonal estimate (one number per parameter, which is what Adam does), then a per-layer Kronecker block (K-FAC), then a low-rank running estimate from curvature pairs (L-BFGS), and at the top the full Hessian solve of exact Newton at . Deep learning almost always sits on the lowest two rungs, because the higher ones cannot tolerate minibatch noise and their per-step cost is not worthwhile when the gradient itself is only an estimate.
First-order versus second-order
The whole chapter resolves into one comparison. First-order methods are cheap, noise- tolerant, and scale to billions of parameters but suffer under ill-conditioning; second-order methods fix conditioning and converge in far fewer steps but cost too much per step and break under saddles and noise. Deep learning sits in the top row, borrowing pieces of the bottom row (momentum, adaptive rates, occasionally L-BFGS) when it can.
| First-order (SGD, Adam) | Second-order (Newton, quasi-Newton) | |
|---|---|---|
| Information used | gradient | gradient + curvature |
| Per-step cost | – (exact), (L-BFGS) | |
| Steps to converge | many | few (quadratic / superlinear) |
| Robust to conditioning | no (needs momentum / adaptive rates) | yes (rescales by curvature) |
| Robust to minibatch noise | yes (noise averages out) | no (division amplifies it) |
| Saddle behavior | escapes (with noise / momentum) | attracted unless modified |
| Deep-learning suitability | the default | rare; full-batch or approximate only |
Modern second-order optimizers
Goodfellow's §8.6 stops at the classical toolkit; the past decade pushed approximate second-order optimization back toward large-scale training.
- K-FAC in full. Martens and Grosse's paper is the source of the Kronecker-factored Fisher approximation above, and the first to make natural gradient practical on real networks.7
- Shampoo. Gupta, Koren, and Singer keep a preconditioner per tensor dimension (Kronecker-factored full-matrix AdaGrad); a distributed version has trained production language models faster than Adam.8
- Sophia. Liu et al. use a clipped diagonal Hessian estimate to stay saddle-safe and roughly halve language-model pre-training steps — the ladder's diagonal rung, but reading true curvature rather than Adam's gradient second moment.9
The trend runs up the ladder: as models grow, a little real curvature increasingly becomes worth its cost, and the saddle and noise walls are handled by the same positive-definite surrogates and clipping this lesson derived.
Takeaways
- Newton's method jumps to the minimum of the local quadratic in one step and is invariant to the condition number — it rescales each direction by its curvature, curing the ill-conditioning that makes first-order descent zig-zag.
- Three walls keep it out of deep learning: the Hessian is (storage , inversion , infeasible for up to billions); Newton is attracted to saddles because dividing by a negative eigenvalue flips a downhill step uphill; and minibatch noise in the denominator is amplified by the division.
- Conjugate gradients steps in -conjugate directions to eliminate the zig-zag of steepest descent and reach a quadratic's minimum in steps using gradients only — no Hessian inverse.
- Quasi-Newton methods build from gradient differences via the secant condition ; BFGS stores the full matrix, L-BFGS keeps only the last curvature pairs at memory.
- The natural gradient preconditions by the always-positive Fisher matrix ; K-FAC factors per layer as a Kronecker product; Hessian-free optimization solves by inner CG using products from one extra backward pass — curvature without ever storing .
- Deep learning stays first-order: Adam is the diagonal, approximation to second-order preconditioning, keeping the conditioning benefit at first-order cost.
Footnotes
- Goodfellow, Deep Learning, §8.6 — Approximate Second-Order Methods: why curvature converges in fewer steps and the price that keeps exact second-order methods out of deep learning. ↩
- Goodfellow, Deep Learning, §4.3.1 — Beyond the Gradient: Jacobian and Hessian Matrices: the second-order Taylor model, the Newton step , and condition-number invariance. ↩
- Goodfellow, Deep Learning, §8.2.3, §8.6 — Newton's attraction to saddle points (dividing by a negative eigenvalue) and the saddle-free / damped fixes that force positive curvature. ↩
- Goodfellow, Deep Learning, §8.6 — Conjugate Gradients: -conjugate search directions that eliminate the zig-zag of steepest descent without forming the Hessian. ↩
- Goodfellow, Deep Learning, §8.6 — BFGS and L-BFGS: learning from the secant condition, and the limited-memory recursion that drops storage to . ↩
- Goodfellow, Deep Learning, §8.6, §12.1 — natural gradient via the Fisher information matrix, K-FAC's Kronecker factorization, and Hessian-free optimization through products. ↩
- Martens & Grosse, Optimizing Neural Networks with Kronecker-Factored Approximate Curvature, ICML 2015 — the K-FAC approximation of the Fisher block as a Kronecker product of two small factors. ↩
- Gupta, Koren & Singer, Shampoo: Preconditioned Stochastic Tensor Optimization, ICML 2018 — per-dimension Kronecker-factored preconditioning, later scaled to production language models. ↩
- Liu et al., Sophia: A Scalable Stochastic Second-Order Optimizer for Language Model Pre-training, ICLR 2024 — a clipped diagonal-Hessian preconditioner that roughly halves pre-training steps. ↩
╌╌ END ╌╌