PreprintCited by 703Topic ModelingAdvanced Neural Network ApplicationsDomain Adaptation and Few-Shot Learning

MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers

Open access
Wang, Wenhui, Wei, Furu, Dong, Li, Bao, Hangbo, Yang, Nan, Zhou, Ming·2020·arXiv

Abstract

Pre-trained language models (e.g., BERT (Devlin et al., 2018) and its variants) have achieved remarkable success in varieties of NLP tasks. However, these models usually consist of hundreds of millions of parameters which brings challenges for fine-tuning and online serving in real-life applications due to latency and capacity constraints. In this work, we present a simple and effective approach to compress large Transformer (Vaswani et al., 2017) based pre-trained models, termed as deep self-attention distillation. The small model (student) is trained by deeply mimicking the self-attention module, which plays a vital role in Transformer networks, of the large model (teacher). Specifically, we propose distilling the self-attention module of the last Transformer layer of the teacher, which is effective and flexible for the student. Furthermore, we introduce the scaled dot-product between values in the self-attention module as the new deep self-attention knowledge, in addition to the attention distributions (i.e., the scaled dot-product of queries and keys) that have been used in existing works. Moreover, we show that introducing a teacher assistant (Mirzadeh et al., 2019) also helps the distillation of large pre-trained Transformer models. Experimental results demonstrate that our monolingual model outperforms state-of-the-art baselines in different parameter size of student models. In particular, it retains more than 99% accuracy on SQuAD 2.0 and several GLUE benchmark tasks using 50% of the Transformer parameters and computations of the teacher model. We also obtain competitive results in applying deep self-attention distillation to multilingual pre-trained models.

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

DataCite · 10.48550/arxiv.2002.10957

Cites

Statistics

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Run the check — free, no account needed. It reads the open-access text and checks the sources it cites.

A few free checks a day · papers already verified open instantly · results are public

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

The citation lists haven’t been fetched yet

References 57 · Cited by 703

Research works printed but not linked: 13

  1. Bahdanau, D., Cho, K., and Bengio, Y. Neural machine translation by jointly learning to align and translate. In 3rd International Conference on Learning Representa- tions, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
  2. Bar-Haim, R., Dagan, I., Dolan, B., Ferro, L., and Giampic- colo, D. The second PASCAL recognising textual entail- ment challenge. In Proceedings of the Second PASCAL Challenges Workshop on Recognising Textual Entailment, 01 2006.
  3. Bentivogli, L., Dagan, I., Dang, H. T., Giampiccolo, D., and Magnini, B. The fifth pascal recognizing textual entailment challenge. In In Proc Text Analysis Conference (TAC'09, 2009.
  4. Dolan, W. B. and Brockett, C. Automatically construct- ing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
  5. Du, X. and Cardie, C. Harvesting paragraph-level question- answer pairs from wikipedia. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pp. 1907–1917, 2018. http://arxiv.org/abs/1910.03723 http://arxiv.org/abs/1910.03723 http://arxiv.org/abs/1607.06450 http://arxiv.org/abs/1607.06450 http://arxiv.org/abs/1906.04341 http://arxiv.org/abs/1906.04341 http://arxiv.org/abs/1911.02116 http://dx.doi.org/10.1007/11736790_9 · DOI
  6. Gehrmann, S., Deng, Y., and Rush, A. Bottom-up ab- stractive summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Lan- guage Processing, pp. 4098–4109, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. URL https://www.aclweb.org/ anthology/D18-1443.
  7. Lample, G. and Conneau, A. Cross-lingual language model pretraining. Advances in Neural Information Processing Systems (NeurIPS), 2019.
  8. Lin, C.-Y. ROUGE: A package for automatic evalua- tion of summaries. In Text Summarization Branches Out: Proceedings of the ACL-04 Workshop, pp. 74–81, Barcelona, Spain, July 2004. Association for Compu- tational Linguistics. URL https://www.aclweb. org/anthology/W04-1013.
  9. Sun, Z., Yu, H., Song, X., Liu, R., Yang, Y., and Zhou, D. Mobilebert: Task-agnostic compression of bert by progressive knowledge transfer, 2019b. URL https: //openreview.net/pdf?id=SJxjVaNKwB.
  10. Turc, I., Chang, M., Lee, K., and Toutanova, K. Well-read students learn better: The impact of student initialization on knowledge distillation. CoRR, abs/1908.08962, 2019b. URL http://arxiv.org/abs/1908.08962. http://www.aclweb.org/anthology/N18-1202 http://www.aclweb.org/anthology/N18-1202 https://s3-us-west-2.amazonaws.com/openaiassets/research-covers/language-unsupervised/language understanding paper.pdf https://s3-us-west-2.amazonaws.com/openaiassets/research-covers/language-unsupervised/language understanding paper.pdf https://s3-us-west-2.amazonaws.com/openaiassets/research-covers/language-unsupervised/language understanding paper.pdf https://s3-us-west-2.amazonaws.com/openaiassets/research-covers/language-unsupervised/language understanding paper.pdf https://www.aclweb.org/anthology/D16-1264 https://www.aclweb.org/anthology/D16-1264 http://arxiv.org/abs/1412.6550 http://arxiv.org/abs/1910.01108 http://arxiv.org/abs/1910.01108 https://www.aclweb.org/anthology/P17-1099 https://www.aclweb.org/anthology/P17-1099 https://openreview.net/pdf?id=SJxjVaNKwB https://openreview.net/pdf?id=SJxjVaNKwB http://arxiv.org/abs/1903.12136 http://arxiv.org/abs/1908.08962 http://arxiv.org/abs/1908.08962 · arXiv
  11. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Sys- tems 30, pp. 5998–6008. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 7181-attention-is-all-you-need.pdf.
  12. Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R., and Le, Q. V. XLNet: Generalized autoregressive pretraining for language understanding. In 33rd Confer- ence on Neural Information Processing Systems (NeurIPS 2019), 2019.
  13. Zagoruyko, S. and Komodakis, N. Paying more atten- tion to attention: Improving the performance of con- volutional neural networks via attention transfer. In 5th International Conference on Learning Representa- tions, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017. URL https: //openreview.net/forum?id=Sks9_ajex.

Authors
Wang, W., Wei, F., Dong, L., Bao, H., Yang, N., & Zhou, M.
Venue
arXiv
Publisher
arXiv
Published
2020
ISSN
2331-8422 (ISSN-L)
OpenAlex
W3008374555
Cited by
703
References
57
Citations by year
2026: 18 · 2025: 112 · 2024: 145 · 2023: 215 · 2022: 109 · 2021: 88 · 2020: 16
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion)
  • arXiv (Cornell University)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Topic Modeling
  • Physical Sciences › Computer Science › Computer Vision and Pattern Recognition › Advanced Neural Network Applications
  • Physical Sciences › Computer Science › Artificial Intelligence › Domain Adaptation and Few-Shot Learning
Keywords
knowledge distillation, transformer compression, pre-trained language models, teacher assistants, scaled dot-product attention, parameter-efficient models, BERT, multilingual models, SQuAD, GLUE benchmark

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review