[论文解读] Distilling Task-Specific Knowledge from BERT into Simple Neural Networks
该论文将 BERT 的任务特定知识蒸馏到单层 BiLSTM(以及用于句子对的孪生 BiLSTM),在参数显著更少、推理速度更快的情况下,其性能接近 ELMo。
In the natural language processing literature, neural networks are becoming increasingly deeper and complex. The recent poster child of this trend is the deep language representation model, which includes BERT, ELMo, and GPT. These developments have led to the conviction that previous-generation, shallower neural networks for language understanding are obsolete. In this paper, however, we demonstrate that rudimentary, lightweight neural networks can still be made competitive without architecture changes, external training data, or additional input features. We propose to distill knowledge from BERT, a state-of-the-art language representation model, into a single-layer BiLSTM, as well as its siamese counterpart for sentence-pair tasks. Across multiple datasets in paraphrasing, natural language inference, and sentiment classification, we achieve comparable results with ELMo, while using roughly 100 times fewer parameters and 15 times less inference time.
研究动机与目标
- 质疑简单架构是否能在 NLP 任务中与深层 Transformer 竞争。
- 通过蒸馏展示从 BERT 到轻量级 BiLSTM 的知识转移。
- 展示用于 NLP 蒸馏的基于规则的数据增强方法的有效性。
提出的方法
- 以 BERT 作为教师,通过对数值/软目标蒸馏引导单层 BiLSTM 学生。
- 应用蒸馏损失,使教师和学生的对数输出之间的均方误差最小化(L_distill)。
- 将蒸馏损失与交叉熵结合,由混合参数 alpha 控制(L = alpha*L_CE + (1-alpha)*L_distill)。
- 使用基于规则的数据增强策略(掩码、基于詞性替换、n-gram 采样)构建迁移数据集。
- 对于句子对任务,使用带连接-比较分类器的孪生 BiLSTM。
- 在 GLUE 任务 SST-2、MNLI、QQP 上报告结果,以与 ELMo 和 BERT 基线进行比较。
实验结果
研究问题
- RQ1浅层 BiLSTM 模型能否通过知识蒸馏在有 BERT 教师的情况下达到有竞争力的性能?
- RQ2对小型学生而言,对数输出蒸馏与标准监督训练相比有何差异?
- RQ3基于规则的数据增强是否能提升 NLP 蒸馏的效果?
- RQ4在将 BERT 蒸馏为 BiLSTM 时,准确率、参数数量和推理速度的权衡有哪些?
- RQ5在 GLUE 任务上,蒸馏后的 BiLSTM 相对于 ELMo 和 Transformer 基线表现如何?
主要发现
| 模型 | SST-2 准确率 | QQP F1/准确率 | MNLI-m 准确率 | MNLI-mm 准确率 |
|---|---|---|---|---|
| BERT LARGE Devlin et al. (2018) | 94.9 | 72.1/89.3 | 86.7 | 85.9 |
| BERT BASE Devlin et al. (2018) | 93.5 | 71.2/89.2 | 84.6 | 83.4 |
| OpenAI GPT Radford et al. (2018) | 91.3 | 70.3/88.5 | 82.1 | 81.4 |
| BERT ELMo baseline Devlin et al. (2018) | 90.4 | 64.8/84.7 | 76.4 | 76.1 |
| GLUE ELMo baseline Wang et al. (2018) | 90.4 | 63.1/84.3 | 74.1 | 74.5 |
| Distilled BiLSTM SOFT (our approach) | 90.7 | 68.2/88.1 | 73.0 | 72.6 |
| BiLSTM (our implementation) | 86.7 | 63.7/86.2 | 68.7 | 68.3 |
- 带软目标的蒸馏 BiLSTM 在 SST-2 和 QQP 上的表现接近 ELMo 水平,并使 MNLI 相较非蒸馏 BiLSTM 有所提升。
- 蒸馏 BiLSTM 在单句任务上达到与 ELMo 相当的结果,同时参数数量约少 100 倍,推理速度约快 15 倍。
- 在 MNLI 上,蒸馏 BiLSTM 比基础 BiLSTM 提升 4.3 点,并胜过一些早期 BiLSTM 结果,尽管仍落后于 BERT/Large 和 ELMo 基线。
- 该方法在 300 单元 BiLSTM 变体下产生 2.2e6 个参数,在推理速度方面相比 BERT-LARGE 和 ELMo 显示出显著的效率提升。
- 用于句子对任务的孪生 BiLSTM 通过避免成对单词交互,实现与句子长度成线性关系的运行时间。
- 总体而言,带蒸馏的浅层 BiLSTM 的表现可与两种实现的 ELMo 相竞争,且具备显著的效率优势;平均而言尚未超过深层 Transformer 模型。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。