arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2006.04884cs.LGstat.ML
收藏

关于微调BERT的稳定性:误解、解释和强基线

On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines

Saarland University(萨尔大学);École polytechnique fédérale de Lausanne(洛桑联邦理工学院)

Marius Mosbach, Maksym Andriushchenko, Dietrich Klakow

摘要:

微调预训练的基于transformer的语言模型,如BERT,已经成为各种NLP基准测试中主导排行榜的常见做法。尽管微调模型具有很强的经验性能,但微调是一个不稳定的过程:使用多个随机种子训练同一模型可能会导致任务性能的较大差异。先前的文献(Devlin等人,2019; Lee等人,2020; Dodge等人,2020)确定了观察到的不稳定性的两个潜在原因:灾难性遗忘和微调数据集的小尺寸。在本文中,我们表明,这两种假设都不能解释微调不稳定性。我们分析了BERT、RoBERTa和ALBERT,并对GLUE基准测试中常用的数据集进行了微调,结果表明,观察到的不稳定性是由导致梯度消失的优化困难引起的。此外,我们发现下游任务性能的剩余方差可以归因于泛化的差异,其中具有相同训练损失的微调模型表现出明显不同的测试性能。基于我们的分析,我们提出了一个简单但强大的基线,使微调基于BERT的模型显着比以前提出的方法更稳定。可在线获得重现我们结果的代码:https://github.com/uds-lsv/bert-stable-fine-tuning。

英文摘要:

Fine-tuning pre-trained transformer-based language models such as BERT has become a common practice dominating leaderboards across various NLP benchmarks. Despite the strong empirical performance of fine-tuned models, fine-tuning is an unstable process: training the same model with multiple random seeds can result in a large variance of the task performance. Previous literature (Devlin et al., 2019; Lee et al., 2020; Dodge et al., 2020) identified two potential reasons for the observed instability: catastrophic forgetting and small size of the fine-tuning datasets. In this paper, we show that both hypotheses fail to explain the fine-tuning instability. We analyze BERT, RoBERTa, and ALBERT, fine-tuned on commonly used datasets from the GLUE benchmark, and show that the observed instability is caused by optimization difficulties that lead to vanishing gradients. Additionally, we show that the remaining variance of the downstream task performance can be attributed to differences in generalization where fine-tuned models with the same training loss exhibit noticeably different test performance. Based on our analysis, we present a simple but strong baseline that makes fine-tuning BERT-based models significantly more stable than the previously proposed approaches. Code to reproduce our results is available online: https://github.com/uds-lsv/bert-stable-fine-tuning.

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

↑