NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Adapprox: Adaptive Approximation in Adam Optimization via Randomized Low-Rank Matrices

Pengxiang Zhao, Ping Li, Yingjie Gu, Yi Zheng, Stephan Ludger Kölker, Zhefeng Wang, Xiaoming YuanarXiv 2024

Abstract

As deep learning models exponentially increase in size, optimizers such as Adam encounter significant memory consumption challenges due to the storage of first and second moment data. Current memory-efficient methods like Adafactor and CAME often compromise accuracy with their matrix factorization techniques. Addressing this, we introduce Adapprox, a novel approach that employs randomized low-rank matrix approximation for a more effective and accurate approximation of Adam's second moment. Adapprox features an adaptive rank selection mechanism, finely balancing accuracy and memory efficiency, and includes an optional cosine similarity guidance strategy to enhance stability and expedite convergence. In GPT-2 training and downstream tasks, Adapprox surpasses AdamW by achieving 34.5% to 49.9% and 33.8% to 49.9% memory savings for the 117M and 345M models, respectively, with the first moment enabled, and further increases these savings without the first moment. Besides, it enhances convergence speed and improves downstream task performance relative to its counterparts.

Introduction

Training state-of-the-art Large Language Models (LLMs) is a memory-intensive endeavor. The popular Adam optimizer requires storing two "moments" (running averages) for every parameter in the model. For models with billions of parameters, these optimizer states can consume gigabytes of GPU memory, often exceeding the memory required for the model weights themselves.

Existing solutions like Adafactor and CAME attempt to solve this by using matrix factorization, typically approximating a large matrix with a rank-1 representation. While this saves massive amounts of memory, it often leads to significant approximation error, causing training to slow down or accuracy to drop as the optimizer loses critical information about the gradient geometry.

Motivation: The Multiple Dominant Values Insight

A key technical insight of this work is that second-moment matrices in LLMs often possess more than one dominant singular value. As shown in Figure 1, the singular value distribution of these matrices indicates that a simple rank-1 factorization (as used in Adafactor) leaves substantial information "on the table," failing to capture the complex geometry of the optimization landscape.

Singular value distributions of second-moment matrices in LLMs, showing multiple dominant values that justify a higher-rank approximation.

Methodology

The authors introduce Adapprox, which moves beyond simple rank-1 factorization by using Randomized Low-Rank Matrix Approximation. Key technical components include:

  • Streamlined Randomized Subspace Iteration (S-RSI): Instead of a full, expensive Singular Value Decomposition (SVD), Adapprox uses a randomized approach to quickly find the most important singular values of the second moment matrix.
  • Adaptive Rank Selection (AS-RSI): Adapprox monitors the approximation error and dynamically adjusts the rank ($k$). This allows the optimizer to be as lean as possible when the data is simple and more precise when the data is complex.
  • Cosine Similarity Guidance: An optional feature that measures how well the current update aligns with the running average, allowing the optimizer to adjust convergence speed based on alignment "confidence."
  • Update Clipping: To prevent instabilities common in low-rank approximations, Adapprox incorporates a clipping mechanism to keep parameter updates within a stable range.

Experimental Results

Adapprox was evaluated by pretraining GPT-2 models (117M and 345M parameters) on The Pile and fine-tuning them on standard benchmarks like SQuAD v1.1 and GLUE.

Performance and Convergence

In GPT-2 pretraining, Adapprox consistently showed lower validation loss and perplexity than Adafactor and CAME. As illustrated in Figure 2, Adapprox's performance closely tracks or even exceeds that of the full-memory AdamW optimizer.

Validation loss and perplexity vs. iteration for GPT-2 117M and 345M models, comparing Adapprox with AdamW, Adafactor, and CAME.

Memory Savings and Downstream Success

Compared to AdamW, Adapprox reduced memory usage by 34.5% to 49.9% when the first moment was enabled. If the first moment was disabled, it achieved up to 99.9% savings on the second moment storage. On downstream tasks like SQuAD and MNLI, Adapprox-trained models often outperformed those trained with AdamW, suggesting that the low-rank approximation might even have a slight regularizing effect that improves generalization.

Conclusion

Adapprox significantly optimizes the second moment storage in Adam without the performance degradation seen in previous factorization methods. By utilizing adaptive, randomized low-rank approximations, it achieves a superior balance between memory efficiency and optimization accuracy. Future work could involve applying similar compression techniques to the first moment to further reduce the optimizer's memory footprint.

Summary updated

BibTeX
@misc{zhao2024adapprox,
  author = {Pengxiang Zhao and Ping Li and Yingjie Gu and Yi Zheng and Stephan Ludger Kölker and Zhefeng Wang and Xiaoming Yuan},
  title = {{Adapprox: Adaptive Approximation in Adam Optimization via Randomized Low-Rank Matrices}},
  year = {2024},
  eprint = {2403.14958},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.14958},
}
Figure