35  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 \(\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 35.1 proves the step-size ceiling and iteration count and shows how momentum replaces the curvature ratio with its square root, while Section 35.3 establishes when stationary points are global minima; between them, Section 35.2 covers Newton, quasi-Newton, and trust-region methods that actively model curvature. Turning to noisy gradients, Section 35.4 shows why fixed-step SGD stalls at a noise floor proportional to the step size, and Section 35.5 tests per-coordinate scaling and AdamW against heavy-ball momentum. Finally, Section 35.6 and Section 35.7 develop KKT conditions, projections, proximal steps, and duality behind norm budgets (Section 2.7), and Section 35.8 analyzes floating-point precision, cancellation, and conditioning (Section 5.5).

We assume familiarity with gradients and Hessians (Section 34.2) and eigendecompositions (Section 33.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 35.9.

Notation

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

Table 35.1: Symbols of the optimization chapter. A star \(\star\) marks an optimum and an asterisk \(*\) a convex conjugate. Matrices are bold.
Symbol Meaning
\(f\), \(\ell(\mathbf{w})\) objective; training loss as a function of the weights
\(\mathbf{x}^\star\), \(f^\star\) a minimizer and the minimum value
\(\nabla f\), \(\nabla^2 f\), \(\mathbf{g}_k\) gradient, Hessian; the gradient (or a stochastic gradient) used at step \(k\)
\(L\), \(\mu\) smoothness and strong-convexity constants, \(\mu\mathbf{I} \preceq \nabla^2 f \preceq L\mathbf{I}\)
\(\kappa = L/\mu\); \(\kappa(\mathbf{A})\) condition number of the problem; of a matrix, \(\sigma_{\max}(\mathbf{A})/\sigma_{\min}(\mathbf{A})\)
\(\lambda_i\), \(\lambda_{\max}(\mathbf{A})\) eigenvalues of a Hessian or of a quadratic’s matrix \(\mathbf{A}\)
\(\eta\), \(\beta\) step size (learning rate); momentum coefficient
\(k\), \(t\) iteration index; optimizer step in the adaptive methods
\(\epsilon\) target accuracy; in Adam, the constant that keeps a division finite
\(n\), \(d\), \(\mathcal{B}\), \(b\) number of examples; number of variables; a minibatch and its size
\(\boldsymbol{\Sigma}\) covariance of a per-example gradient
\(\mathbf{m}_t\), \(\mathbf{v}_t\); \(\beta_1\), \(\beta_2\) Adam’s first- and second-moment estimates; their decay rates
\(\mathbf{P}\) preconditioner: the step is \(-\eta\,\mathbf{P}^{-1}\mathbf{g}\)
\(g_i\), \(h_j\) inequality constraints \(g_i(\mathbf{x}) \le 0\); equality constraints \(h_j(\mathbf{x}) = 0\)
\(\lambda\), \(\nu\) multipliers of inequality and equality constraints; \(\lambda\) also weights the decay term \(\tfrac{\lambda}{2}\|\mathbf{w}\|^2\)
\(\mathcal{L}\), \(q\) Lagrangian; dual function
\(p^\star\), \(d^\star\) optimal values of the primal and the dual problem
\(f^*\) convex conjugate of \(f\)
\(\Pi_C\), \(\mathrm{prox}_\psi\) Euclidean projection onto a set \(C\); proximal operator of \(\psi\)
\(u\), \(\varepsilon_{\mathrm{mach}}\) unit roundoff and machine epsilon of a floating-point format, \(u = \varepsilon_{\mathrm{mach}}/2\)