Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models

Xingyu Xie, Pan Zhou, Huan Li, Zhouchen Lin, Shuicheng Yan
8/13/2022
cs.LGmath.OC

Official code: sail-sg/Adan (822 stars, Apache-2.0, PyTorch, last commit 2025-06-08).

Abstract

In deep learning, different kinds of deep networks typically need different optimizers, which have to be chosen after multiple trials, making the training process inefficient. To relieve this issue and consistently improve the model training speed across deep networks, we propose the ADAptive Nesterov momentum algorithm, Adan for short. Adan first reformulates the vanilla Nesterov acceleration to develop a new Nesterov momentum estimation (NME) method, which avoids the extra overhead of computing gradient at the extrapolation point. Then, Adan adopts NME to estimate the gradient's first- and second-order moments in adaptive gradient algorithms for convergence acceleration. Besides, we prove that Adan finds an $ε$-approximate first-order stationary point within $\mathcal{O}(ε^{-3.5})$ stochastic gradient complexity on the non-convex stochastic problems (e.g., deep learning problems), matching the best-known lower bound. Extensive experimental results show that Adan consistently surpasses the corresponding SoTA optimizers on vision, language, and RL tasks and sets new SoTAs for many popular networks and frameworks, e.g., ResNet, ConvNext, ViT, Swin, MAE, DETR, GPT-2, Transformer-XL, and BERT. More surprisingly, Adan can use half of the training cost (epochs) of SoTA optimizers to achieve higher or comparable performance on ViT, GPT-2, MAE, etc., and also shows great tolerance to a large range of minibatch size, e.g., from 1k to 32k. Code is released at https://github.com/sail-sg/Adan, and has been used in multiple popular deep learning frameworks or projects.

View on arXivView PDF

Code Implementations(1)

sail-sg/AdanOfficial100%
PyTorchApache-2.0

Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models

82270C++, CudaSep 1, 20221 years agoApache-2.0
adanartificial-intelligencebert-modelconvnextcuda-programming+15 more

Similar Papers

Cite this paper

@article{xie2022adan,
  title  = {Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models},
  author = {Xingyu Xie and Pan Zhou and Huan Li and Zhouchen Lin and Shuicheng Yan},
  year   = {2022},
  eprint = {2208.06677},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.06677}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.06677.svg)](https://codeofpaper.com/paper/2208.06677)

Discussion