如何扩展你的EMA
How to Scale Your EMA
AI总结:
本研究针对现有缩放规则未考虑模型EMA优化导致不同批量下训练动态差异、性能下降的问题,提出了含EMA的优化缩放规则,在多场景验证有效,可实现BYOL大批次训练且性能无损,大幅缩短训练时间。
摘要:
在不同批量大小下保持训练动态是实用机器学习的重要工具,因为它能实现批量大小与实际运行时间之间的权衡。这种权衡通常由缩放规则来实现,例如在随机梯度下降中,学习率应与批量大小成线性比例缩放。另一个重要的机器学习工具是模型EMA,它是目标模型的功能副本,其参数根据指数移动平均(Exponential Moving Average,EMA)以动量超参数化的速率向目标模型的参数靠拢。这种模型EMA可以提升监督学习的鲁棒性和泛化能力,稳定伪标签过程,并为自监督学习(Self-Supervised Learning,SSL)提供学习信号。先前的研究在执行缩放时并未考虑模型EMA的优化,导致不同批量大小下训练动态存在差异,且模型性能更低。在本研究中,我们提出了存在模型EMA时优化的缩放规则,并在多种架构、优化器和数据模态上验证了该规则的有效性。我们还证明了在模型EMA参与目标模型优化的场景下该规则同样有效,这使得我们能够在小批量和大批量规模下训练基于EMA的伪标签方法和SSL方法。对于自监督学习,我们实现了BYOL在批量大小高达24576时的训练且不损失性能,在理想硬件设置下实际运行时间缩短了6倍。
英文摘要:
Preserving training dynamics across batch sizes is an important tool for practical machine learning as it enables the trade-off between batch size and wall-clock time. This trade-off is typically enabled by a scaling rule, for example, in stochastic gradient descent, one should scale the learning rate linearly with the batch size. Another important machine learning tool is the model EMA, a functional copy of a target model, whose parameters move towards those of its target model according to an Exponential Moving Average (EMA) at a rate parameterized by a momentum hyperparameter. This model EMA can improve the robustness and generalization of supervised learning, stabilize pseudo-labeling, and provide a learning signal for Self-Supervised Learning (SSL). Prior works have not considered the optimization of the model EMA when performing scaling, leading to different training dynamics across batch sizes and lower model performance. In this work, we provide a scaling rule for optimization in the presence of a model EMA and demonstrate the rule's validity across a range of architectures, optimizers, and data modalities. We also show the rule's validity where the model EMA contributes to the optimization of the target model, enabling us to train EMA-based pseudo-labeling and SSL methods at small and large batch sizes. For SSL, we enable training of BYOL up to batch size 24,576 without sacrificing performance, a 6$\times$ wall-clock time reduction under idealized hardware settings.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。