Limited-Memory L-BFGS and Inexact (Truncated) Newton-CG
Anchor (Master): Nocedal & Wright 2006 Numerical Optimization 2e (Springer) §7.1-7.2 and §6.1 (the limited-memory inverse-Hessian recurrence, the compact representation , and the inexact-Newton local-convergence theorem relating the forcing sequence to linear, superlinear, and quadratic rates); Liu & Nocedal 1989 On the limited memory BFGS method for large scale optimization (Math. Programming 45, 503-528); Dembo, Eisenstat & Steihaug 1982 Inexact Newton methods (SIAM J. Numer. Anal. 19, 400-408); Steihaug 1983 The conjugate gradient method and trust regions in large scale optimization (SIAM J. Numer. Anal. 20, 626-637)
Intuition Beginner
Full BFGS keeps a complete curvature table — a square array the size of the problem squared. For a problem in a million variables that array has a trillion entries, far too many to store. Limited-memory BFGS notices that the table was never used on its own: it only ever multiplied the gradient to produce a search direction. So instead of keeping the table, L-BFGS keeps just the raw measurements that built it — the last handful of step and slope-change pairs — and rebuilds the one multiplication it needs on the fly. Keeping the last five or ten pairs is usually enough, so the storage drops from a trillion numbers to a few million.
There is a second large-scale idea in this unit. Newton's method aims each step by solving a system of equations involving the curvature. Solving that system exactly is expensive, and early on it is wasted effort — the curvature you are solving against is only a local snapshot, so an exact answer to an approximate question buys you little. A truncated Newton method solves the system only roughly, using a cheap inner loop that you stop early, and tightens the accuracy as you close in on the answer. Far away you take quick sloppy steps; near the solution you solve carefully and recover Newton's full speed.
Picture packing for a trip with one small bag (L-BFGS): you cannot carry your whole closet, so you bring the few recent outfits that actually tell you what the weather has been like, and reconstruct a sensible choice from those. The truncated idea is like sketching a route: a rough sketch is fine while you are far away, and you fill in the fine detail only as you near your destination.
Visual Beginner
Picture the curvature information as a stack of note cards. Full BFGS would keep one enormous card holding the entire table. L-BFGS instead keeps a short stack of the most recent cards, each recording one step and the slope change across it; when an older card is pushed off the bottom, its information is simply forgotten. To get a search direction, the method runs down the stack and back up it once — a quick two-pass sweep — which is exactly the two-loop recursion.
| method | what it stores | cost per step | best when |
|---|---|---|---|
| full BFGS | whole curvature table | medium | a few hundred variables |
| L-BFGS | last measurement pairs | cheap, fixed | millions of variables |
| truncated Newton | nothing (rebuilds curvature action) | varies (inner loop) | curvature action is cheap and accurate |
The takeaway: both methods refuse to store a full curvature table. L-BFGS keeps a short stack of recent measurements and sweeps it twice; truncated Newton keeps no table at all and instead solves the Newton equations approximately with an early-stopped inner loop.
Worked example Beginner
Let us run the L-BFGS direction sweep with a memory of just one pair, on a two-variable problem, so every number is concrete. Suppose the most recent step was and the slope changed by across it. The current gradient is , and we want the search direction.
First compute the helper number . Here , so .
Backward pass. Set . Compute . Update .
Scaling. The initial guess scales the identity by . Apply it: .
Forward pass. Compute . Update .
The direction is .
What this tells us: from one stored pair and the current gradient, two short passes produce a search direction that already bends the plain downhill direction toward the measured curvature — it stretched the first coordinate (where curvature was large) less than the second. We never built or stored a curvature matrix; we only swept the stored measurements.
Check your understanding Beginner
Formal definition Intermediate+
Let be twice continuously differentiable with gradient and Hessian . This unit treats two large-scale strategies that both refuse to store an matrix.
Limited-memory BFGS. Recall from 44.03.04 the BFGS inverse update with , , , and . L-BFGS never forms . It stores only the most recent correction pairs and defines the implicit inverse-Hessian approximation by applying BFGS updates to a scaled initial matrix :
with the standard scaling , which sizes the unit initial matrix to the most recent curvature. The product is computed by the two-loop recursion: set ; for set and ; set ; for set and ; return . The cost is multiply-adds and storage, with no matrix formed and no linear solve. The search direction is , and a line search satisfying the Wolfe conditions 44.03.01 supplies the step, guaranteeing so each stored pair is curvature-admissible.
Inexact (truncated) Newton. An inexact Newton method computes a step that solves the Newton system only approximately: with residual , the step is accepted when
where is the forcing sequence. The truncated Newton-CG method realises this by applying the linear conjugate gradient method 43.07.04 to , terminating CG as soon as the residual test holds. Because CG accesses its matrix only through matrix-vector products, the Hessian is never assembled: each inner iteration needs one Hessian-vector product , supplied either by automatic differentiation or by the finite-difference approximation of 44.03.08, making the method Hessian-free. When CG generates a direction with nonpositive curvature, , the iteration is truncated: on the first inner iteration it returns (steepest descent), and thereafter it returns the current inner iterate, which is a descent direction. The new symbols , , the two-loop scalars , the forcing sequence , the inner residual , and the Hessian-vector product are recorded in _meta/NOTATION.md.
Counterexamples to common slips Intermediate+
"L-BFGS is BFGS with a smaller matrix." L-BFGS stores no matrix at all. It stores vectors and reconstructs only the action . The implicit it represents changes its initial matrix every iteration, so it is not a truncation of a single evolving matrix but a fresh -update product each step.
"A more accurate inner solve is always better." Solving the Newton system to high accuracy far from the solution wastes inner iterations against a Hessian that is only a local model; the forcing sequence deliberately keeps large early. Over-solving raises cost with no gain in the outer rate, which is capped by how good the local quadratic model is.
"CG can be run to convergence on any Newton system." Away from a minimiser the Hessian can be indefinite, and CG breaks down on indefinite systems. Truncated Newton must detect nonpositive curvature and stop, returning a guaranteed descent direction; ignoring this produces an ascent step or a CG division by a nonpositive curvature.
"Hessian-free means derivative-free." The Hessian-vector product still needs first derivatives: automatic differentiation differentiates the gradient, and the finite-difference form evaluates the gradient at a perturbed point. The saving is the storage and assembly of the Hessian, not the use of derivatives.
Key theorem with proof Intermediate+
The signature result is that the two-loop recursion is not an approximation of the BFGS direction but computes it exactly from the stored pairs: the sweep returns precisely for the limited-memory defined by BFGS updates applied to . This is what makes L-BFGS a genuine quasi-Newton method 44.03.04 rather than a heuristic, and it is the reason the line-search descent theory carries over unchanged.
Theorem (two-loop recursion computes the L-BFGS direction). Let and let satisfy . Define by applying the BFGS inverse update successively to with the pairs . Then the two-loop recursion returns , and , so is a descent direction.
Proof. Write , . One BFGS inverse update is . Applying to a vector gives
Set . The vector is precisely the backward-loop update , and acting on produces . Adding the term gives
Reading this recursively: the innermost operation is applied to the fully-reduced , and each layer outward restores one with coefficient where and is the partial result. The backward loop computes all and reduces to ; the scaling computes ; the forward loop applies the factors and adds the terms in the correct order, yielding . Each stored in the backward loop is exactly the reused in the forward loop because at the backward visit equals at that layer.
For positive-definiteness, hereditary positive-definiteness of the BFGS inverse update 44.03.04 applies to each of the updates: since by the curvature condition, and each update preserves positive-definiteness given . Hence , so whenever .
Bridge. This identity is the foundational reason L-BFGS inherits the quasi-Newton theory of 44.03.04 wholesale: because the two-loop output is the exact BFGS direction for the implicit , hereditary positive-definiteness makes a descent direction, and the Wolfe line search of 44.03.01 then supplies the next admissible pair , so the invariant propagates and the globalisation theory needs no change — this is exactly the same self-perpetuating curvature condition that drove full BFGS. The argument builds toward the compact-representation theorem of the Advanced results, where the same -update product is rewritten as a single low-rank correction , and it appears again in the truncated-Newton analysis: there, positive curvature of the Hessian along the CG directions plays the role that plays here, both being the condition under which the inner model stays a genuine bowl. The central insight is that limited memory changes only the representation of the quasi-Newton operator, not its mathematics; putting these together, L-BFGS generalises BFGS to large by storing the data that built the matrix instead of the matrix, and the bridge is the recursion identity that makes the two provably the same direction.
Exercises Intermediate+
Advanced results Master
Large-scale unconstrained optimization is organised here around two refusals to store an matrix — the limited-memory secant representation and the matrix-free inexact Newton solve — and the theory below settles the compact form of the L-BFGS operator, the exact convergence dichotomy of inexact Newton, the negative-curvature handling that makes Newton-CG robust, and the practical comparison that governs which method a large problem wants.
Theorem 1 (compact representation of L-BFGS). With , , let be the strictly-lower-triangular part of and . The limited-memory inverse-Hessian admits the compact form
where is the upper-triangular part of . This expresses as a scaled identity plus a rank- correction, so costs via two tall-skinny matrix products and a small solve, the matrix-form equivalent of the two-loop recursion. The direct-Hessian approximation has the dual compact form , which is what trust-region L-BFGS uses to apply and solve the subproblem [Nocedal, J. & Wright, S. J. — Numerical Optimization (2nd ed.)].
Theorem 2 (Dembo-Eisenstat-Steihaug local convergence of inexact Newton). Let be continuously differentiable with nonsingular at a root , and run the inexact Newton iteration accepting whenever . If then for near the iterates converge to , q-linearly in the norm with asymptotic factor . Moreover forces q-superlinear convergence, and for forces q-order ; in particular recovers Newton's quadratic rate. The forcing sequence is thus a precise dial trading inner-solve accuracy against outer convergence order, and the practical choice (Eisenstat-Walker) buys superlinear convergence at a controlled inner cost [Dembo, R. S., Eisenstat, S. C. & Steihaug, T. — Inexact Newton methods].
Theorem 3 (Newton-CG truncation and Steihaug-Toint trust-region CG). Applying CG 43.07.04 to from : while the curvature along every generated direction, the iterates monotonically decrease the quadratic model and increase in norm, strictly increasing. If a nonpositive-curvature direction appears, the line-search Newton-CG returns (or if ), a descent direction; the trust-region variant (Steihaug-Toint) instead follows the CG path to the point where it crosses the trust-region boundary, exploiting the negative-curvature direction to reach the boundary. The monotone-norm-increase property is what makes the trust-region truncation well defined: the CG path leaves the trust region exactly once. This furnishes a globally convergent Hessian-free method whose inner cost adapts to the local difficulty of the Newton system [Nocedal, J. & Wright, S. J. — Numerical Optimization (2nd ed.)].
Theorem 4 (global convergence of L-BFGS on convex problems). On a twice-differentiable with bounded, on the level set (strong convexity), L-BFGS with a Wolfe line search 44.03.01 and any fixed memory converges to the unique minimiser at an R-linear rate, for some . The proof bounds the eigenvalues of the implicit above and below uniformly in (the trace and determinant of stay controlled because every stored pair satisfies and ), which keeps the search direction angle-bounded and feeds Zoutendijk's condition 44.03.01. Unlike full BFGS the rate is only R-linear, not superlinear, because the finite memory cannot accumulate the full curvature; superlinearity is recovered only as [Liu, D. C. & Nocedal, J. — On the limited memory BFGS method for large scale optimization].
Theorem 5 (L-BFGS versus truncated Newton: the cost dichotomy). For a problem with variables, L-BFGS costs a fixed per outer iteration with storage and a single gradient evaluation, and needs no Hessian access; truncated Newton-CG costs storage but a variable number of Hessian-vector products per outer iteration, total inner cost , where grows as the forcing sequence tightens. The asymptotic comparison: truncated Newton attains superlinear or quadratic outer convergence (Theorem 2) and wins when Hessian-vector products are cheap and accurate (e.g. supplied by automatic differentiation 44.03.08) and the Hessian is well-conditioned, so CG converges in few inner steps; L-BFGS attains only R-linear convergence (Theorem 4) but with a fixed, predictable, low per-iteration cost and no Hessian access, so it wins when Hessian-vector products are unavailable or expensive, when the problem is noisy, or when robustness and simplicity outweigh asymptotic rate. This is the standard division in large-scale smooth optimization and machine learning [Nocedal, J. & Wright, S. J. — Numerical Optimization (2nd ed.)].
Synthesis. Large-scale unconstrained optimization is two answers to one constraint — do not store an matrix — and the foundational reason both work is that a quasi-Newton or Newton step needs only the action of a curvature operator on a vector, never the operator itself. L-BFGS realises this by storing the last secant pairs and replaying them through the two-loop recursion, which computes the exact BFGS direction of 44.03.04 for an implicit ; the central insight is that limited memory changes the representation, not the mathematics, so hereditary positive-definiteness and the Wolfe-line-search globalisation of 44.03.01 carry over unchanged, and this is exactly the same self-perpetuating curvature condition that drove full BFGS. Truncated Newton realises the same matrix-free principle differently: it solves the Newton system of 44.03.03 approximately by CG 43.07.04 through Hessian-vector products of 44.03.08, and the Dembo-Eisenstat-Steihaug theorem reveals that the forcing sequence is dual to the convergence order, so inner accuracy and outer rate are two faces of one dial. Putting these together, L-BFGS is BFGS with a memory budget and truncated Newton is Newton with an accuracy budget, and the bridge between them is the conjugate-gradient method 43.07.04, at once the inner solver of truncated Newton and the limiting behaviour of BFGS, so the two families meet exactly where the Broyden-class conjugate-direction property of 44.03.04 said they would.
The bridge forward is explicit. The negative-curvature truncation that makes Newton-CG robust generalises to the trust-region setting 44.03.02, where the Steihaug-Toint inner CG follows its path to the trust-region boundary and the indefinite Hessian is handled by the subproblem rather than forbidden; the compact representation of L-BFGS is dual to the compact form of the direct approximation used inside limited-memory trust-region methods; and the cost dichotomy between fixed-budget L-BFGS and accuracy-budget truncated Newton is the same trade between memory and asymptotic rate that separates nonlinear conjugate gradient 44.03.06 from L-BFGS one rung lower. What full BFGS 44.03.04 does for medium problems, these two methods do for the largest — one by forgetting all but the recent curvature, the other by never forming the curvature at all.
Full proof set Master
Proposition 1 (two-loop recursion computes ). Let be defined by BFGS inverse updates with pairs , , applied to . The two-loop recursion returns .
Proof. As in the Key theorem. The single-update action with is precisely one nesting of the backward reduction and the forward restoration with . The backward loop visits peeling off the factors from ; the scaling applies ; the forward loop visits restoring the factors and the rank-one terms in the reverse order, so the composed operation is exactly . The stored are reusable because at the backward visit to index equals where is the argument seen by the -th nested update.
Proposition 2 (positive-definiteness of the implicit ). If and for all stored , then and is a descent direction.
Proof. . Each BFGS inverse update preserves positive-definiteness under by hereditary positive-definiteness 44.03.04: for the update and any , , vanishing only if and ; but means , a contradiction. Inducting over the updates gives , so for .
Proposition 3 (first-order accuracy of the finite-difference Hessian-vector product). For near , .
Proof. Taylor's theorem 02.05.05 applied to gives for some on the segment. Subtract , divide by : the difference quotient equals , and bounded near makes the remainder .
Proposition 4 (inexact Newton local convergence). Under , , Lipschitz near , unit steps with : gives q-linear convergence in with factor ; gives q-superlinear; gives q-quadratic.
Proof. Write , . The exact Newton estimate under the Lipschitz Hessian gives . The inexact step is , so , whence
With and , the linear term is . Thus . For close enough the quadratic term is dominated and : q-linear with factor . If the ratio tends to : q-superlinear. If , the linear term becomes and : q-quadratic.
Proposition 5 (Newton-CG returns a descent direction). CG on from , truncated at the first nonpositive-curvature direction (returning if this is the first inner step), returns with .
Proof. CG minimises over the Krylov subspace generated, taking only positive-curvature steps before truncation. Since and each accepted step strictly decreases , the returned has , i.e. . The quadratic term is on the explored positive-curvature subspace, so . If truncation occurs at the fallback gives .
Proposition 6 (monotone norm increase of the CG path). While curvature stays positive, the CG iterates from satisfy .
Proof. CG iterates expand as over -conjugate directions with step coefficients (positive curvature). Conjugacy gives not necessarily zero, but the standard CG identity with (each has nonnegative components along the running directions, provable by induction since and with ) makes the increment strictly positive. Hence strictly increases, so the path crosses any trust-region boundary exactly once, justifying the Steihaug-Toint truncation.
Connections Master
Quasi-Newton methods (BFGS/DFP/SR1)
44.03.04are the parent construction: L-BFGS is BFGS with the inverse-Hessian approximation stored as its last generating pairs rather than as a dense matrix, and the two-loop recursion computes the exact BFGS direction for the implicit . Hereditary positive-definiteness, the curvature condition , and the secant interpretation all transfer verbatim; what changes is only that finite memory degrades the asymptotic rate from superlinear to R-linear, recovered as . The Broyden-class conjugate-direction property of that unit is the structural reason L-BFGS behaves like a preconditioned nonlinear conjugate gradient on large problems.The linear conjugate gradient method
43.07.04is the inner engine of truncated Newton: CG solves the symmetric positive-definite Newton system using only matrix-vector products, terminated early by the forcing-sequence residual test. The same CG, run on a quadratic with exact line search, coincides with full BFGS44.03.04, so conjugate gradient is the common ancestor of both large-scale families — the inner solver of inexact Newton and the limiting behaviour of the limited-memory secant method. The negative-curvature breakdown of CG on indefinite systems is exactly what forces the Newton-CG truncation.Finite-difference and automatic differentiation
44.03.08supply the Hessian-vector products that make truncated Newton Hessian-free: automatic differentiation differentiates the gradient to give the product to working precision, while the finite difference gives it to accuracy with a cancellation trade-off optimised at . Without cheap Hessian-vector products truncated Newton loses its advantage, which is precisely the regime where L-BFGS — needing no Hessian access — is preferred.Newton's method
44.03.03, trust-region methods44.03.02, and nonlinear conjugate gradient44.03.06complete the network: truncated Newton is the inexact, matrix-free realisation of Newton's method44.03.03with the forcing sequence dialing the convergence order; the negative-curvature truncation generalises to the Steihaug-Toint trust-region CG of44.03.02, where the indefinite Hessian is absorbed by the subproblem; and L-BFGS sits one rung above nonlinear conjugate gradient44.03.06in the memory hierarchy, carrying directions of curvature memory against CG's single direction, the same memory-versus-rate trade made one level down.
Historical & philosophical context Master
The limited-memory idea is due to Jorge Nocedal, whose 1980 paper showed that storing only the last few BFGS correction pairs and replaying them through a recursion preserves most of the method's speed at a fraction of the storage [Nocedal 1980]. The method was placed on a firm convergence footing by Dong C. Liu and Jorge Nocedal in 1989, who proved R-linear convergence on strongly convex problems and demonstrated that small memory ( between 3 and 20) is competitive with full BFGS on large problems while scaling to dimensions where a dense matrix is impossible [Liu-Nocedal 1989]. The two-loop recursion they popularised has become the standard direction computation in large-scale optimization libraries.
The inexact-Newton framework was formalised by Ron Dembo, Stanley Eisenstat, and Trond Steihaug in 1982, who introduced the forcing sequence and proved the local-convergence dichotomy relating it to linear, superlinear, and quadratic rates [Dembo-Eisenstat-Steihaug 1982]. Trond Steihaug in 1983 and, independently, Philippe Toint combined conjugate gradient with trust regions, giving the negative-curvature-tolerant inner solver now called Steihaug-Toint CG [Steihaug 1983]. The practical forcing-sequence choice that secures superlinear convergence at controlled cost is due to Stanley Eisenstat and Homer Walker in 1996 [Eisenstat-Walker 1996]. The convergence theory of inexact Newton descends from the classical analysis of Newton's method for operator equations by L. V. Kantorovich, whose 1948 fixed-point estimates underlie the quadratic-rate baseline these methods relax.
Bibliography Master
@article{nocedal1980lbfgs,
author = {Nocedal, Jorge},
title = {Updating quasi-Newton matrices with limited storage},
journal = {Mathematics of Computation},
volume = {35},
number = {151},
year = {1980},
pages = {773--782}
}
@article{liunocedal1989,
author = {Liu, Dong C. and Nocedal, Jorge},
title = {On the limited memory BFGS method for large scale optimization},
journal = {Mathematical Programming},
volume = {45},
number = {1--3},
year = {1989},
pages = {503--528}
}
@article{dembo1982inexact,
author = {Dembo, Ron S. and Eisenstat, Stanley C. and Steihaug, Trond},
title = {Inexact {N}ewton methods},
journal = {SIAM Journal on Numerical Analysis},
volume = {19},
number = {2},
year = {1982},
pages = {400--408}
}
@article{steihaug1983,
author = {Steihaug, Trond},
title = {The conjugate gradient method and trust regions in large scale optimization},
journal = {SIAM Journal on Numerical Analysis},
volume = {20},
number = {3},
year = {1983},
pages = {626--637}
}
@article{eisenstatwalker1996,
author = {Eisenstat, Stanley C. and Walker, Homer F.},
title = {Choosing the forcing terms in an inexact {N}ewton method},
journal = {SIAM Journal on Scientific Computing},
volume = {17},
number = {1},
year = {1996},
pages = {16--32}
}
@article{byrd1994compact,
author = {Byrd, Richard H. and Nocedal, Jorge and Schnabel, Robert B.},
title = {Representations of quasi-Newton matrices and their use in limited memory methods},
journal = {Mathematical Programming},
volume = {63},
number = {1--3},
year = {1994},
pages = {129--156}
}
@book{nocedalwright2006ln,
author = {Nocedal, Jorge and Wright, Stephen J.},
title = {Numerical Optimization},
edition = {2},
series = {Springer Series in Operations Research and Financial Engineering},
publisher = {Springer},
year = {2006}
}