大规模批量优化用于深度学习:76 分钟训练 BERT

Large Batch Optimization for Deep Learning: Training BERT in 76 minutes

尤洋 Yang You · Google / UC Berkeley · 2019-04-01 · arXiv:1904.00962 ↗ · 被引 1213

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

在庞大数据集上训练大型深度神经网络在计算上极具挑战性。最近,使用大批量随机优化方法来解决这一问题引起了广泛关注。该研究领域最著名的算法是 LARS,它通过逐层自适应学习率在几分钟内训练了 ImageNet 上的 ResNet。然而,LARS 在像 BERT 这样的注意力模型上表现不佳,表明其性能提升在不同任务上并不一致。在本文中,我们首先研究了一种原则性的逐层自适应策略,以加速使用大批量训练深度神经网络。利用这一策略,我们开发了一种新的逐层自适应大批量优化技术,称为 LAMB;然后我们提供了 LAMB 以及 LARS 的收敛性分析,证明了在一般非凸设置下收敛到稳定点。我们的实证结果表明,LAMB 在各种任务(如 BERT 和 ResNet-50 训练)中表现出优越的性能,且几乎不需要超参数调整。特别是,在 BERT 训练中,我们的优化器能够使用高达 32868 的极大批量大小而不会降低性能。通过将批量大小增加到 TPUv3 Pod 的内存限制,BERT 训练时间可以从 3 天减少到仅 76 分钟(表 1)。LAMB 实现可在 https://github.com/tensorflow/addons/blob/master/tensorflow_addons/optimizers/lamb.py 获取。

Training large deep neural networks on massive datasets is computationally very challenging. There has been recent surge in interest in using large batch stochastic optimization methods to tackle this issue. The most prominent algorithm in this line of research is LARS, which by employing layerwise adaptive learning rates trains ResNet on ImageNet in a few minutes. However, LARS performs poorly for attention models like BERT, indicating that its performance gains are not consistent across tasks. In this paper, we first study a principled layerwise adaptation strategy to accelerate training of deep neural networks using large mini-batches. Using this strategy, we develop a new layerwise adaptive large batch optimization technique called LAMB; we then provide convergence analysis of LAMB as well as LARS, showing convergence to a stationary point in general nonconvex settings. Our empirical results demonstrate the superior performance of LAMB across various tasks such as BERT and ResNet-50 training with very little hyperparameter tuning. In particular, for BERT training, our optimizer enables use of very large batch sizes of 32868 without any degradation of performance. By increasing the batch size to the memory limit of a TPUv3 Pod, BERT training time can be reduced from 3 days to just 76 minutes (Table 1). The LAMB implementation is available at https://github.com/tensorflow/addons/blob/master/tensorflow_addons/optimizers/lamb.py

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 13)

阅读逐段中英对照全文 →