AdaLomo: Low-memory Optimization with Adaptive Learning Rate

Kai Lv, Hang Yan, Qipeng Guo, Haijun Lv, Xipeng Qiu

Abstract

Training Large Language Models (LLMs) is constrained by the massive memory overhead of optimizer states. While methods like LOMO reduce memory by using a fused backward pass, they often suffer from a convergence gap compared to adaptive optimizers like AdamW. This paper introduces AdaLomo, an optimizer that combines the memory efficiency of a fused backward pass with the performance of adaptive learning rates. By utilizing Non-negative Matrix Factorization (NMF) for second-moment estimation and grouped update normalization, AdaLomo matches AdamW’s convergence while using significantly less memory—enabling full-parameter fine-tuning of 7B models on consumer-grade hardware.

Introduction

The primary bottleneck in training LLMs is not just the model parameters, but the auxiliary states required by optimizers. The industry-standard AdamW optimizer stores two "moments" (moving averages of gradients and their squares) for every parameter. For a 7B parameter model, these states consume dozens of gigabytes, often exceeding the capacity of single GPUs.

Previous attempts to mitigate this, such as LOMO (Low-memory Optimization), utilize a "fused backward" pass to update parameters and discard gradients immediately. However, LOMO is essentially a form of Stochastic Gradient Descent (SGD), which lacks the adaptive learning rates that make AdamW so effective. This results in a "convergence gap." AdaLomo is designed to bridge this gap without sacrificing memory efficiency.

Methodology

AdaLomo introduces three key innovations to achieve high performance with low memory:

  1. Adaptive Learning Rate via Second-Order Moments: Empirical analysis reveals that the second moment (variance) is the critical factor for LLM convergence, whereas the first moment (momentum) is less essential. AdaLomo prioritizes providing an adaptive learning rate for each parameter based on this second moment.
Comparison of training loss for different optimizer components, highlighting the importance of variance (adaptive learning rate) over momentum.
  1. Memory-Efficient Moment Estimation: To avoid the $O(N)$ memory cost of storing a full second moment, AdaLomo employs Non-negative Matrix Factorization (NMF). Similar to Adafactor, it decomposes the square gradient matrix into two smaller vectors (row and column sums), reducing the memory requirement for optimizer states from $O(m \times n)$ to $O(m + n)$.
  2. Grouped Update Normalization: Standard gradient clipping requires two backward passes. To maintain speed, AdaLomo uses "grouped update normalization," which stabilizes training by normalizing updates at the parameter or group level within a single backward pass.

Experimental Setup

The researchers evaluated AdaLomo across several training regimes:

  • Instruction Tuning: Fine-tuning LLaMA models (7B to 65B) on the Alpaca dataset.
  • Further Pre-training: Training LLaMA-7B/13B on Baidu-baike and StarCoder subsets.
  • Pre-training from Scratch: Training a 1.1B parameter LLaMA-style model on the C4 corpus.

Performance was measured using standard benchmarks including MMLU, BBH, GSM8K, and HumanEval.

Results and Discussion

AdaLomo demonstrates performance parity with AdamW while offering massive memory savings.

Performance Parity

In instruction tuning across the LLaMA series, AdaLomo consistently matched or outperformed AdamW and LoRA. For LLaMA-7B, AdaLomo achieved an average score of 30.8 across benchmarks, compared to 29.1 for AdamW and 24.0 for LOMO.

Performance metrics for LLaMA-7B and 13B, showing AdaLomo's parity with AdamW across training loss, perplexity, and validation accuracy.

Efficiency and Memory Savings

For a LLaMA-65B model, AdamW requires approximately 1532 GB of GPU memory across a cluster, whereas AdaLomo requires only ~507 GB. Furthermore, AdaLomo uses only about 40% of the memory required by Adafactor while maintaining comparable throughput and superior convergence stability. This efficiency enables full-parameter fine-tuning of a 7B model on a single RTX 3090 (24GB).

Conclusion

AdaLomo successfully bridges the gap between SGD-based low-memory optimization and high-performance adaptive optimization. While it significantly reduces optimizer and gradient memory, future work is needed to address activation memory for long-sequence training. Additionally, exploring compressed versions of momentum could potentially yield further performance gains.

Summary updated

BibTeX
@inproceedings{lv2024adalomo,
  author = {Kai Lv and Hang Yan and Qipeng Guo and Haijun Lv and Xipeng Qiu},
  title = {{AdaLomo: Low-memory Optimization with Adaptive Learning Rate}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.742},
}
Figure