揭示了批量大小如何改变Adam优化器对模型泛化能力的影响
The Effect of Mini-Batch Noise on the Implicit Bias of Adam
- 分析了批量噪声通过动量参数影响模型收敛方向的机制
- 小批量时默认参数(0.9, 0.999)更优,大批量时需调整动量比
- 为多轮训练中提升验证准确率提供可解释的调参指导
在高质量数据有限、算力增长的背景下,多轮训练重新受到重视。作为广泛使用的优化器,Adam(W) 有两个动量超参数(β₁, β₂)控制记忆能力,以及一个关键超参数——批量大小,决定小批量噪声的强度。本文提出理论框架,阐明小批量噪声如何影响Adam的记忆特性,进而引导模型偏向损失曲面更尖锐或更平坦的区域,这与多轮训练中的泛化差距密切相关。研究发现:当批量较大时,较高的β₂会增强记忆导致的反正则化效应(损害泛化),但随着批量减小,该效应随β₂的变化方向反转;类似地,β₁也出现相反的单调性转变。特别地,在小批量场景下,常用的默认参数对(0.9, 0.999)表现良好;而在大批量设置中,将β₁趋近β₂能显著提升验证准确率。理论推导进一步将这种转变发生的批量尺度与临界批量尺度联系起来,并在接近过拟合的小规模数据实验中验证了该现象。
原文摘要 · Abstract (English)
With limited high-quality data and growing compute, multi-epoch training is gaining back its importance across sub-areas of deep learning. Adam(W), versions of which are go-to optimizers for many tasks such as next token prediction, has two momentum hyperparameters $(β_1, β_2)$ controlling memory and one very important hyperparameter, batch size, controlling (in particular) the amount mini-batch noise. We introduce a theoretical framework to understand how mini-batch noise influences the implicit bias of memory in Adam (depending on $β_1$, $β_2$) towards sharper or flatter regions of the loss landscape, which is commonly observed to correlate with the generalization gap in multi-epoch training. We find that in the case of large batch sizes, higher $β_2$ increases the magnitude of anti-regularization by memory (hurting generalization), but as the batch size becomes smaller, the dependence of (anti-)regulariation on $β_2$ is reversed. A similar monotonicity shift (in the opposite direction) happens in $β_1$. In particular, the commonly "default" pair $(β_1, β_2) = (0.9, 0.999)$ is a good choice if batches are small; for larger batches, in many settings moving $β_1$ closer to $β_2$ is much better in terms of validation accuracy in multi-epoch training. Moreover, our theoretical derivations connect the scale of the batch size at which the shift happens to the scale of the critical batch size. We illustrate this effect in experiments with small-scale data in the about-to-overfit regime.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。