Knowledge Distillation (KD) is a predominant approach for BERT compression. Previous KD-based methods focus on designing extra alignment losses for the student model to mimic the behavior of the teacher model. These methods transfer the knowledge in an indirect way. In this paper, we propose a novel Weight-Inherited Distillation (WID), which directly transfers knowledge from the teacher. WID does not require any additional alignment loss and trains a compact student by inheriting the weights, showing a new perspective of knowledge distillation. Specifically, we design the row compactors and column compactors as mappings and then compress the weights via structural re-parameterization. Experimental results on the GLUE and SQuAD benchmarks show that WID outperforms previous state-of-the-art KD-based baselines. Further analysis indicates that WID can also learn the attention patterns from the teacher model without any alignment loss on attention distributions.
翻译:知识蒸馏(KD)是BERT压缩的主流方法。以往基于KD的方法主要为学生模型设计额外的对齐损失,以模仿教师模型的行为,这些方法以间接方式传递知识。本文提出一种新颖的权重继承蒸馏(WID),该方法直接从教师模型传递知识。WID无需任何额外的对齐损失,通过继承权重来训练紧凑的学生模型,展现了知识蒸馏的新视角。具体而言,我们设计行压缩器和列压缩器作为映射函数,并通过结构重参数化实现权重压缩。在GLUE和SQuAD基准测试上的实验结果表明,WID的性能超越了以往最先进的基于KD的基线方法。进一步分析表明,即使在注意力分布上不施加任何对齐损失,WID也能从教师模型中学习到注意力模式。