arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2108.06084cs.LGcs.DC
收藏

稳定性-效率困境:研究训练GPT模型的序列长度预热

The Stability-Efficiency Dilemma: Investigating Sequence Length Warmup for Training GPT Models

Microsoft(微软)

Conglong Li, Minjia Zhang, Yuxiong He

摘要:

最近的工作已经在大规模GPU上预训练大规模自回归语言模型方面取得了巨大的成功。为了减少挂钟训练时间,通常的做法是增加批量大小和学习率。然而,这种做法往往是脆弱的,并导致所谓的稳定性-效率困境:增加批量大小和学习率会带来更好的训练效率,但也会导致训练不稳定,导致泛化准确性差或失败。为了更好地理解这一现象,我们对复制GPT-2模型的大规模预训练实验进行了深入分析。我们发现训练不稳定性和梯度方差的极值之间存在很强的相关性,并且具有长序列长度的样本有助于这些极端梯度方差值,特别是在训练开始时,这表明长序列长度可能是训练不稳定性的主要来源。在此基础上,提出了一种序列长度预热方法,旨在解决训练稳定性和效率的矛盾。复制GPT-2模型的实验表明,我们的方法能够以8倍的批量大小和4倍的学习率实现稳定的训练,而基线方法则难以实现训练的不稳定性。为了实现相同或更好的zero-shot评估结果,我们的方法将所需的训练令牌数量和挂钟时间分别减少了2.2倍和3.7倍。对GPT-3模型(125 M)的实验表明,我们的方法能够以8倍的批量大小和40倍的学习率进行稳定的训练,并在11个任务上保持99%的zero-shot准确率,与原始GPT-3训练配方相比,使用的数据减少了10倍,时间减少了17倍。而基线在相同设置下发散,并且在较低的学习率下仅保持95%的准确度。

英文摘要:

Recent works have demonstrated great success in pre-training large-scale autoregressive language models on massive GPUs. To reduce the wall-clock training time, a common practice is to increase the batch size and learning rate. However, such practice is often brittle and leads to a so-called stability-efficiency dilemma: increasing the batch sizes and learning rates leads to better training efficiency but can also result in training instability, leading to poor generalization accuracy or failed runs. To better understand this phenomenon, we conduct an in-depth analysis on large-scale pre-training experiments replicating the GPT-2 model. We find that there is a strong correlation between training instability and extreme values of gradient variance, and that samples with long sequence lengths contribute to these extreme gradient variance values, especially at the beginning of the training, indicating that long sequence length can be a main source of training instability. Based on the analysis, we present a Sequence Length Warmup method that aims to solve the training stability-efficiency dilemma. Experiments replicating GPT-2 models show that our approach enables stable training with 8x larger batch size and 4x larger learning rate, whereas the baseline approach struggles with training instability. To achieve the same or better zero-shot evaluation results, our method reduces the required number of training tokens and wall clock time by up to 2.2x and 3.7x, respectively. Experiments replicating GPT-3 model (125M) show that our approach enables stable training with 8x larger batch size and 40x larger learning rate, and retains 99% of the zero-shot accuracy on 11 tasks using 10x less data and 17x less time compared to the original GPT-3 training recipe, while the baseline diverges under the same settings and only retain 95% of accuracy under lower learning rate.

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

↑