§8.6.2 Conjugate gradients
Conjugate gradients conjugate gradients Avoid inverting H by descending H-conjugate directions dₜ = ∇J + βₜdₜ₋₁ (βₜ via Fletcher–Reeves or Polak–Ribière), eliminating steepest descent's zig-zag; ≤ k line searches minimize a k-dim quadratic. Nonlinear CG adds occasional resets. defined in ch. 8 — open in glossary 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):
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
| blend the current gradient with a fraction βₜ of the PREVIOUS search direction, so the new step does not undo the last one | the new direction | |
| the conjugacy condition — H-orthogonal (not plain orthogonal). This guarantees ≤ k line searches to minimize a k-dimensional quadratic | conjugacy | |
| 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 losses | cheap β |
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 quasi-newton method A second-order method that APPROXIMATES the inverse Hessian rather than computing it exactly (BFGS is the prominent example), gaining Newton-like directions without the O(k³) inversion. defined in ch. 8 — open in glossary methods take a more direct route than CG: rather than avoid the inverse Hessian, they approximate it. BFGS bfgs / l-bfgs Quasi-Newton: iteratively approximate H⁻¹ with a matrix Mₜ refined by low-rank updates (BFGS, O(n²) memory), tolerant of loose line searches; L-BFGS starts M as the identity each step and stores only O(n) recent vectors — the practical variant for large models. defined in ch. 8 — open in glossary maintains a matrix , refined by low-rank updates each step, and descends with a line search. Unlike CG, BFGS does not need the line search to be very accurate — but it must store the full , costing memory, hopeless for million-parameter nets. L-BFGS fixes that by never storing : it assumes the previous estimate was the identity and reconstructs the direction from a few recent vectors, at per step. The four second-order options:
| curvature info | memory / cost | notes | |
|---|---|---|---|
| Newton | exact inverse Hessian H⁻¹ | O(k²) store · O(k³) invert | one jump on a quadratic; infeasible for large nets |
| Conjugate gradients | implicit, via conjugate directions | O(k) | ≤ k line searches; needs an accurate line search; nonlinear CG resets |
| BFGS | approximates H⁻¹ with M (low-rank updates) | O(n²) to store M | tolerant of loose line searches, but too much memory for large nets |
| L-BFGS | same, but M reset to identity each step | O(n) per step | the practical quasi-Newton — stores only a few recent vectors |
§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'?