Skip to main content
QUICK REVIEW

[论文解读] What Would Elsa Do? Freezing Layers During Transformer Fine-Tuning

Jaejun Lee, Raphael Tang|arXiv (Cornell University)|Nov 8, 2019
Topic Modeling参考文献 25被引用 34
一句话总结

本文研究在预训练的 transformer 模型(BERT 与 RoBERTa)中需要微调最后多少层才能达到近似满性能,结果是在大多数任务中,最后几层的大约四分之一就足以达到 90% 的质量,存在一些例外。

ABSTRACT

Pretrained transformer-based language models have achieved state of the art across countless tasks in natural language processing. These models are highly expressive, comprising at least a hundred million parameters and a dozen layers. Recent evidence suggests that only a few of the final layers need to be fine-tuned for high quality on downstream tasks. Naturally, a subsequent research question is, "how many of the last layers do we need to fine-tune?" In this paper, we precisely answer this question. We examine two recent pretrained language models, BERT and RoBERTa, across standard tasks in textual entailment, semantic similarity, sentiment analysis, and linguistic acceptability. We vary the number of final layers that are fine-tuned, then study the resulting change in task-specific effectiveness. We show that only a fourth of the final layers need to be fine-tuned to achieve 90% of the original quality. Surprisingly, we also find that fine-tuning all layers does not always help.

研究动机与目标

  • 确定在 BERT 和 RoBERTa 中需要微调多少个最后层以在标准 NLP 任务上维持高性能。
  • 量化微调层数量与多数据集任务性能之间的关系。
  • 识别在某些任务中微调更少层或全部层能获得最佳结果的情况。

提出的方法

  • 对 BERT 和 RoBERTa 的变体(BASE 和 LARGE)进行微调,同时冻结嵌入并逐步增加冻结的前几层数量(N = L/2 到 L)。
  • 在 GLUE 任务上评估:CoLA、SST-2、MRPC、STS-B、QQP、MNLI、QNLI、RTE。
  • 使用 Adam 优化器,批量大小为 16;对学习率在 [1e-5, 5e-5] 区间进行任务特定的超参数线性搜索。
  • 比较在不冻结、冻结部分或全部非输出层时的性能;报告相对于全模型微调的相对增益。
  • 通过观察解冻更多层时的性能来分析每层的贡献;识别边际收益递减以及在 SST-2 中的潜在过参数化。

实验结果

研究问题

  • RQ1需要微调多少个最终的 Transformer 层才能达到全模型性能的目标分数(例如 90%)?
  • RQ2冻结较前面的层是否在不同任务和模型规模(BASE 与 LARGE)上表现出一致的性能?
  • RQ3是否存在某些任务在不对所有层进行微调时相对全微调可以提升或降低性能?
  • RQ4随着解冻层数增加,性能增益的形状如何?

主要发现

  • 在大多数任务中,只需要对最后四分之一的层进行微调,即可达到约 90% 的全模型质量。
  • 在 SST-2 上,不对所有层进行微调可以提升质量,相较于全微调。
  • 对所有层进行微调并不总是有帮助,在某些任务上甚至可能导致性能下降。
  • 解冻更多层时观察到边际收益递减;半个网络通常足以接近全性能,较大模型也呈现类似趋势。
  • 大型变体(BASE 与 LARGE)显示冻结 12–16 层在某些任务上能获得稳定增益,表明在某些情况下存在过参数化。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。