arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2109.07222cs.CLcs.AIcs.LG
收藏

EfficientBERT:通过预热知识蒸馏逐步搜索多层感知器

EfficientBERT: Progressively Searching Multilayer Perceptron via Warm-up Knowledge Distillation

Shenzhen Campus of Sun Yat-sen University(中山大学深圳校区);University of Oxford(牛津大学);Huawei Noah’s Ark Lab(华为诺亚方舟实验室);DarkMatter AI Research(暗物质人工智能研究院)

Chenhe Dong, Guangrun Wang, Hang Xu, Jiefeng Peng, Xiaozhe Ren, Xiaodan Liang

摘要:

预训练的语言模型在各种NLP任务中表现出了显着的效果。然而,由于它们体积庞大,推理速度慢,很难在边缘设备上部署它们。在本文中,我们有一个关键的洞察力,改善前馈网络(FFN)在BERT有一个更高的增益比改善多头注意力(MHA),因为FFN的计算成本是2 $\sim$ 3倍大于MHA。因此,紧凑的BERT,我们致力于设计高效的FFN,而不是以前的作品,注意MHA。由于FFN包括一个多层感知器(MLP),这是必不可少的BERT优化,我们进一步设计了一个彻底的搜索空间向先进的MLP和执行一个由粗到细的机制,以寻找一个有效的BERT架构。此外,为了加快搜索速度和增强模型的可移植性,我们在每个搜索阶段采用了一种新的预热知识蒸馏策略。大量的实验表明,我们所搜索的EfficientBERT是6.9 $\times$小,4.4 $\times$快于BERT $\rm_{BASE}$,并具有竞争力的性能在GLUE和SQuAD基准。具体而言,即使没有数据增强,EfficientBERT在GLUE \emph{test}上的平均得分为77.7,比MobileBERT $\rm_{TINY}$高0.7,在SQuAD v1.1/v2.0 \emph{dev}上的F1得分为85.3/74.5,比TinyBERT $_4$高3.2/2.7。该代码在https://github.com/cheneydon/efficient-bert上发布。

英文摘要:

Pre-trained language models have shown remarkable results on various NLP tasks. Nevertheless, due to their bulky size and slow inference speed, it is hard to deploy them on edge devices. In this paper, we have a critical insight that improving the feed-forward network (FFN) in BERT has a higher gain than improving the multi-head attention (MHA) since the computational cost of FFN is 2$\sim$3 times larger than MHA. Hence, to compact BERT, we are devoted to designing efficient FFN as opposed to previous works that pay attention to MHA. Since FFN comprises a multilayer perceptron (MLP) that is essential in BERT optimization, we further design a thorough search space towards an advanced MLP and perform a coarse-to-fine mechanism to search for an efficient BERT architecture. Moreover, to accelerate searching and enhance model transferability, we employ a novel warm-up knowledge distillation strategy at each search stage. Extensive experiments show our searched EfficientBERT is 6.9$\times$ smaller and 4.4$\times$ faster than BERT$\rm_{BASE}$, and has competitive performances on GLUE and SQuAD Benchmarks. Concretely, EfficientBERT attains a 77.7 average score on GLUE \emph{test}, 0.7 higher than MobileBERT$\rm_{TINY}$, and achieves an 85.3/74.5 F1 score on SQuAD v1.1/v2.0 \emph{dev}, 3.2/2.7 higher than TinyBERT$_4$ even without data augmentation. The code is released at https://github.com/cheneydon/efficient-bert.

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

↑