4-bit Shampoo for Memory-Efficient Network Training

Sike Wang, Jia Li, Pan Zhou, Hua Huang
5/1/2024
22 citations

Official code: Sike-Wang/low-bit-Shampoo (13 stars, Python, last commit 2025-02-13).

Abstract

Second-order optimizers, maintaining a matrix termed a preconditioner, are superior to first-order optimizers in both theory and practice. The states forming the preconditioner and its inverse root restrict the maximum size of models trained by second-order optimizers.

Show full abstract

To address this, compressing 32-bit optimizer states to lower bitwidths has shown promise in reducing memory usage. However, current approaches only pertain to first-order optimizers. In this paper, we propose the first 4-bit second-order optimizers, exemplified by 4-bit Shampoo, maintaining performance similar to that of 32-bit ones. We show that quantizing the eigenvector matrix of the preconditioner in 4-bit Shampoo is remarkably better than quantizing the preconditioner itself both theoretically and experimentally. By rectifying the orthogonality of the quantized eigenvector matrix, we enhance the approximation of the preconditioner's eigenvector matrix, which also benefits the computation of its inverse 4-th root. Besides, we find that linear square quantization slightly outperforms dynamic tree quantization when quantizing second-order optimizer states. Evaluation on various networks for image classification and natural language modeling demonstrates that our 4-bit Shampoo achieves comparable performance to its 32-bit counterpart while being more memory-efficient.

View on arXivView PDF

Code Implementations(1)

4-bit Shampoo for Memory-Efficient Network Training (NeurIPS 2024)

131Python, CudaSep 5, 20241 years ago

Similar Papers

Cite this paper

@article{wang2024bit,
  title  = {4-bit Shampoo for Memory-Efficient Network Training},
  author = {Sike Wang and Jia Li and Pan Zhou and Hua Huang},
  year   = {2024},
  eprint = {2405.18144},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2405.18144},
  url    = {https://arxiv.org/abs/2405.18144},
  journal = {NEURIPS 2024 2024}
}

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

Discussion