arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2006.13484cs.LGcs.CLcs.DCstat.ML
收藏

在54分钟内加速BERT预训练的大批量优化

Accelerated Large Batch Optimization of BERT Pretraining in 54 minutes

Amazon Web Services(亚马逊云科技)

Shuai Zheng, Haibin Lin, Sheng Zha, Mu Li

摘要:

BERT最近在自然语言理解(NLU)领域引起了广泛的关注,并在各种NLU任务中取得了最先进的结果。然而,它的成功需要大的深度神经网络和大量的数据,这导致训练时间长,阻碍了开发进度。使用随机梯度方法与大的小批量一直提倡作为一种有效的工具,以减少训练时间。沿着这条研究路线,LAMB是一个突出的例子,它将TPUv3 Pod上的BERT训练时间从3天减少到76分钟。在本文中,我们提出了一种加速梯度方法称为LANS,以提高使用大的小批量训练的效率。由于学习率在理论上由函数的Lipschitz常数的倒数限定上限,因此不能总是通过选择较大的学习率来减少优化迭代的次数。为了使用更大的小批量而不损失精度,我们开发了一种新的学习率调度器,克服了使用大学习率的困难。使用所提出的LANS方法和学习率方案,我们在BERT预训练的第1和第2阶段分别将小批量大小扩大到96K和33K。在SQuAD v1.1上,192个AWS EC2 P3dn.24xlarge实例需要54分钟才能达到90.5或更高的目标F1分数,实现了云中最快的BERT训练时间。

英文摘要:

BERT has recently attracted a lot of attention in natural language understanding (NLU) and achieved state-of-the-art results in various NLU tasks. However, its success requires large deep neural networks and huge amount of data, which result in long training time and impede development progress. Using stochastic gradient methods with large mini-batch has been advocated as an efficient tool to reduce the training time. Along this line of research, LAMB is a prominent example that reduces the training time of BERT from 3 days to 76 minutes on a TPUv3 Pod. In this paper, we propose an accelerated gradient method called LANS to improve the efficiency of using large mini-batches for training. As the learning rate is theoretically upper bounded by the inverse of the Lipschitz constant of the function, one cannot always reduce the number of optimization iterations by selecting a larger learning rate. In order to use larger mini-batch size without accuracy loss, we develop a new learning rate scheduler that overcomes the difficulty of using large learning rate. Using the proposed LANS method and the learning rate scheme, we scaled up the mini-batch sizes to 96K and 33K in phases 1 and 2 of BERT pretraining, respectively. It takes 54 minutes on 192 AWS EC2 P3dn.24xlarge instances to achieve a target F1 score of 90.5 or higher on SQuAD v1.1, achieving the fastest BERT training time in the cloud.

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

↑