arXiv:2410.10056cs.LGcs.AI2024-10被引 2

发现并解析了训练中自适应优化器的周期性损失震荡现象。

The Epochal Sawtooth Phenomenon: Unveiling Training Loss Oscillations in Adam and Other Optimizers

  • 通过分析自适应学习率机制,揭示损失曲线锯齿形波动的成因。
  • 小β₂值加剧震荡,但可起到正则化作用,且在简单任务中亦可复现。
  • 适合关注优化器行为、训练稳定性与模型泛化的研究者阅读。

本文识别并分析了一种常见于自适应梯度优化器(尤其是Adam)训练过程中的周期性损失模式,称为‘周期锯齿现象(Epochal Sawtooth Phenomenon, ESP)’。该现象表现为每轮训练开始时损失骤降,随后逐渐回升,形成锯齿状曲线。实验表明,尽管以Adam最为显著,RMSProp等其他优化器也存在类似但较弱的现象。我们分析发现,ESP源于二阶矩估计控制的自适应学习率调整,且数据打乱时的‘样本立即重暴露’效应会加剧模型在每轮初段的快速学习或记忆。较小的β₂值会放大此现象,但具有正则化效果;模型容量越高,现象越明显。此外,在高维二次最小化任务中成功复现了ESP,证明其普适性。代码已公开于https://github.com/qiliuchn/training-loss-pattern。

原文摘要 · Abstract (English)

In this paper, we identify and analyze a recurring training loss pattern, which we term the \textit{Epochal Sawtooth Phenomenon (ESP)}, commonly observed during training with adaptive gradient-based optimizers, particularly Adam optimizer. This pattern is characterized by a sharp drop in loss at the beginning of each epoch, followed by a gradual increase, resulting in a sawtooth-shaped loss curve. Through empirical observations, we demonstrate that while this effect is most pronounced with Adam, it persists, although less severely, with other optimizers such as RMSProp. We empirically analyze the mechanisms underlying ESP, focusing on key factors such as Adam's $β$ parameters, batch size, data shuffling, and sample replacement. Our analysis shows that ESP arises from adaptive learning rate adjustments controlled by the second moment estimate. Additionally, we identify the ``immediate re-exposure to samples'' effect during data shuffling, which causes the model to learn or memorize more at the beginning of each epoch. We also find that smaller values of $β_2$ exacerbate ESP but can act as a form of regularization. While ESP is not necessarily indicative of overfitting, higher model capacity can amplify the phenomenon. To further support our analysis, we replicate ESP through a high-dimensional quadratic minimization task. We demonstrate that ESP can emerge even in simple optimization scenarios, reinforcing the generality of this pattern. The code for reproducing our experiments is available at https://github.com/qiliuchn/training-loss-pattern.

优化器训练动态损失曲线Adam

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。