[论文解读] On the Effect of Dropping Layers of Pre-trained Transformer Models
本文提出了一种从预训练的Transformer模型(BERT、RoBERTa、XLNet、ALBERT、DistilBERT)中删除层的方法,以实现无需微调或重新训练的高效迁移学习。通过系统性地剪除顶层、底层、中间层或交替层,作者实现了高达40%的模型尺寸缩减,同时在GLUE任务上保留了高达98.2%的原始性能,其效果与知识蒸馏相当,且无需微调或训练新模型。
Transformer-based NLP models are trained using hundreds of millions or even billions of parameters, limiting their applicability in computationally constrained environments. While the number of parameters generally correlates with performance, it is not clear whether the entire network is required for a downstream task. Motivated by the recent work on pruning and distilling pre-trained models, we explore strategies to drop layers in pre-trained models, and observe the effect of pruning on downstream GLUE tasks. We were able to prune BERT, RoBERTa and XLNet models up to 40%, while maintaining up to 98% of their original performance. Additionally we show that our pruned models are on par with those built using knowledge distillation, both in terms of size and performance. Our experiments yield interesting observations such as, (i) the lower layers are most critical to maintain downstream task performance, (ii) some tasks such as paraphrase detection and sentence similarity are more robust to the dropping of layers, and (iii) models trained using a different objective function exhibit different learning patterns and w.r.t the layer dropping.
研究动机与目标
- 探究预训练Transformer模型中的所有层是否对下游NLP任务都是必要的。
- 识别在剪枝后维持性能最关键的层。
- 开发高效、无需微调的模型压缩策略,在保持性能的同时减小模型尺寸。
- 对比层剪枝与知识蒸馏及其他压缩技术的有效性。
- 分析不同的预训练目标(自编码 vs. 自回归)如何影响层的重要性与学习动态。
提出的方法
- 作者评估了多种层剪枝策略:从预训练模型中移除顶层、底层、中间层或交替层。
- 利用激活模式和权重统计量识别并移除贡献最小的层。
- 该方法应用于BERT、RoBERTa、XLNet、ALBERT和DistilBERT,仅对剩余层进行微调。
- 在GLUE基准上评估性能,涵盖SST-2、MNLI、QNLI、QQP和STS-B等多个NLP任务。
- 将该方法与知识蒸馏及其他剪枝方法(包括贪婪层剪枝(GLP)和LayerDrop)进行比较。
- 作者还测试了在移除层后对剪枝模型进行微调,以评估任务特定适应是否能提升性能。
实验结果
研究问题
- RQ1是否可以通过从预训练Transformer中删除层来实现显著的模型压缩,而无需重新训练?
- RQ2在顶层、底层、中间层或交替层中,哪类层对维持下游任务性能最为关键?
- RQ3在准确率、模型大小和推理速度方面,剪枝模型的性能与基于知识蒸馏的模型相比如何?
- RQ4不同的预训练目标(如自编码 vs. 自回归)是否会导致不同的层重要性模式和学习动态?
- RQ5像DistilBERT这样的蒸馏模型是否可以进一步剪枝,其中涉及的性能权衡是什么?
主要发现
- 在BERT、RoBERTa和XLNet中,高达40%的层可以被删除,同时在GLUE任务上保持高达98.2%的原始性能。
- 剪枝顶层层在各类模型和任务中均能稳定保持性能,表现优于或等同于使用LayerDrop和贪婪剪枝训练的模型。
- 底层对下游任务性能最为关键,某些任务仅需保留12层中的3层,即可将性能损失控制在1%以内。
- 剪枝模型在准确率、模型大小和推理速度方面与知识蒸馏模型表现相当,但无需重新训练或使用教师模型。
- DistilBERT可进一步剪枝,移除其约三分之一的层,平均性能仅下降0.75个GLUE分数点。
- RoBERTa和XLNet等模型在网络更早阶段即学习到任务特定知识,使其对层剪枝更具鲁棒性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。