Continuous-Time Analysis of Adaptive Optimization and Normalization

Rhys Gould, Hidenori Tanaka · Submission to ICLR 2025 · Rejected

TL;DR

By analyzing Adam and AdamW through the lens of continuous-time differential equations, the authors uncover the mathematical mechanism behind Adam's stability and why normalization layers help networks generalize. This theoretical framework reveals a strict stability boundary for Adam’s hyperparameters and introduces $k$-Adam, a generalized optimizer that explicitly embeds the "meta-adaptive" benefits of architectural normalization.

What Problem Does This Paper Address?

Despite being the standard optimizer for large language models and modern deep learning, Adam’s training dynamics remain poorly understood theoretically. Practitioners rely on empirical rules of thumb—such as default momentum/second-moment decay values ($\beta_1=0.9, \beta_2=0.999$) and pairing Adam with normalization layers (LayerNorm, BatchNorm, QK-Norm).

The authors address two foundational questions:

  1. Hyperparameter Stability: Why do certain hyperparameter choices ensure stable training while others cause training to explode?
  2. The Mechanism of Normalization: Why does architectural scale invariance (e.g., LayerNorm) improve optimization beyond simply constraining weight magnitudes?

Methods

The authors transition the discrete updates of Adam and AdamW into continuous-time representations using ordinary differential equations (ODEs):

  • Continuous-Time Representation: Moving averages of the gradients $m(t)$ and squared gradients $v(t)$ are rewritten as continuous convolutions with exponential decay kernels. AdamW is formulated as a second-order differential equation: $$\lambda\eta \theta(t) + \eta \dot{\theta}(t) + \frac{\eta^2}{2} \ddot{\theta}(t) = -\eta u(t)$$
  • Cauchy-Schwarz Max-Update Bound: Using their continuous formulation, the authors apply the Cauchy-Schwarz inequality to bound the maximum update magnitude $\|u_n\|_\infty$. This reveals a stability criterion function: $$C(\beta, \gamma) := \frac{2\beta(1-\gamma) - \gamma(1-\beta)}{\beta\gamma}$$ (Note: $\beta$ denotes the second-moment decay $\beta_2$, and $\gamma$ denotes the first-moment decay $\beta_1$). Updates remain bounded if $C(\beta, \gamma) > 0$ (region $\mathcal{B}_+$), but grow exponentially when $C(\beta, \gamma) < 0$ (region $\mathcal{B}_-$).

  • Scale-Invariance & Meta-Adaptivity: For scale-invariant weights $W$ (where $L(\alpha W) = L(W)$), the weight norm $\|W(t)\|^2$ mathematically mimics an exponential moving average of $\|u_W(t)\|^2$. Consequently, the directional updates $\hat{W}$ undergo an adaptive normalization of an already adaptively normalized update—a phenomenon termed meta-adaptive normalization.

  • $k$-Adam Optimizer: The authors turn this implicit architectural effect into an explicit optimization algorithm. $k$-Adam applies $k$ successive rounds of adaptive normalization ($k=1$ is standard Adam, while $k=2$ corresponds to Adam optimizing scale-invariant weights).

Datasets

The authors evaluated their findings on two standard benchmarks:

  • Shakespeare (Character-Level): Used to train a 6-layer decoder-only nanoGPT model to observe update bounds, parameter divergence, and test loss trajectories.
  • CIFAR-10: Used with an 8-layer Convolutional Neural Network (CNN) with Batch Normalization to benchmark the performance of the proposed $k$-Adam optimizer across $k \in \{1, \dots, 10\}$.

No new datasets or benchmarks were introduced.

Key Insights and Ideas

  • Theoretical Proof for Default Hyperparameters: The condition $\beta > \gamma$ (i.e., $\beta_2 > \beta_1$) is a sufficient condition for $C(\beta, \gamma) > 0$. This rigorously explains why PyTorch defaults ($\beta_2 = 0.999, \beta_1 = 0.9$) provide stable optimization.
  • Predictable Exponential Explosion: In the unstable region $C(\beta, \gamma) < 0$, the update norm $\|u_n\|_\infty$ diverges exponentially at a rate precisely equal to $|C(\beta, \gamma)|/2$. Empirical tests match this theoretical exponent almost exactly.
  • Speed of Generalization: Along level curves of hyperparameter space, points with larger $C(\beta, \gamma)$ values converge to low test loss noticeably faster in early-to-mid training.
  • Normalization Layers are "Nested Optimizers": Rather than just keeping activations or weights within a healthy numerical scale, scale-invariant layers implicitly turn Adam into a nested, second-order adaptive optimizer (2-Adam).

Key Results

  • Empirical Divergence Rate: When testing 64 hyperparameter pairs along a trajectory crossing into $\mathcal{B}_-$, the empirical slope $\frac{d}{dn} \log \|u_n\|_\infty$ matched the theoretical prediction $|C(\beta, \gamma)|/2$ with near-perfect accuracy.
  • Faster Generalization in $\mathcal{B}_+$: On nanoGPT, hyperparameter configurations with higher values of $C(\beta, \gamma)$ reached lower test loss hundreds of iterations earlier (e.g., at iteration 1,000, test loss dropped from $\approx 2.8$ near the boundary to $\approx 1.7$ at optimal values).
  • $k$-Adam Outperforms Adam: On CIFAR-10, $2$-Adam using an "inverse exponential" hyperparameter schedule and decoupled weight decay surpassed AdamW ($k=1$), boosting top-1 test accuracy from $\sim 89.2\%$ to over $90.5\%$.

Limitations and Future Work

  • Generalization Bounds: While the paper proves update stability ($C > 0$), it only empirically observes—rather than theoretically proves—that higher $C(\beta, \gamma)$ values accelerate generalization.
  • Incomplete Picture of Normalization: Meta-adaptive normalization explains one beneficial aspect of scale invariance, but does not capture other established benefits of normalization layers, such as preventing attention rank collapse or smoothing the loss landscape.
  • Heuristic Learning Rate Annealing: Attempting to rescue unstable hyperparameter regimes ($C < 0$) using exponential learning rate decay throttled updates too aggressively, failing to match the performance of $\mathcal{B}_+$.
  • Scope of Optimizer Evaluation: $k$-Adam was only evaluated on a small CNN on CIFAR-10; testing at scale on large language models or under noisy small-batch regimes remains future work.

Summary updated

BibTeX
@misc{gould2024continuous,
  author = {Rhys Gould and Hidenori Tanaka},
  title = {{Continuous-Time Analysis of Adaptive Optimization and Normalization}},
  year = {2024},
  eprint = {2411.05746},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.05746},
}
Figure