University of Exeter
Browse

SPAM: Spike-Aware Adam with Momentum Reset for Stable LLM Training

Download (1.11 MB)
conference contribution
posted on 2025-08-13, 13:12 authored by T Huang, Z Zhu, G Jin, L Liu, Z Wang, S Liu
Large Language Models (LLMs) have demonstrated exceptional performance across diverse tasks, yet their training remains highly resource intensive and susceptible to critical challenges such as training instability. A predominant source of this instability stems from gradient and loss spikes, which disrupt the learning process, often leading to costly interventions like checkpoint recovery and experiment restarts, further amplifying inefficiencies. This paper presents a comprehensive investigation into gradient spikes observed during LLM training, revealing their prevalence across multiple architectures and datasets. Our analysis shows that these spikes can be up to 1000× larger than typical gradients, substantially deteriorating model performance. To address this issue, we propose Spike-Aware Adam with Momentum Reset (SPAM), a novel optimizer designed to counteract gradient spikes through momentum reset and spike-aware gradient clipping. Extensive experiments, including both pre-training and fine-tuning, demonstrate that SPAM consistently surpasses Adam and its variants across a range of model scales. Additionally, SPAM facilitates memory-efficient training by enabling sparse momentum, where only a subset of momentum terms are maintained and updated. When operating under memory constraints, SPAM outperforms state-of-the-art memory-efficient optimizers such as GaLore and Adam-Mini. Our work underscores the importance of mitigating gradient spikes in LLM training and introduces an effective optimization strategy that enhances both training stability and resource efficiency at scale. Code is available at https://github.com/TianjinYellow/SPAM-Optimizer.git

History

Rights

© 2025 The author(s)

Notes

This is the final version. Available from the International Conference on Learning Representations via the links in this record

Publisher

International Conference on Learning Representations

Version

  • Version of Record

Language

en

FCD date

2025-02-24T14:31:50Z

FOA date

2025-07-04T15:30:04Z

Citation

ICLR 2025 - The Thirteenth International Conference on Learning Representations, 24 - 28 April 2025, Singapore

Department

  • Computer Science

Usage metrics

    University of Exeter

    Categories

    No categories selected

    Keywords

    Exports

    RefWorks
    BibTeX
    Ref. manager
    Endnote
    DataCite
    NLM
    DC