MiniLMv2: Multi-Head Self-Attention Relation Distillation for Compressing Pretrained Transformers
arXiv:2012.15828
Abstract
We generalize deep self-attention distillation in MiniLM (Wang et al., 2020) by only using self-attention relation distillation for task-agnostic compression of pretrained Transformers. In particular, we define multi-head self-attention relations as scaled dot-product between the pairs of query, key, and value vectors within each self-attention module. Then we employ the above relational knowledge to train the student model. Besides its simplicity and unified principle, more favorably, there is no restriction in terms of the number of student's attention heads, while most previous work has to guarantee the same head number between teacher and student. Moreover, the fine-grained self-attention relations tend to fully exploit the interaction knowledge learned by Transformer. In addition, we thoroughly examine the layer selection strategy for teacher models, rather than just relying on the last layer as in MiniLM. We conduct extensive experiments on compressing both monolingual and multilingual pretrained models. Experimental results demonstrate that our models distilled from base-size and large-size teachers (BERT, RoBERTa and XLM-R) outperform the state-of-the-art.
arXiv commentMonolingual and multilingual distilled models: https://github.com/microsoft/unilm/tree/master/minilm
References in corpus (10)
- Distilling the Knowledge in a Neural Network
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
- Paying More Attention to Attention: Improving the Performance of Convolutional Neural Networks via Attention Transfer
- MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers
- MASS: Masked Sequence to Sequence Pre-training for Language Generation
- A Simple Method for Commonsense Reasoning
- UniLMv2: Pseudo-Masked Language Models for Unified Language Model Pre-Training
- InfoXLM: An Information-Theoretic Framework for Cross-Lingual Language Model Pre-Training
- BERT-of-Theseus: Compressing BERT by Progressive Module Replacing
- Cross-Lingual Natural Language Generation via Pre-Training