arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1909.10351cs.CLcs.AIcs.LG
收藏

TinyBERT:提取BERT用于自然语言理解

TinyBERT: Distilling BERT for Natural Language Understanding

Huawei Noah’s Ark Lab(华为诺亚方舟实验室);Huawei Technologies Co., Ltd.(华为技术有限公司)

Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, Qun Liu

摘要:

语言模型预训练,如BERT,已显着提高了许多自然语言处理任务的性能。然而,预先训练的语言模型通常在计算上是昂贵的,因此难以在资源受限的设备上有效地执行它们。为了在保持准确性的同时加快推理速度并减小模型大小,我们首先提出了一种新的Transformer蒸馏方法,该方法是专门为基于Transformer的模型的知识蒸馏(KD)而设计的。通过利用这种新的KD方法,编码在大型教师BERT中的大量知识可以有效地转移到小型学生Tiny-BERT中。然后,我们为TinyBERT引入了一个新的两阶段学习框架,该框架在预训练和特定任务学习阶段都进行了Transformer蒸馏。该框架保证了Tiny BERT既能获取BERT中的通用领域知识,又能获取任务特定知识。TinyBERT具有4层,经验上有效,在GLUE基准测试中达到了其老师BERTBASE的96.8%以上的性能,同时在推理上小7.5倍,快9.4倍。4层Tiny BERT在BERT蒸馏上也明显优于4层最先进的基线,只有约28%的参数和约31%的推理时间。此外,6层的TinyBERT与它的老师BERTBASE表现相当。

英文摘要:

Language model pre-training, such as BERT, has significantly improved the performances of many natural language processing tasks. However, pre-trained language models are usually computationally expensive, so it is difficult to efficiently execute them on resource-restricted devices. To accelerate inference and reduce model size while maintaining accuracy, we first propose a novel Transformer distillation method that is specially designed for knowledge distillation (KD) of the Transformer-based models. By leveraging this new KD method, the plenty of knowledge encoded in a large teacher BERT can be effectively transferred to a small student Tiny-BERT. Then, we introduce a new two-stage learning framework for TinyBERT, which performs Transformer distillation at both the pretraining and task-specific learning stages. This framework ensures that TinyBERT can capture he general-domain as well as the task-specific knowledge in BERT. TinyBERT with 4 layers is empirically effective and achieves more than 96.8% the performance of its teacher BERTBASE on GLUE benchmark, while being 7.5x smaller and 9.4x faster on inference. TinyBERT with 4 layers is also significantly better than 4-layer state-of-the-art baselines on BERT distillation, with only about 28% parameters and about 31% inference time of them. Moreover, TinyBERT with 6 layers performs on-par with its teacher BERTBASE.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑