Optimization

Dive into Deep Learning · §35

Mathematics for Deep Learning: Optimization
smoothness · condition number · momentum · curvature · convexity · stochastic noise · preconditioning · duality · numerics

Three Questions Every Training Loop Leaves Open

Motivation

  • Why is there a hard step-size ceiling? Stepping past 2/L along the steepest direction overshoots the valley wall and increases the loss.
  • Why do safe steps crawl? When curvatures differ by \kappa = L/\mu, the steepest wall caps \eta while the flattest direction stalls.
  • Why does minibatch noise stop above f^\star? Constant-step SGD settles into a stationary noise ball of loss \propto \eta\sigma^2/b.

The Running Benchmark: An Ill-Conditioned Valley

Unifying Thread

We test every theorem against f(\mathbf{x}) = \tfrac12(x_1^2 + 1000\,x_2^2) (\mu = 1, L = 1000, \kappa = 1000):

  • First-order scaling: Fixed-step GD takes 6{,}908 steps (O(\kappa)), while Heavy-Ball and Nesterov momentum take 315–508 steps (O(\sqrt{\kappa})).
  • Preconditioning vs. rotation: Exact Newton finishes in 1 step. Aligned Adam reaches f < 10^{-8} in 22–48 steps, a test that takes GD 6{,}160 steps, but 45^\circ rotation breaks diagonal scaling.
  • Stochastic noise floor: Constant-step SGD (\eta = 10^{-3}, \sigma^2 = 1) stalls at loss 7.5 \times 10^{-4}.

Architecture of Chapter 35: Three Core Parts

Chapter Roadmap

  • Part I: Exact Gradients & Geometry (§§35.1–35.3): L-smoothness descent lemma, \kappa vs. \sqrt{\kappa} momentum law, Newton/BFGS/trust regions, and convexity guarantees.
  • Part II: Stochastic & Adaptive Methods (§§35.4–35.5): The 1/b variance law, stationary noise floors, Robbins–Monro schedules, AdamW, and matrix preconditioning (K-FAC, Muon).
  • Part III: Constraints, Duality & Numerics (§§35.6–35.8): KKT conditions, projections, proximal ISTA, Fenchel duality, and floating-point conditioning.

Core Mathematical Quantities and Notation

Notation Reference

  • Curvature & Conditioning:
    • L, \mu: Smoothness ceiling and strong-convexity floor, \mu\mathbf{I} \preceq \nabla^2 f(\mathbf{x}) \preceq L\mathbf{I}.
    • \kappa = L/\mu: Problem condition number; for a matrix \mathbf{A}, \kappa(\mathbf{A}) = \sigma_{\max}(\mathbf{A})/\sigma_{\min}(\mathbf{A}).
    • \mathbf{P}: Preconditioner matrix rescaling the step to -\eta \mathbf{P}^{-1}\mathbf{g}_k.
  • Stochastic & Adaptive State:
    • \boldsymbol{\Sigma}, b: Per-example gradient covariance and minibatch size (noise power \operatorname{tr}\boldsymbol{\Sigma}/b).
    • \mathbf{m}_t, \mathbf{v}_t: First- and second-moment moving averages with decay factors \beta_1, \beta_2.
  • Constraints, Duality & Operators:
    • g_i(\mathbf{x}) \le 0, h_j(\mathbf{x}) = 0: Inequality and equality constraints with multipliers \lambda_i \ge 0 and \nu_j.
    • \mathcal{L}, q, p^\star, d^\star: Lagrangian, dual function, primal optimum, and dual optimum (d^\star \le p^\star).
    • f^*, \Pi_C, \mathrm{prox}_\psi: Convex conjugate, Euclidean projection onto C, and proximal operator.
  • Floating-Point Precision:
    • \varepsilon_{\mathrm{mach}} = 2^{-p}, u = 2^{-p-1}: Machine epsilon and unit roundoff for p mantissa bits.

How to Navigate This Chapter

Study Guide

  • Essential Core (§35.1 & §35.3): Start here for the 2/L step ceiling, \sqrt{\kappa} momentum speedup, tangent lower bounds, Jensen’s inequality, and global convergence rates.
  • Deep Learning Workhorses (§35.4 & §35.5): Read next for SGD noise floors, cosine/WSD schedules, Adam scale invariance, decoupled AdamW, and Muon.
  • On-Demand Deep Dives (§35.2, §§35.6–35.8): Consult for L-BFGS/trust regions, KKT/projections/ISTA, Fenchel duality, and bf16 numerical stability.