Skip to main content
QUICK REVIEW

[论文解读] Distilling the Knowledge of Romanian BERTs Using Multiple Teachers

Andrei-Marius Avram, Darius Catrina|arXiv (Cornell University)|Dec 23, 2021
Natural Language Processing Techniques被引用 8
一句话总结

本文介绍了三种针对罗马尼亚语的蒸馏 BERT 模型——Distil-BERT-base-ro、Distil-RoBERT-base 和 DistilMulti-BERT-base-ro——这些模型通过单教师和集成教师的知识蒸馏训练而成。这些蒸馏模型在五个 NLP 任务上的表现与教师模型相当,同时模型大小减少了 35%,在 GPU 上的推理速度接近两倍快,并且在标签、概率和回归指标上的预测保真度很高。

ABSTRACT

Running large-scale pre-trained language models in computationally constrained environments remains a challenging problem yet to be addressed, while transfer learning from these models has become prevalent in Natural Language Processing tasks. Several solutions, including knowledge distillation, network quantization, or network pruning have been previously proposed; however, these approaches focus mostly on the English language, thus widening the gap when considering low-resource languages. In this work, we introduce three light and fast versions of distilled BERT models for the Romanian language: Distil-BERT-base-ro, Distil-RoBERT-base, and DistilMulti-BERT-base-ro. The first two models resulted from the individual distillation of knowledge from two base versions of Romanian BERTs available in literature, while the last one was obtained by distilling their ensemble. To our knowledge, this is the first attempt to create publicly available Romanian distilled BERT models, which were thoroughly evaluated on five tasks: part-of-speech tagging, named entity recognition, sentiment analysis, semantic textual similarity, and dialect identification. Our experimental results argue that the three distilled models offer performance comparable to their teachers, while being twice as fast on a GPU and ~35% smaller. In addition, we further test the similarity between the predictions of our students versus their teachers by measuring their label and probability loyalty, together with regression loyalty - a new metric introduced in this work.

研究动机与目标

  • 为像罗马尼亚语这样的低资源语言解决缺乏高效、轻量级 BERT 模型的问题。
  • 降低大型预训练模型在现实世界 NLP 应用中的计算和环境成本。
  • 在包括方言识别等低资源场景在内的多样化罗马尼亚语 NLP 任务上评估蒸馏模型。
  • 提出并验证新的保真度度量指标——标签保真度、概率保真度和回归保真度,用于衡量教师模型与学生模型之间的预测相似性。
  • 开源蒸馏模型和训练脚本,以提高可复现性并促进社区采纳。

提出的方法

  • 应用知识蒸馏训练更小的学生模型,使用更大的教师模型(BERT-base-ro 和 RoBERT-base)生成的软标签。
  • 创建了三个学生模型:一个分别来自每个教师模型,第三个则来自两个教师模型的集成,使用合并的训练语料和 BERT-base-ro 分词器。
  • 蒸馏过程通过最小化教师和学生模型 logits 之间的交叉熵损失来实现,采用温度缩放以提升软标签的迁移效果。
  • 使用三种保真度度量评估预测保真度:标签保真度(学生预测与教师标签的一致性准确率)、概率保真度(输出分布之间的 Kullback-Leibler 散度)和回归保真度(回归任务中的皮尔逊相关系数)。
  • 在序列长度从 16 到 512 个 token 的范围内,测量 CPU 和 GPU 上的推理速度,将蒸馏模型与基础版、小型版和大型版模型进行比较。
  • 所有模型均在五个罗马尼亚语 NLP 任务上进行评估:词性标注、命名实体识别、情感分析、方言识别和语义文本相似度。

实验结果

研究问题

  • RQ1知识蒸馏能否在保持多样化 NLP 任务性能的前提下,有效压缩罗马尼亚语 BERT 模型?
  • RQ2与单教师蒸馏相比,使用多个罗马尼亚语 BERT 教师模型进行集成蒸馏,在学生模型性能和泛化能力方面表现如何?
  • RQ3在标签保真度、概率保真度和回归保真度的度量下,蒸馏模型在多大程度上保持了与教师模型的预测一致性?
  • RQ4在推理速度方面,蒸馏模型相比其教师模型快多少,尤其是在 GPU 上?
  • RQ5在特定低资源 NLP 任务(如方言识别)中,蒸馏模型是否可能超越其教师模型?

主要发现

  • Distil-BERT-base-ro 在方言识别任务上取得了 74.76% 的 F1 分数,比蒸馏集成模型高出 1.5%。
  • DistilMulti-BERT-base-ro 模型在回归任务中与教师模型的保真度最高(94.64%),表明其在回归任务中输出分布高度相似。
  • 所有蒸馏模型在 GPU 上的参数量约为教师模型的 65%(即减少 35%),推理速度接近两倍快,尤其在长序列上提速显著。
  • 平均而言,蒸馏模型在所有五个评估任务中保持了教师模型超过 90% 的性能,部分任务甚至略有提升。
  • 在多个任务中,包括情感分析和语义文本相似度,蒸馏模型的表现优于其教师模型和其他基线模型。
  • 在 GPU 上的推理速度接近教师模型的两倍,且在所有模型尺寸中表现最佳,尤其在长序列任务中优势明显。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

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