TL;DR
FOAM (Factored One-sided Adam-Moment) is a lightweight second-order optimizer that delivers the superior convergence of SOAP at a fraction of the cost. By simplifying preconditioning to the input side and factoring the second-moment buffer, FOAM matches state-of-the-art LLM pre-training quality while using half the memory of SOAP and running at nearly the speed of AdamW.
What Problem Does This Paper Address?
Training Large Language Models (LLMs) is traditionally dominated by first-order optimizers like AdamW. While second-order optimizers—such as Shampoo and its more practical variant, SOAP—promise faster convergence by accounting for the curvature of the loss landscape, they come with a heavy "tax."
SOAP, for instance, requires roughly 4.5x the optimizer state memory of AdamW and incurs significant computational overhead due to frequent eigendecompositions. Because of these costs, many practitioners stick to AdamW or simpler alternatives like Muon. The authors of this paper ask a critical question: Can we retain the optimization benefits of SOAP while approaching the efficiency of AdamW?
Methods
FOAM achieves its efficiency through two primary structural simplifications of the SOAP algorithm:
- Input-only Preconditioning: SOAP typically uses two Kronecker factors (one for the input side and one for the output side of a weight matrix). FOAM drops the output-side factor. The authors justify this by showing that the Hessian of transformer layers is naturally near-block-diagonal on the output side, meaning the input-side curvature carries the most critical information. This halves the number of required eigendecompositions and significantly reduces memory.
- Factored Adam-Moment: In the rotated "eigenbasis" where SOAP performs its updates, FOAM replaces the dense $m \times n$ second-moment buffer with a factored estimator (row and column statistics). This is similar to the approach used in Adafactor but applied specifically within the rotated coordinate system.
The resulting algorithm, visualized in its approximation of the Hessian in Figure 2, maintains a much leaner profile than its predecessors.
Datasets
The authors evaluated FOAM across several scales and modalities:
- LLM Pre-training: GPT-2 architectures ranging from 124M to 1.56B parameters, trained on the FineWeb dataset.
- Vision: ViT-Tiny trained on Tiny-ImageNet.
- Post-training: Fine-tuning and distillation tasks using the NuminaMath-CoT dataset.
Key Insights and Ideas
- The Input-Output Asymmetry: A key "aha" moment is the empirical verification that input-side rotation is far more impactful than output-side rotation for transformers. Dropping the output-side rotation costs very little in terms of alignment with the true Hessian but saves massive amounts of compute.
- Rank-1 Separability in Eigenbasis: The authors found that while the raw second moment of gradients isn't easily factorable, it becomes nearly rank-1 separable once rotated into the eigenbasis. This explains why FOAM’s factored moment estimator is so effective—it loses almost no information compared to a dense buffer.
- Pareto Efficiency: FOAM occupies a unique "sweet spot" on the Pareto frontier of optimization. As shown in Figure 1, it reaches the same validation loss as AdamW in roughly the same wall-clock time, whereas bilateral SOAP takes more than twice as long to reach that same point due to its overhead.
Key Results
- Validation Loss: FOAM consistently matches or beats strong baselines like Muon and SOAP across all tested GPT-2 scales.
- Wall-Clock Speed: At the 760M parameter scale, FOAM reaches AdamW’s final loss in 10.53 hours, virtually identical to AdamW itself (10.55h) and slightly faster than Muon (11.1h). In contrast, SOAP requires 22.7 hours.
- Memory Footprint: FOAM uses half the optimizer state of SOAP. Its measured peak training memory is only +7.4% higher than AdamW, compared to +12.9% for SOAP.
- Hyperparameter Robustness: FOAM inherits SOAP's robustness, maintaining stable performance across a three-fold range of learning rates, whereas AdamW can suffer catastrophic collapse at high momentum settings.
Limitations and Future Work
- Extreme Scale: While the results hold up to 1.56B parameters, the authors note that testing on "frontier-scale" models (e.g., 70B+ parameters) remains an open question.
- Sharding: The current implementation does not yet shard the optimizer factors ($R$ and $Q_R$) across devices, which becomes necessary for models larger than 7B parameters.
- Specific Layers: Currently, FOAM is applied to matrix parameters (projections and MLPs). Extending these factored second-order methods to embeddings and attention-specific structures (like the key projection) is a suggested next step.
Summary updated