A quasi-Newton method is an iterative algorithm for smooth unconstrained optimization that approximates the Hessian matrix (or its inverse) from successive gradient evaluations instead of computing second derivatives directly. In optimization for artificial intelligence, the family sits between plain gradient descent and full Newton’s method: it keeps much of the fast local convergence of Newton steps while paying roughly the cost of a gradient method per iteration.
The best-known members are BFGS, its limited-memory variant L-BFGS, DFP and the SR1 update. They are standard tools for fitting logistic regression, conditional random fields, Gaussian process hyperparameters and many other deterministic, moderately sized objectives.
How a quasi-Newton method builds curvature information
A quasi-Newton method learns curvature from the way the gradient changes between iterates. After a step s = x(k+1) – x(k), the algorithm records the gradient difference y = g(k+1) – g(k) and updates its matrix so that it satisfies the secant condition, B(k+1) s = y. This condition states that the model must reproduce the observed change in slope along the direction just traveled.
Each iteration follows the same loop. The method computes a search direction p = -H g, where H approximates the inverse Hessian, runs a line search to choose a step length, moves to the new point and applies a low-rank update to H. Because the update has rank one or two, it costs O(n squared) operations for a dense matrix instead of the O(n cubed) needed to factor a true Hessian.
The table below summarizes the elements that every quasi-Newton iteration manipulates and the role each one plays.
| Component | Symbol | Role in the iteration |
|---|---|---|
| Gradient | g(k) | First-order slope at the current point |
| Step vector | s(k) | Displacement between successive iterates |
| Gradient difference | y(k) | Observed change in slope along the step |
| Inverse Hessian estimate | H(k) | Turns the gradient into a search direction |
| Line search | alpha(k) | Scales the step to ensure sufficient decrease |
Main update formulas: BFGS, DFP, SR1 and L-BFGS
The variants differ in how they modify the matrix while respecting the secant condition. BFGS, named after Broyden, Fletcher, Goldfarb and Shanno, applies a rank-two update that keeps the inverse Hessian estimate symmetric and positive definite whenever the curvature condition y’s > 0 holds. That property guarantees that every search direction points downhill.
The following comparison shows where each update performs best and what it costs.
| Update | Rank | Memory | Typical strength |
|---|---|---|---|
| BFGS | Two | O(n squared) | Robust default for small and medium problems |
| DFP | Two | O(n squared) | Historical predecessor, less self-correcting |
| SR1 | One | O(n squared) | Can model indefinite curvature in trust regions |
| L-BFGS | Two per pair | O(mn) | Large problems with thousands to millions of variables |
L-BFGS never stores the matrix. It keeps only the last m step and gradient pairs, typically m between 3 and 20, and reconstructs the product H g with the two-loop recursion. This reduces memory from quadratic to linear in the number of variables, which is why L-BFGS is the practical choice for high-dimensional machine learning models. Bound-constrained work often uses L-BFGS-B, which adds projection onto box constraints.
How it compares with gradient descent and Newton’s method
A quasi-Newton method occupies the middle ground between first-order and second-order optimization. Gradient descent converges only linearly and slows badly on ill-conditioned problems, while Newton’s method converges quadratically near a minimum but requires forming and solving with the full Hessian. Quasi-Newton methods achieve superlinear convergence without any second derivatives.
| Method | Curvature information | Local convergence | Cost per iteration |
|---|---|---|---|
| Gradient descent | None | Linear | One gradient |
| Conjugate gradient method | Implicit, via conjugacy | Linear to n-step | One gradient, few vectors |
| Quasi-Newton (BFGS) | Approximated from gradients | Superlinear | One gradient plus O(n squared) |
| Newton’s method | Exact Hessian | Quadratic | Hessian plus O(n cubed) solve |
In practice, the condition number of the problem decides how much the curvature model helps. On well-conditioned objectives plain gradient methods are competitive, but on stretched, narrow valleys a quasi-Newton method can need orders of magnitude fewer iterations because its direction already accounts for unequal curvature across coordinates.
Using quasi-Newton methods in machine learning
Quasi-Newton methods work best on smooth, deterministic objectives where exact or nearly exact gradients are available. Typical cases include full-batch training of generalized linear models, maximum likelihood fitting, Gaussian process marginal likelihood optimization and the inner solvers of many scientific computing libraries.
The decision table below links common situations to a sensible choice.
| Situation | Recommended choice | Reason |
|---|---|---|
| Fewer than a few thousand variables | Dense BFGS | Full matrix fits in memory and adapts quickly |
| Millions of variables, full-batch gradients | L-BFGS | Linear memory with strong convergence |
| Simple bounds on parameters | L-BFGS-B | Handles box constraints by projection |
| Noisy mini-batch gradients | Adam or SGD | Curvature pairs become unreliable under noise |
| Exact Hessian is cheap and small | Newton’s method | Quadratic convergence justifies the cost |
Configuration matters as much as the update rule. A line search satisfying the Wolfe conditions keeps the curvature condition true and preserves positive definiteness, and a scaled initial matrix, often gamma times the identity with gamma = s’y / y’y, gives the first steps a sensible size.
Limitations and common mistakes
The main weakness of quasi-Newton methods is their sensitivity to gradient noise. With stochastic mini-batches, the difference y mixes curvature with sampling error, so the matrix can become badly scaled or lose positive definiteness. Stochastic variants exist, but adaptive first-order methods remain the norm for training deep neural networks.
- Skipping the curvature check: an update with y’s close to zero can corrupt the matrix, so robust codes skip or damp such updates.
- Using a crude line search: a fixed step size breaks the guarantees that make BFGS reliable.
- Applying dense BFGS at scale: the n by n matrix becomes infeasible beyond tens of thousands of variables.
- Expecting global optimality: on non-convex objectives the method finds a local optimum or saddle point, not a global minimum.
Nonsmooth objectives, such as those with L1 penalties, also violate the method’s assumptions. Specialized variants like OWL-QN or proximal approaches handle such terms more reliably than an unmodified quasi-Newton update.
The short version
Imagine walking downhill in thick fog. You can feel the slope under your feet, but you cannot see the shape of the valley. A quasi-Newton method remembers how the slope changed after each step. From that memory, it builds a rough map of the terrain.
That map tells the walker which way leads down most directly and how long the next stride should be. The result is far fewer steps than simple downhill walking, without the expense of surveying the whole valley first.
Where it makes a difference
A data science team at an insurance company fits a regularized logistic regression to predict claim fraud. The model has about 200,000 sparse features and trains on two million policies, and the full gradient can be computed in a few seconds on one server.
With plain gradient descent, the loss still decreases slowly after several thousand iterations because some features are rare and others are very common, which makes the problem ill-conditioned. The team switches to L-BFGS with a memory of 10 pairs and a Wolfe line search.
The solver reaches the same validation loss in about 150 iterations, and a complete retraining run drops from hours to minutes. This lets the team retrain nightly and test new features the same day.