§8.6.2–8.7Conjugate Gradients · BFGS · Optimization Strategies & Meta-Algorithms

Part II DL pp. 313–317 · ~3 min read

  • conjugate gradients
  • conjugate directions
  • quasi-newton method
  • bfgs / l-bfgs

§8.6.2 Conjugate gradients

Conjugate gradients gets Newton-like speed without ever inverting the Hessian. It starts from a flaw in steepest descent: each line search minimizes along the current gradient, but the gradient at the end of a line search is orthogonal to that search direction — so the next step is perpendicular, and on an elongated bowl the path zig-zags, repeatedly undoing progress along earlier directions (fig 8.6):

minstartsteepest descent: zig-zag (each step ⟂ the last)conjugate: ≤ k steps

The fix: choose each search direction to be conjugate to the previous one — so it does not spoil the minimization already achieved:

Term by term

dt=θJ+βtdt1,dtHdt1=0\boldsymbol{d}_t = \nabla_{\boldsymbol{\theta}} J + \beta_t\, \boldsymbol{d}_{t-1}, \qquad \boldsymbol{d}_t^\top \boldsymbol{H}\, \boldsymbol{d}_{t-1} = 0
J+βtdt1\nabla J + \beta_t\boldsymbol{d}_{t-1}blend the current gradient with a fraction βₜ of the PREVIOUS search direction, so the new step does not undo the last onethe new direction
dtHdt1=0\boldsymbol{d}_t^\top \boldsymbol{H}\boldsymbol{d}_{t-1} = 0the conjugacy condition — H-orthogonal (not plain orthogonal). This guarantees ≤ k line searches to minimize a k-dimensional quadraticconjugacy
βt (FR / PR)\beta_t\ \text{(FR / PR)}computed from gradient norms alone (Fletcher–Reeves) or gradient differences (Polak–Ribière) — no Hessian eigenvectors needed. Nonlinear CG adds occasional resets for non-quadratic lossescheap β

For non-quadratic neural-net losses, the conjugate guarantees weaken, so nonlinear conjugate gradients restarts periodically along the plain gradient; it often helps to warm up with a few SGD iterations first.

§8.6.3 BFGS and L-BFGS

Quasi-Newton methods take a more direct route than CG: rather than avoid the inverse Hessian, they approximate it. BFGS maintains a matrix MtH1\boldsymbol{M}_t \approx \boldsymbol{H}^{-1}, refined by low-rank updates each step, and descends ρt=Mtgt\boldsymbol{\rho}_t = \boldsymbol{M}_t\boldsymbol{g}_t with a line search. Unlike CG, BFGS does not need the line search to be very accurate — but it must store the full M\boldsymbol{M}, costing O(n2)O(n^2) memory, hopeless for million-parameter nets. L-BFGS fixes that by never storing M\boldsymbol{M}: it assumes the previous estimate was the identity and reconstructs the direction from a few recent vectors, at O(n)O(n) per step. The four second-order options:

Second-order and quasi-Newton methods
curvature infomemory / costnotes
Newtonexact inverse Hessian H⁻¹O(k²) store · O(k³) invertone jump on a quadratic; infeasible for large nets
Conjugate gradientsimplicit, via conjugate directionsO(k)≤ k line searches; needs an accurate line search; nonlinear CG resets
BFGSapproximates H⁻¹ with M (low-rank updates)O(n²) to store Mtolerant of loose line searches, but too much memory for large nets
L-BFGSsame, but M reset to identity each stepO(n) per stepthe practical quasi-Newton — stores only a few recent vectors
Dotted-underlined cells have explanations — click one.

§8.7 Optimization strategies and meta-algorithms

Not every useful technique is a full optimization algorithm. Many are general templates that specialize into algorithms, or subroutines that plug into many different optimizers. The rest of the chapter covers these — batch normalization, coordinate descent, Polyak averaging, pretraining, model design, and continuation methods.

Next: batch normalization, coordinate descent, and Polyak averaging — batch norm & meta-algorithms.

Check yourself — conjugate gradients, BFGS, and meta-algorithms

1.Why does steepest descent zig-zag on an elongated quadratic bowl?

2.What makes two search directions 'conjugate', and why does it help?

3.How is βₜ computed in conjugate gradients, and what changes for neural nets?

4.How do BFGS and L-BFGS relate to Newton's method?

5.What does §8.7 mean by 'optimization strategies and meta-algorithms'?

5 questions