[论文解读] Structured Pruning of a BERT-based Question Answering Model
本文表明,将任务特定的结构化裁剪与蒸馏相结合可以压缩 BERT/RoBERTa 的问答模型,在不重新预训练的情况下,在准确率损失很小的前提下获得显著的推理速度提升。
The recent trend in industry-setting Natural Language Processing (NLP) research has been to operate large %scale pretrained language models like BERT under strict computational limits. While most model compression work has focused on "distilling" a general-purpose language representation using expensive pretraining distillation, less attention has been paid to creating smaller task-specific language representations which, arguably, are more useful in an industry setting. In this paper, we investigate compressing BERT- and RoBERTa-based question answering systems by structured pruning of parameters from the underlying transformer model. We find that an inexpensive combination of task-specific structured pruning and task-specific distillation, without the expense of pretraining distillation, yields highly-performing models across a range of speed/accuracy tradeoff operating points. We start from existing full-size models trained for SQuAD 2.0 or Natural Questions and introduce gates that allow selected parts of transformers to be individually eliminated. Specifically, we investigate (1) structured pruning to reduce the number of parameters in each transformer layer, (2) applicability to both BERT- and RoBERTa-based models, (3) applicability to both SQuAD 2.0 and Natural Questions, and (4) combining structured pruning with distillation. We achieve a near-doubling of inference speed with less than a 0.5 F1-point loss in short answer accuracy on Natural Questions.
研究动机与目标
- 在不从零重新训练的前提下,推动在工业环境中减轻大型问答模型的计算负担。
- 为基于 BERT 的问答系统开发并评估任务特定的结构化裁剪。
- 研究将结构化裁剪与蒸馏结合,以在尽量小的准确率损失下实现最大化的加速。
- 评估裁剪技术在数据集(SQuAD 2.0 与 Natural Questions)和模型(BERT 与 RoBERTa)之间的迁移性。
- 为基于 transformer 的问答模型提供门控放置与裁剪策略的指南。
提出的方法
- 在每个 transformer 层中插入可训练的门控掩模,以选择性地使注意力头和前馈激活失效。
- 探索门控确定策略,包括随机、头部重要性增益,以及带有 hard-concrete 分布的 L0 正则化。
- 通过应用门控来裁剪注意力头和前馈组件,并使用或不使用蒸馏对剩余参数进行再训练。
- 裁剪后继续进行任务特定训练,提供标准再训练或从未裁剪的教师模型进行蒸馏的选项。
- 将裁剪应用于基于 BERT 的和基于 RoBERTa 的问答系统,并在 SQuAD 2.0 和 Natural Questions 上进行评估。
- 证明非同质的、逐层的裁剪结构可以出现(靠近两端更轻,中间更复杂)。
实验结果
研究问题
- RQ1在问答任务中,任务特定的结构化裁剪是否可以从 BERT-base 迁移到 BERT-large?
- RQ2为基于 BERT 的问答开发的结构化裁剪技术是否可迁移到 RoBERTa 以及 Natural Questions?
- RQ3将结构化裁剪与蒸馏结合是否在速度与准确性之间给出比仅裁剪或仅蒸馏更好的权衡?
- RQ4用于裁剪问答 transformer 的有效门控确定策略(随机、增益、L0)有哪些?
- RQ5裁剪对在 SQuAD 2.0 和 Natural Questions 上的长答案与短答案问答性能有何影响?
主要发现
- L0 正则化裁剪实现了显著裁剪(注意力头最多约 48% 和前馈激活约 70%),在 SQuAD 2.0 上 F1 损失小于 5 点。
- 结合裁剪与持续训练可恢复大部分准确性,并使在 SQuAD 2.0 上的解码速度几乎翻倍。
- 对 Natural Questions 的 RoBERTa-large 进行裁剪可获得显著的速度提升,同时保持较小的 F1 损失,并受益于蒸馏。
- 裁剪后进行蒸馏带来额外提升,接近更大基线的性能,同时保持更快的推理。
- 裁剪后的模型倾向于具有非同一的层结构,中间层比两端保留得更重,表明存在跨层的非均匀裁剪模式。
- 裁剪技术可迁移到 RoBERTa 与 NQ,表明该方法具有模型和数据集无关的鲁棒性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。