SOAP: Improving and Stabilizing Shampoo using Adam for Language Modeling

Nikhil Vyas, Depen Morwani, Rosie Zhao, Itai Shapira, David Brandfonbrener, Lucas Janson, Sham M. Kakade

Training Large Language Models (LLMs) is notoriously expensive, making optimization efficiency a multi-billion dollar problem. While AdamW is the industry standard, researchers have long known that "second-order" methods like Shampoo can converge faster by using more sophisticated preconditioning. However, Shampoo's complexity and computational overhead have hindered its widespread adoption.

A new paper introduces SOAP (ShampoO with Adam in the Preconditioner’s eigenbasis), a streamlined optimizer that delivers the benefits of Shampoo with the stability and simplicity of Adam.

TL;DR

SOAP is a novel optimizer that runs AdamW in the eigenbasis of a Shampoo-style preconditioner. It achieves over a 40% reduction in training iterations and a 35% reduction in wall-clock time compared to AdamW, while being significantly more robust and easier to tune than standard Shampoo.

What Problem Does This Paper Address?

Most modern deep learning relies on first-order optimizers like AdamW, which scale gradients element-wise. Second-order methods like Shampoo use a richer "preconditioner" to account for correlations between different weights, leading to faster convergence.

However, Shampoo has two major "deal-breakers":

  1. Computational Overhead: It requires frequent, expensive matrix eigendecompositions. If you try to save time by doing these less often, performance typically degrades.
  2. Hyperparameter Hell: It introduces several new hyperparameters that are difficult to tune compared to the well-understood AdamW.

Methods

The researchers' key breakthrough was establishing a formal mathematical connection: they proved that a specific variant of Shampoo is equivalent to running Adafactor (a memory-efficient version of Adam) in the eigenbasis of the Shampoo preconditioner.

Building on this, they designed SOAP:

  • Basis Rotation: SOAP rotates the gradients into the eigenbasis of the second-moment matrix. In this rotated space, the "important" directions of the gradient are aligned with the coordinate axes.
  • Adam in the Eigenbasis: It then applies standard AdamW updates (maintaining first and second moments) within this rotated space.
  • Stabilized Updates: Crucially, SOAP continues to update its second-moment estimates at every single step, even between the expensive eigendecomposition updates. By doing this in the current coordinate basis, it maintains stability even when the preconditioning frequency is very low.
  • Simplicity: SOAP adds only one additional hyperparameter over AdamW: the preconditioning frequency.

Datasets

The authors evaluated SOAP on language model pre-training tasks using the C4 (Colossal Clean Crawled Corpus) dataset. They tested models ranging from 210M to 660M non-embedding parameters, following "Chinchilla-optimal" training schedules (approx. 20 tokens per parameter) as well as longer runs (up to 100x model size).

Key Insights and Ideas

  • The Adafactor Connection: The realization that Shampoo is essentially "Adafactor in a rotated space" provides a powerful conceptual bridge between first-order and second-order methods.
  • Coordinate Stability: The "aha moment" for efficiency was realizing that while the eigenbasis changes slowly, the magnitudes in that basis change quickly. By updating Adam's second moment at every step in the current basis, SOAP avoids the performance "cliff" that Shampoo hits when eigendecompositions are infrequent.
  • Scaling Critical Batch Size: SOAP significantly increases the "critical batch size"—the point at which increasing the batch size no longer provides linear speedups. This makes it a prime candidate for massive-scale distributed training.

Key Results

  • Massive Speedups: On 660M parameter models, SOAP reached the target loss in 40% fewer iterations and 35% less wall-clock time than AdamW.
  • Outperforming Shampoo: SOAP isn't just simpler than Shampoo; it's faster. It showed approximately 20% improvement in both iterations and wall-clock time over a highly tuned Shampoo implementation.
  • Robustness: As shown in the right-most plot of the figure below, SOAP's performance remains high even when the preconditioning frequency is reduced by a factor of 100, whereas Shampoo's performance degrades rapidly.
Comparing performance of tuned runs for AdamW, Shampoo, and SOAP. SOAP shows superior convergence in both steps and wall-clock time and is more robust to low preconditioning frequencies.

Limitations and Future Work

  • Scale: While 660M parameters is a solid benchmark, it is small compared to frontier models. The authors hypothesize that SOAP's benefits will scale, but this remains to be proven at the multi-billion parameter level.
  • Domain Specificity: The current study is limited to language modeling. Its effectiveness in other domains like computer vision or multimodal learning is an open question.
  • Precision: The authors suggest that future work could explore using lower precision (e.g., fp16 or 8-bit) for the preconditioner matrices to further reduce the memory footprint.

An implementation of SOAP is available at https://github.com/nikhilvyas/SOAP.

Summary updated

BibTeX
@inproceedings{vyas2025soap,
  author = {Nikhil Vyas and Depen Morwani and Rosie Zhao and Itai Shapira and David Brandfonbrener and Lucas Janson and Sham M. Kakade},
  title = {{SOAP: Improving and Stabilizing Shampoo using Adam for Language Modeling}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=IDxZhXrpNf},
}
Figure