arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.01843cs.LGcond-mat.dis-nnstat.ML
收藏

何时可以侥幸使用低内存 Adam?

When Can You Get Away with Low Memory Adam?

University of Maryland(马里兰大学);Joint Quantum Institute(联合量子研究所)

Dayal Singh Kalra, John Kirchenbauer, Maissam Barkeshli, Tom Goldstein

AI总结:

本文通过逐层 SNR 分析识别 Adam 二阶矩的可压缩维度,提出 SlimAdam,在保持性能与稳定性的同时最多节省 98% 的二阶矩内存。

摘要:

Adam 是训练现代机器学习模型的首选优化器,但它需要额外内存来维护梯度及其平方的滑动平均。尽管人们已经提出了多种低内存优化器,并且它们有时能够达到与 Adam 相当的性能,但其可靠性不足使 Adam 仍然是默认选择。在本工作中,我们采用一种简单的逐层信噪比(SNR)分析,以量化何时可以沿不同维度用二阶矩张量的均值有效替代这些张量。我们的 SNR 分析揭示了架构、训练超参数和数据集属性如何影响 Adam 轨迹上的可压缩性,并自然产生了 SlimAdam,这是一种内存高效的 Adam 变体。SlimAdam 在可行时沿高 SNR 维度压缩二阶矩,并在压缩会造成损害时选择弃权(不执行)。通过在多种架构和训练场景上的实验,我们表明 SlimAdam 达到了与 Adam 相当的性能和稳定性,同时节省了高达 98% 的总二阶矩存储。SlimAdam 的代码可在 https://github.com/dayal-kalra/low-memory-adam 获取。

英文摘要:

Adam is the go-to optimizer for training modern machine learning models, but it requires additional memory to maintain the moving averages of the gradients and their squares. While various low-memory optimizers have been proposed that sometimes match the performance of Adam, their lack of reliability has left Adam as the default choice. In this work, we apply a simple layer-wise Signal-to-Noise Ratio (SNR) analysis to quantify when second-moment tensors can be effectively replaced by their means across different dimensions. Our SNR analysis reveals how architecture, training hyperparameters, and dataset properties impact compressibility along Adam's trajectory, naturally leading to $\textit{SlimAdam}$, a memory-efficient Adam variant. $\textit{SlimAdam}$ compresses the second moments along dimensions with high SNR when feasible, and leaves when compression would be detrimental. Through experiments across a diverse set of architectures and training scenarios, we show that $\textit{SlimAdam}$ matches Adam's performance and stability while saving up to $98\%$ of total second moments. Code for $\textit{SlimAdam}$ is available at https://github.com/dayal-kalra/low-memory-adam.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑