Introduction
Training large-scale Transformers is notoriously difficult due to early-stage instability. To prevent the model from "crashing"—where the loss suddenly diverges—researchers have traditionally relied on a heuristic known as learning rate warmup. This process involves slowly increasing the learning rate over thousands of steps. While effective, warmup is a poorly understood "hack" that complicates the training pipeline. This paper identifies the underlying cause of these crashes as Spectral Energy Concentration (SEC) and introduces AdamW², an optimization strategy that stabilizes training without architectural changes or warmup schedules.
The Root Cause: Spectral Energy Concentration
By tracking internal dynamics during training, the authors identified a phenomenon they call malignant entropy collapse. In the early stages of training, the attention maps in unstable models become extremely sparse and low-rank. This is driven by Spectral Energy Concentration (SEC) in the $W_q^\top W_k$ matrix, where energy concentrates into a few singular values, causing the model to "forget" how to attend to diverse information.
The researchers distinguish between two types of collapse:
- Benign Collapse: The attention map resembles an identity matrix (the model attends to itself), which remains stable.
- Malignant Collapse: The attention map becomes sparse and low-rank in a way that triggers numerical divergence and model crashes.
Methodology: The AdamW² Optimizer
To mitigate SEC, the authors propose AdamW², which incorporates a Steady Weights Updating Rule derived from Weyl’s Inequality. Weyl’s Inequality states that the largest singular value of a sum of matrices is bounded by the sum of their individual largest singular values: $\sigma_1(A+B) \leq \sigma_1(A) + \sigma_1(B)$.
AdamW² uses this principle to ensure that weight updates do not cause the spectral norm of the weights to grow too rapidly. The optimizer monitors the ratio between the spectral norm of the weight update ($\nabla W_t$) and the current weights ($W_{t-1}$):
$$\text{Ratio} = \frac{\sigma_1(\Delta W_t)}{\sigma_1(W_{t-1})}$$
If this ratio exceeds a predefined threshold ($\tau$), the optimizer automatically truncates the learning rate for that specific step and layer. This prevents the weights from "jumping" too far in a single direction, suppressing the growth of singular values that leads to SEC. To maintain computational efficiency, the spectral norms are estimated using a fast power iteration method (requiring only 2-3 iterations per step).
Experimental Results
The authors validated AdamW² across various architectures and tasks, demonstrating that it matches or exceeds the performance of traditional warmup methods.
Computer Vision
On ImageNet-1K, AdamW² was tested using Vision Transformers (ViT) and Swin-Transformers.
- ViT-Base: AdamW² (without warmup) achieved 80.58% accuracy, outperforming standard AdamW with warmup (80.22%).
- Scaling: The authors successfully trained a 1-billion parameter ViT-g model without any warmup. In contrast, standard AdamW crashed almost immediately under the same conditions.
Language Modeling
Using OpenWebText, the authors tested GPT-Small, GPT-Medium, and a 774M parameter nanoGPT-Large. For GPT-Small, AdamW² achieved a validation loss of 2.840, comparable to the 2.848 achieved with traditional warmup schedules.
Key Insights
- Optimizer-Level Stability: Unlike previous solutions like Pre-LayerNorm or QKNorm that modify the model architecture, AdamW² proves that stability can be achieved entirely through the optimizer by controlling the smoothness of weight updates.
- Automated Control: AdamW² effectively acts as a per-step, per-layer automated warmup mechanism that only intervenes when the model is at risk of instability.
- Robustness: The strategy is robust across different values of the hyperparameter $\tau$, with defaults between 0.003 and 0.01 working across most vision and language experiments.
Limitations and Future Work
While AdamW² offers a significant step forward in simplifying Transformer training, it introduces a new hyperparameter, $\tau$, and a small amount of computational overhead due to the power iteration steps. Additionally, while the empirical results are strong for multi-head attention, the current theoretical analysis focuses primarily on single-head attention, leaving room for more rigorous multi-head proofs in future research.
Summary updated