Newton's Method and BFGS
Newton uses local curvature to pick both direction and step length, and BFGS rebuilds that curvature from past gradients so the step stays affordable.
Why Does This Exist?
Gradient descent knows the slope but not the shape. In a narrow valley it zigzags, and on a flat plateau it crawls, because one shared step size cannot suit every direction. The fix is curvature: fit a local quadratic, then jump to its minimum in one move.
That move is Newton's method. It converges very fast near a minimum but pays for the Hessian and its solve on every step. BFGS keeps the idea and drops the bill by rebuilding curvature from the gradients already seen, which is why limited-memory BFGS still optimizes medium models and scientific losses today. The optimality picture sits in optimality conditions, the convex setting where the quadratic model is trustworthy sits in convex optimization, and the behavior-space cousin sits in natural gradient.
The one idea you need first
A Hessian is the matrix of second derivatives. It says how fast the slope itself turns in each direction. Write for that matrix, for the gradient vector, and for a step. Newton solves and then moves by . When is positive definite, that points downhill with a length the curvature chose.
Think of It Like This
Skiing by feel against skiing with a contour map
A skier who only feels the slope under their boots picks a direction but must guess how far to glide. Too short wastes runs, too long overshoots the dip and climbs the far wall.
Give that skier a contour map of the bowl. One glance shows both the fall line and how tightly the bowl curves, so the glide length picks itself: short where the bowl bends hard, long where it opens flat. Newton skis with the map. BFGS sketches the map from remembered slopes at each turn, which is cheaper than surveying the whole bowl and close enough to glide well.
Where the picture stops: real losses are not bowls everywhere, and a quadratic map drawn at a saddle points at the wrong place entirely.
How It Actually Works
At , replace the loss with its second-order Taylor model and minimize that model:
Here is the Hessian at and the gradient there. On a quadratic the model is exact, so the method lands on the minimum in one step. Near a smooth minimum it converges quadratically, roughly doubling correct digits per step once close.
BFGS never forms . It keeps an approximation updated from the step and the gradient change so that , called the secant condition. L-BFGS stores only the last few pairs and applies through two loops, which costs linear memory in the parameter count.
Worked example
Take starting at .
Gradient: , so . Hessian: everywhere. Newton step:
Check: . At , and , so this is the stationary point, and positive confirms a minimum. One step done, because the quadratic model was the function itself.
The secant pair for BFGS is and . Ratio recovers the true curvature exactly here. A gradient step with size would have moved only to with loss , still far from .
Code
The snippet below takes the Newton step computed by hand and compares it with one small gradient step.
def f(x: float) -> float: return x**2 + 2 * x + 5
def grad(x: float) -> float: return 2 * x + 2 # derivative of x^2 + 2x + 5
x0 = 2.0h = 2.0 # constant Hessian for this quadraticx_newton = x0 - grad(x0) / h # exact curvature stepx_grad = x0 - 0.1 * grad(x0) # one small first-order stepprint(round(x_newton, 3)) # -> -1.0print(round(f(x_newton), 3)) # -> 4.0 minimum in one jumpprint(round(x_grad, 3)) # -> 1.4 still far awayNewton lands on with loss . The gradient step reaches only .
Watch Out For
Trusting the quadratic model far from a minimum
Newton minimizes the local quadratic, not the loss. Where the Hessian has negative curvature, that quadratic opens downward along some direction and its minimum sits at a saddle or a maximum, so the raw step can climb or diverge.
Symptom: loss jumps up, parameters blow past sensible bounds, or iterates stick at a saddle with zero gradient. Fix: never take the raw step globally, add a line search or trust region, and shift indefinite Hessians toward positive definite before solving.
Feeding BFGS stale or scaled curvature
BFGS curvature comes from history, so rescaled parameters, restarted runs, or noisy stochastic gradients poison the pairs. The approximation then reports curvature that no longer describes the current bowl.
Symptom: steps shorten to nothing, direction degrades below gradient descent, or L-BFGS restarts help more than extra pairs. Fix: skip pairs with too small, refresh the memory after rescaling, and prefer plain stochastic first-order methods when gradients stay noisy.
The Quick Version
- Newton solves and steps by , so curvature picks both direction and length.
- On a quadratic it finishes in one step, and near a smooth minimum it converges very fast.
- BFGS rebuilds curvature from step and gradient-change pairs, and L-BFGS keeps only recent pairs.
- The fixture moves Newton from to with loss to , while a small gradient step reaches only .
- Raw Newton steps need a line search or trust region away from minima.
- BFGS needs fresh pairs with positive , or its map goes stale.