Model Compression with Multi-Task Knowledge Distillation for Web-scale Question Answering System

Ze Yang, Linjun Shou, Ming Gong, Wutao Lin, Daxin JiangarXiv 2019

Introduction

Deep learning models like BERT have significantly advanced Question Answering (QA) capabilities, yet their massive parameter counts make them prohibitively slow for real-world commercial applications. For instance, BERT-Base processes only about 52 samples per second, whereas a commercial search engine may need to handle 100 billion Q&A pairs or meet strict 10ms latency requirements. Standard compression techniques like pruning or simple distillation often lead to significant information loss or inherit the biases of a single teacher model.

To bridge this gap, this paper introduces MKDM (Multi-task Knowledge Distillation Model), a framework designed to compress BERT into lightweight versions suitable for web-scale production. By distilling knowledge from an ensemble of "teacher" models into a single student, the authors achieve a 4x inference speedup while maintaining, and sometimes exceeding, the performance of the original teachers.

Methodology

The core of the MKDM approach is the use of a "Teacher Zoo"—multiple BERT models trained with varying hyperparameters to provide a diverse set of soft labels. The student model is a 3-layer Transformer, compressed from BERT’s 12 layers to ensure high-speed inference.

The training process utilizes Two-Stage Distillation (TS-MKDM):

  1. Stage 1 (Pre-training): The student distills knowledge from the teacher ensemble using a massive unlabeled dataset of 100 million pairs.
  2. Stage 2 (Fine-tuning): The student is fine-tuned on a smaller labeled dataset, learning from both the teachers' soft labels and the human-annotated ground truth.
The two-stage distillation process (TS-MKDM) involving pre-training on unlabeled data and fine-tuning on labeled data.

At inference time, the final output is a weighted aggregation of the student’s internal heads, helping to generalize the knowledge gained from different teachers and "cancel out" individual teacher overfitting.

Experimental Setup and Datasets

The researchers evaluated the framework using three primary datasets:

  • DeepQA: 1 million labeled Q&A pairs across various domains.
  • CommQA-Unlabeled: 100 million Q&A pairs harvested from a commercial search engine.
  • CommQA-Labeled: A large, diverse human-labeled dataset used to test the limits of the TS-MKDM approach.

Key Results and Insights

The 3-Layer Sweet Spot

A crucial finding of the study was the performance-to-computation ratio of different student architectures. While increasing the number of Transformer layers improves accuracy, the gains diminish quickly as inference speed drops significantly. The authors identified a 3-layer configuration as the optimal balance for web-scale needs.

Ablation study showing the trade-off between layer count, inference speed (QPS), and performance metrics (ACC/AUC).

Performance Gains

  • Speed: The student model achieved 217 Queries Per Second (QPS), representing a 4x speedup over BERT-Base (52 QPS) and a 13x speedup over BERT-Large (16 QPS).
  • Accuracy: On the DeepQA dataset, MKDM achieved an AUC of 85.14, outperforming a standard single-teacher student (84.12).
  • Surpassing the Teacher: Most notably, the TS-MKDM model achieved an accuracy of 79.22% on the CommQA-Labeled set, actually outperforming the original BERT teacher (77.00%). This suggests that multi-teacher distillation acts as a powerful regularizer.

Conclusion

MKDM demonstrates that multi-task distillation combined with a two-stage training process on massive unlabeled data can produce lightweight models that are both fast enough for production and accurate enough to rival their larger counterparts. Future work may explore distilling BERT's knowledge into even simpler architectures like LSTMs or extending the framework to more complex tasks like Machine Reading Comprehension.

Summary updated

BibTeX
@misc{yang2019model,
  author = {Ze Yang and Linjun Shou and Ming Gong and Wutao Lin and Daxin Jiang},
  title = {{Model Compression with Multi-Task Knowledge Distillation for Web-scale Question Answering System}},
  year = {2019},
  eprint = {1904.09636},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1904.09636},
}
Figure