APOLLO: SGD-like Memory, AdamW-level Performance

Hanqing Zhu, Zhenyu Zhang, Wenyan Cong, Xi Liu, Sem Park, Vikas Chandra, Bo Long, David Z. Pan, Zhangyang Wang, Jinwon Lee

TL;DR

APOLLO is a new family of memory-efficient optimizers that achieves the performance of AdamW while requiring memory costs as low as standard SGD. By replacing AdamW’s element-wise learning rate updates with structured, low-rank approximations based on random projections, APOLLO enables training a LLaMA-7B model on a single 12GB GPU and boosts training throughput by up to 3x.

What Problem Does This Paper Address?

Training Large Language Models (LLMs) is notoriously memory-intensive. While model weights take up significant space, the AdamW optimizer—the industry standard—effectively triples that requirement by storing first and second "moments" (running averages of gradients and their squares) for every single parameter. For a 7B parameter model, these optimizer states alone can consume 28GB of VRAM.

Existing solutions to this "memory wall" have significant drawbacks:

  1. Low-rank methods (like GaLore): Rely on Singular Value Decomposition (SVD), which is computationally expensive and creates bottlenecks.
  2. Performance Trade-offs: Methods that simplify the optimizer often result in worse model quality (higher perplexity) compared to AdamW.
  3. Residual Memory: Even "efficient" optimizers often still require substantial memory to maintain competitive performance.

The authors of APOLLO set out to find a way to slash this memory overhead without sacrificing the convergence speed or final accuracy that makes AdamW so popular.

Methods

The core innovation of APOLLO is the shift from element-wise to structured learning rate adaptation.

1. Coarsened Learning Rate Updates

The authors observed that AdamW’s element-wise scaling is redundant. They propose that a channel-wise or even tensor-wise scaling factor is sufficient. Instead of every parameter having its own adaptive learning rate, entire groups of parameters share one.

2. Random Projection vs. SVD

Unlike previous methods that use SVD to find a low-rank subspace for gradients, APOLLO uses pure random projections. This eliminates the heavy computational cost of SVD. The authors provide a theoretical proof (based on the Johnson-Lindenstrauss Lemma) showing that random projections effectively preserve the gradient norms needed for scaling.

3. APOLLO and APOLLO-Mini

  • APOLLO: Approximates channel-wise scaling using a low-rank auxiliary optimizer state.
  • APOLLO-Mini: An extreme version that uses tensor-wise scaling with a rank-1 subspace. This reduces the optimizer memory overhead to almost zero, making it comparable to SGD.

4. Norm-growth Limiter (NL)

To handle the instability often seen in the early stages of training with coarsened updates, the authors introduced a Norm-growth Limiter. This prevents sudden spikes in gradient magnitude, ensuring stable convergence.

Figure 1. (Left) Overview of our APOLLO optimizer; (Middle) Memory breakdown comparison for a single batch size, where both GaLore and our method employ the layer-wise gradient update strategy (Lv et al., 2023). The (Q-) prefix indicates the integration of INT8 weight quantization, as utilized in (Zhang et al., 2024c); (Right) End-to-end training throughput on 8 A100-80GB GPUs.

Datasets

The researchers evaluated APOLLO across a variety of scales and tasks:

  • Pre-training: Used the C4 (Colossal Clean Crawled Corpus) dataset to train LLaMA-style models ranging from 60M to 7B parameters.
  • Fine-tuning: Evaluated on LLaMA-3.2-1B, LLaMA-3-8B, Gemma-7B, and Mistral-7B across:
  • Common-sense reasoning: Winogrande, PIQA, SIQA, OpenBookQA, HellaSwag, BoolQ, and ARC.
  • MMLU: A massive multitask benchmark covering STEM, humanities, and social sciences.

Key Insights and Ideas

  • Redundancy in Adaptation: The most striking finding is that the fine-grained, parameter-level adaptation of AdamW isn't strictly necessary for LLMs. Coarsening this to the channel level actually improves generalization in some cases.
  • SVD is Overkill: While SVD is the mathematically "optimal" way to find a low-rank subspace, random projections are "good enough" and significantly faster, removing a major system bottleneck.
  • Stateless Superiority: In later stages of training, APOLLO often outperforms AdamW. The authors hypothesize this is because APOLLO behaves more like SGD, which is known for better generalization, while retaining AdamW's initial convergence speed.
Figure 3. Training loss comparison between Element-wise and Channel-wise Learning Rate (LR) Adaptations with or without norm limiter (NL) on the LLaMA-130M model.

Key Results

  • Throughput: APOLLO achieves 3x higher throughput than AdamW on an 8xA100 setup. Because it saves so much memory, researchers can use 4x larger batch sizes, which saturates the GPU more effectively.
  • Extreme Memory Efficiency: Combined with 8-bit quantization, Q-APOLLO-Mini enables pre-training a LLaMA-7B model from scratch on a single GPU with less than 12GB of memory.
  • Model Quality: In LLaMA-7B pre-training, APOLLO achieved a validation perplexity of 13.02, significantly outperforming 8-bit AdamW (14.61) and GaLore (14.65) within the same training timeframe.
  • Scalability: APOLLO-Mini enabled the pre-training of a LLaMA-13B model using naive Distributed Data Parallel (DDP) on A100-80GB GPUs without needing complex system-level sharding like FSDP.
Figure 2. Comparison of Validation perplexity on LLaMA-7B.

Limitations and Future Work

  • Early Phase Instability: Without the Norm-growth Limiter, coarsened updates can be unstable at the very start of training.
  • Hyperparameter Sensitivity: While the authors found a default scale ($\alpha = \sqrt{128}$) worked well for APOLLO-Mini, extreme rank-1 compression might require more careful tuning for specific new architectures.
  • Stateless Theory: The paper provides preliminary insights into why a "stateless" optimizer (like APOLLO-Mini) can beat AdamW, but the authors note that a more formal theoretical framework for this behavior is a subject for future work.

Summary updated

BibTeX
@misc{zhu2024apollo,
  author = {Hanqing Zhu and Zhenyu Zhang and Wenyan Cong and Xi Liu and Sem Park and Vikas Chandra and Bo Long and David Z. Pan and Zhangyang Wang and Jinwon Lee},
  title = {{APOLLO: SGD-like Memory, AdamW-level Performance}},
  year = {2024},
  eprint = {2412.05270},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.05270},
}
Figure