Skip to main content
QUICK REVIEW

[Paper Review] Distilling BERT into Simple Neural Networks with Unlabeled Transfer Data

Subhabrata Mukherjee, Ahmed Hassan Awadallah|arXiv (Cornell University)|Oct 4, 2019
Natural Language Processing TechniquesComputer Science28 references9 citations
TL;DR

This paper proposes distilling large pre-trained BERT models into simple RNN-based student networks using in-domain unlabeled transfer data, achieving performance on par with or exceeding the teacher model. With up to 26x parameter compression and 51x latency speedup, the method matches 95% of BERT's F1-score across 41 languages while requiring only limited labeled data.

ABSTRACT

Recent advances in pre-training huge models on large amounts of text through self supervision have obtained state-of-the-art results in various natural language processing tasks. However, these huge and expensive models are difficult to use in practise for downstream tasks. Some recent efforts use knowledge distillation to compress these models. However, we see a gap between the performance of the smaller student models as compared to that of the large teacher. In this work, we leverage large amounts of in-domain unlabeled transfer data in addition to a limited amount of labeled training instances to bridge this gap for distilling BERT. We show that simple RNN based student models even with hard distillation can perform at par with the huge teachers given the transfer set. The student performance can be further improved with soft distillation and leveraging teacher intermediate representations. We show that our student models can compress the huge teacher by up to 26x while still matching or even marginally exceeding the teacher performance in low-resource settings with small amount of labeled data. Additionally, for the multilingual extension of this work with XtremeDistil (Mukherjee and Hassan Awadallah, 2020), we demonstrate massive distillation of multilingual BERT-like teacher models by upto 35x in terms of parameter compression and 51x in terms of latency speedup for batch inference while retaining 95% of its F1-score for NER over 41 languages.

Motivation & Objective

  • To address the challenge of deploying large, computationally expensive pre-trained language models like BERT in low-resource and production settings.
  • To improve the performance of small student models in low-resource settings by leveraging large amounts of in-domain unlabeled transfer data.
  • To explore whether simple RNN-based student architectures can match or exceed the performance of large BERT teachers through knowledge distillation.
  • To investigate the impact of training schedules, distillation objectives, and teacher model capacity on student performance.

Proposed method

  • Using a two-stage training schedule: first optimizing representation loss on unlabeled data, then jointly optimizing logit and cross-entropy losses on labeled data with gradual unfreezing of layers.
  • Applying hard distillation using the teacher’s predicted class labels as targets for the student model.
  • Enhancing performance via soft distillation by using temperature-scaled soft labels from the teacher to improve generalization.
  • Leveraging intermediate hidden representations from the teacher network to guide student learning beyond final logits.
  • Training student models (BiLSTM-based) without pre-training on unlabeled data, relying instead on knowledge distillation from the teacher.
  • Optimizing the student model using a combination of cross-entropy loss on labeled data and distillation losses from the teacher’s output and hidden states.

Experimental results

Research questions

  • RQ1Can simple RNN-based student models match the performance of large BERT teachers when trained with knowledge distillation and in-domain unlabeled data?
  • RQ2How does the inclusion of large-scale unlabeled transfer data affect student model performance in low-resource settings?
  • RQ3What training schedule and loss combination yields the best distillation performance for small student models?
  • RQ4Does soft distillation or intermediate representation distillation improve student performance beyond hard distillation?
  • RQ5How does the size of the teacher model affect distillation performance when the student size is fixed?

Key findings

  • Simple BiLSTM-based student models achieve performance on par with BERT Base and BERT Large, even with up to 26x parameter compression.
  • The student model marginally exceeds the teacher performance in low-resource settings with limited labeled data.
  • Soft distillation and intermediate representation distillation further improve student performance beyond hard distillation.
  • The method achieves up to 35x parameter compression and 51x latency speedup for multilingual BERT-like models while retaining 95% of the F1-score across 41 languages.
  • Stagewise training with gradual unfreezing of layers yields the best distillation performance compared to joint optimization.
  • Larger teacher models provide marginal gains in distillation performance once the student model size is saturated.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.