Chapter 23

23 Optimization

Every neural network in this book is trained by the same basic loop: compute the gradient of the loss, take a step in the opposite direction, and repeat. In Chapter 9, we saw empirically what momentum, adaptive step sizes, and learning-rate schedules do for that loop on real networks, leaving three questions open. Why is there a hard ceiling on the learning rate? Why can a step safely below that ceiling still make painfully slow progress? And why does gradient noise keep a training run from settling down?

Optimization theory ties each question to the geometry of the objective. The steepest curvature sets the largest safe step size; the ratio of the steepest curvature to the flattest sets the iteration count; and convexity decides whether a stationary point is globally optimal. Throughout this chapter, we return to the narrow bowl 12(x12+1000 x22)\tfrac12(x_1^2 + 1000\,x_2^2), which is a thousand times steeper in one direction than in the other: a step size that stays safe along the steep wall barely nudges the iterate along the flat valley. While Chapter 9 focuses on practice and measurement, this chapter supplies the self-contained proofs and underlying geometry.

The chapter unfolds in three parts. Under exact gradients, Section 23.1 proves the step-size ceiling and iteration count and shows how momentum replaces the curvature ratio with its square root, while Section 23.3 establishes when stationary points are global minima; between them, Section 23.2 covers Newton, quasi-Newton, and trust-region methods that actively model curvature. Turning to noisy gradients, Section 23.4 shows why fixed-step SGD stalls at a noise floor proportional to the step size, and Section 23.5 tests per-coordinate scaling and AdamW against heavy-ball momentum. Finally, Section 23.6 and Section 23.7 develop KKT conditions, projections, proximal steps, and duality behind norm budgets (Section 2.7), and Section 23.8 analyzes floating-point precision, cancellation, and conditioning (Section 5.5).

We assume familiarity with gradients and Hessians (Section 22.2) and eigendecompositions (Section 21.3). Because deep-network losses are neither globally smooth nor convex, our theorems serve as local models whose limits each section notes explicitly; interior-point and operator-splitting methods are surveyed in Section 23.9.

Notation#

Throughout this chapter, we follow the conventions summarized in Table 23.1. Each section restates the symbols it uses most, and notation specific to a single section is introduced where it first appears.

Table 23.1. Symbols of the optimization chapter. A star ⋆\star marks an optimum and an asterisk ∗* a convex conjugate. Matrices are bold.
SymbolMeaning
ff, ℓ(w)\ell(\mathbf{w})objective; training loss as a function of the weights
x⋆\mathbf{x}^\star, f⋆f^\stara minimizer and the minimum value
∇f\nabla f, ∇2f\nabla^2 f, gk\mathbf{g}_kgradient, Hessian; the gradient (or a stochastic gradient) used at step kk
LL, μ\musmoothness and strong-convexity constants, μI⪯∇2f⪯LI\mu\mathbf{I} \preceq \nabla^2 f \preceq L\mathbf{I}
κ=L/μ\kappa = L/\mu; κ(A)\kappa(\mathbf{A})condition number of the problem; of a matrix, σmax⁡(A)/σmin⁡(A)\sigma_{\max}(\mathbf{A})/\sigma_{\min}(\mathbf{A})
λi\lambda_i, λmax⁡(A)\lambda_{\max}(\mathbf{A})eigenvalues of a Hessian or of a quadratic's matrix A\mathbf{A}
η\eta, β\betastep size (learning rate); momentum coefficient
kk, ttiteration index; optimizer step in the adaptive methods
ϵ\epsilontarget accuracy; in Adam, the constant that keeps a division finite
nn, dd, B\mathcal{B}, bbnumber of examples; number of variables; a minibatch and its size
Σ\boldsymbol{\Sigma}covariance of a per-example gradient
mt\mathbf{m}_t, vt\mathbf{v}_t; β1\beta_1, β2\beta_2Adam's first- and second-moment estimates; their decay rates
P\mathbf{P}preconditioner: the step is −η P−1g-\eta\,\mathbf{P}^{-1}\mathbf{g}
gig_i, hjh_jinequality constraints gi(x)≤0g_i(\mathbf{x}) \le 0; equality constraints hj(x)=0h_j(\mathbf{x}) = 0
λ\lambda, ν\numultipliers of inequality and equality constraints; λ\lambda also weights the decay term λ2∥w∥2\tfrac{\lambda}{2}\|\mathbf{w}\|^2
L\mathcal{L}, qqLagrangian; dual function
p⋆p^\star, d⋆d^\staroptimal values of the primal and the dual problem
f∗f^*convex conjugate of ff
ΠC\Pi_C, proxψ\mathrm{prox}_\psiEuclidean projection onto a set CC; proximal operator of ψ\psi
uu, εmach\varepsilon_{\mathrm{mach}}unit roundoff and machine epsilon of a floating-point format, u=εmach/2u = \varepsilon_{\mathrm{mach}}/2