A Distributed Data-Parallel PyTorch Implementation of the Distributed Shampoo Optimizer for Training Neural Networks At-Scale

Hao-Jun Michael Shi, Tsung-Hsien Lee, Shintaro Iwasaki, Jose Gallego-Posada, Zhijing Li +3 more
9/12/2023
cs.LGcs.DCcs.MS

Official code: facebookresearch/optimizers (583 stars, last commit 2026-04-10). 1 more implementation below.

Abstract

Shampoo is an online and stochastic optimization algorithm belonging to the AdaGrad family of methods for training neural networks. It constructs a block-diagonal preconditioner where each block consists of a coarse Kronecker product approximation to full-matrix AdaGrad for each parameter of the neural network. In this work, we provide a complete description of the algorithm as well as the performance optimizations that our implementation leverages to train deep networks at-scale in PyTorch. Our implementation enables fast multi-GPU distributed data-parallel training by distributing the memory and computation associated with blocks of each parameter via PyTorch's DTensor data structure and performing an AllGather primitive on the computed search directions at each iteration. This major performance enhancement enables us to achieve at most a 10% performance reduction in per-step wall-clock time compared against standard diagonal-scaling-based adaptive gradient methods. We validate our implementation by performing an ablation study on training ImageNet ResNet50, demonstrating Shampoo's superiority over standard training recipes with minimal hyperparameter tuning.

View on arXivView PDF

Code Implementations(2)

Square-root-free Adaptive Methods; Experiment code for ICML 2024 paper on Can We Remove the Square-Root in Adaptive Gradient Methods? A Second-Order Perspective

31C++, CudaJun 13, 20242 years ago

For optimization algorithm research and development.

58367Python, MakefileApr 4, 20226 months agoNOASSERTION

Similar Papers

Cite this paper

@article{shi2023distributed,
  title  = {A Distributed Data-Parallel PyTorch Implementation of the Distributed Shampoo Optimizer for Training Neural Networks At-Scale},
  author = {Hao-Jun Michael Shi and Tsung-Hsien Lee and Shintaro Iwasaki and Jose Gallego-Posada and Zhijing Li and Kaushik Rangadurai and Dheevatsa Mudigere and Michael Rabbat},
  year   = {2023},
  eprint = {2309.06497},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2309.06497v1}
}

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/2309.06497.svg)](https://codeofpaper.com/paper/2309.06497)

Discussion