BERT-EMD:用于BERT压缩的多对多层映射与地球移动器的距离
BERT-EMD: Many-to-Many Layer Mapping for BERT Compression with Earth Mover's Distance
摘要:
预先训练的语言模型(例如,BERT)在各种自然语言处理(NLP)任务中取得了显著的成功。然而,高存储和计算成本阻碍了预训练的语言模型有效地部署在资源受限的设备上。在本文中,我们提出了一种新的BERT蒸馏方法的基础上多对多层映射,它允许每个中间学生层从任何中间教师层学习。通过这种方式,我们的模型可以自适应地从不同的教师层学习各种NLP任务。%的动机是直觉,不同的NLP任务需要不同水平的语言知识包含在BERT的中间层。此外,我们利用地球移动器的距离(EMD)来计算必须支付的最小累积成本,将知识从教师网络到学生网络。EMD使得多对多层映射的有效匹配成为可能。%EMD可以应用于不同大小的网络层,有效地测量教师网络和学生网络之间的语义距离。此外,我们还提出了一种成本注意力机制来自动学习EMD中使用的层权值,以进一步提高模型的性能并加快收敛时间。在GLUE基准测试上的大量实验表明,与强大的竞争对手相比,我们的模型在准确性和模型压缩方面都具有竞争力的性能。
英文摘要:
Pre-trained language models (e.g., BERT) have achieved significant success in various natural language processing (NLP) tasks. However, high storage and computational costs obstruct pre-trained language models to be effectively deployed on resource-constrained devices. In this paper, we propose a novel BERT distillation method based on many-to-many layer mapping, which allows each intermediate student layer to learn from any intermediate teacher layers. In this way, our model can learn from different teacher layers adaptively for various NLP tasks. %motivated by the intuition that different NLP tasks require different levels of linguistic knowledge contained in the intermediate layers of BERT. In addition, we leverage Earth Mover's Distance (EMD) to compute the minimum cumulative cost that must be paid to transform knowledge from teacher network to student network. EMD enables the effective matching for many-to-many layer mapping. %EMD can be applied to network layers with different sizes and effectively measures semantic distance between the teacher network and student network. Furthermore, we propose a cost attention mechanism to learn the layer weights used in EMD automatically, which is supposed to further improve the model's performance and accelerate convergence time. Extensive experiments on GLUE benchmark demonstrate that our model achieves competitive performance compared to strong competitors in terms of both accuracy and model compression.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。