Improving Multi-Task Deep Neural Networks via Knowledge Distillation for Natural Language Understanding

Xiaodong Liu, Pengcheng He, Weizhu Chen, Jianfeng GaoarXiv 2019

Abstract

Ensemble learning is a proven technique for achieving state-of-the-art performance in Natural Language Understanding (NLU), but the computational cost of deploying large-scale ensembles like BERT is often prohibitive for real-time applications. This paper introduces a method to distill the knowledge of a massive ensemble into a single, efficient Multi-Task Deep Neural Network (MT-DNN). By combining Multi-Task Learning (MTL) with Knowledge Distillation (KD), the resulting model achieves a new state-of-the-art on the GLUE benchmark (83.7%) while maintaining the inference speed and parameter count of a single model.

Introduction: The Deployment Bottleneck

In the field of NLU, training multiple models and averaging their predictions—known as ensemble learning—is a standard approach to boost accuracy and generalization. However, modern architectures like BERT-Large already contain hundreds of millions of parameters. Running an ensemble of such models in a production environment leads to significant latency and infrastructure overhead, making real-time inference impractical.

The core challenge addressed here is how to capture the superior performance of these massive ensembles within a single, lightweight model that is suitable for real-world deployment.

Methodology: MT-DNN with Knowledge Distillation

The authors extend the Multi-Task Deep Neural Network (MT-DNN) architecture. This model utilizes shared lower layers (based on the Transformer encoder) to learn general text representations across multiple tasks, while employing task-specific output layers at the top.

The MT-DNN architecture featuring shared Transformer layers and task-specific output layers.

To further enhance this architecture, the authors implement a three-stage training pipeline:

  1. Teacher Training: For specific tasks, an ensemble of different MT-DNN models is trained to serve as "teachers."
  2. Soft Target Generation: These teacher ensembles generate "soft targets"—probability distributions over labels rather than hard ground-truth labels. These targets capture nuanced information about model uncertainty and inter-class relationships.
  3. Student Distillation: A single MT-DNN (the student) is trained using Multi-Task Learning. For tasks with available teachers, the student's loss function incorporates both the standard hard labels and the soft targets provided by the teachers.

Datasets and Evaluation

The model's performance was evaluated using the GLUE (General Language Understanding Evaluation) benchmark. This suite includes nine diverse NLU tasks, including sentiment analysis (SST-2), textual entailment (RTE, MNLI, WNLI), paraphrase detection (MRPC, QQP), and linguistic acceptability (CoLA).

Key Results

The distilled MT-DNN (MT-DNN_KD) set a new state-of-the-art on the GLUE leaderboard at the time of publication.

Comparison of MT-DNN_KD against baseline models and previous state-of-the-art ensembles on the GLUE benchmark.

Key performance highlights include:

  • Overall Score: Achieved 83.7%, surpassing the previous SOTA (Snorkel MeTaL) and significantly outperforming BERT-Large (80.5%).
  • Low-Resource Gains: The most significant improvements occurred in data-scarce tasks. For instance, accuracy on the RTE task rose from 75.5% to 85.1%, and CoLA scores improved from 61.5% to 65.4%.
  • Efficiency: Despite the performance gains, the final model has the same parameter count and inference speed as a standard BERT-Large or vanilla MT-DNN, making it production-ready.

Insights and Discussion

  • Cross-Task Distillation: A notable finding was that distillation improved performance even on tasks where no teacher was used. Because the student model shares lower layers across all tasks, the high-quality gradients from distilled tasks refined the shared representations, benefiting the entire model.
  • Regularization via Soft Targets: Soft targets act as a robust regularizer. By providing a richer training signal than binary labels, they prevent the model from overfitting, particularly on smaller datasets.
  • Model Capacity: The results suggest that single models often have sufficient parameter capacity; the bottleneck is typically the quality of the training signal rather than the model size itself.

Conclusion and Future Directions

This work demonstrates that Knowledge Distillation can effectively bridge the gap between ensemble performance and single-model efficiency. Future research may explore more complex loss-weighting strategies, the use of unlabeled data through semi-supervised distillation, and self-distillation techniques to further push the boundaries of NLU performance.

Summary updated

BibTeX
@misc{liu2019improving,
  author = {Xiaodong Liu and Pengcheng He and Weizhu Chen and Jianfeng Gao},
  title = {{Improving Multi-Task Deep Neural Networks via Knowledge Distillation for Natural Language Understanding}},
  year = {2019},
  eprint = {1904.09482},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1904.09482},
}
Figure