Simplified TinyBERT: Knowledge Distillation for Document Retrieval

Xuanang Chen, Ben He, Kai Hui, Le Sun, Yingfei Sun

TL;DR

This paper introduces Simplified TinyBERT, a streamlined approach to knowledge distillation specifically optimized for document retrieval. By simplifying the complex training process of the original TinyBERT and incorporating ground-truth "hard" labels, the authors produced a model that is 15x faster than BERT-Base while actually outperforming it in ranking accuracy on major benchmarks.

What Problem Does This Paper Address?

While BERT has revolutionized document ranking, its massive computational footprint makes it a "heavyweight" champion—effective but slow. In information retrieval (IR), we often need to re-rank thousands of candidate documents for a single query. Using a full BERT model for this is often too slow or expensive for real-world production environments.

Knowledge Distillation (KD) is a common solution where a large "teacher" model trains a smaller "student" model. However, most KD research focuses on general NLP tasks (like sentiment analysis). This paper addresses the gap in applying these techniques to the specific nuances of document retrieval, where distinguishing between "relevant" and "nearly relevant" documents is critical.

Methods

The authors take the existing TinyBERT framework and introduce two key modifications to make it more effective for ranking:

  1. One-Step Task-Specific Distillation: The original TinyBERT uses a complex, multi-step process for task-specific distillation (distilling intermediate layers first, then the prediction layer). The authors found that merging these into a single step—optimizing all losses simultaneously—not only cuts training time by roughly 50% but also improves ranking performance.
  2. Hard Label Integration: Standard distillation often relies on "soft labels" (the teacher's probability outputs). The authors argue that in retrieval, the actual ground-truth annotations ("hard labels") are vital for distinguishing relevance. They added a standard cross-entropy loss based on these hard labels to the distillation objective.

The resulting "Simplified TinyBERT" comes in two sizes: a medium version (6 layers) and a tiny version (3 layers).

Datasets

The models were evaluated on two gold-standard benchmarks for document retrieval:

  • MS MARCO Document Ranking: A massive dataset containing over 360,000 training queries.
  • TREC 2019 Deep Learning Track: A dataset with 43 test queries that feature more exhaustive, manual relevance judgments from NIST assessors.

For the "general distillation" phase (pre-training), they used a 3.5GB subset of English Wikipedia.

Key Insights and Ideas

  • Simplicity is Efficiency: The "aha moment" here is that the original TinyBERT’s staggered distillation process might be overkill for IR. By training all layers together, the student model learns to represent the teacher's internal logic and the final ranking goal holistically.
  • The Power of Hard Labels: While soft labels provide a "richer" signal of how the teacher thinks, hard labels provide the "ground truth" that prevents the student from inheriting the teacher's mistakes or uncertainties.
  • Initialization Matters: The authors discovered that if a pre-trained student model is available, you can potentially skip the general distillation stage entirely by simply taking the first k layers of a larger model to initialize the student, further saving time.

Key Results

The results are a rare "win-win" in machine learning:

  • Speed: The 3-layer version (L3_H384) provides a 15x speedup in FLOPs compared to BERT-Base.
  • Accuracy: On the MS MARCO Dev set, the 3-layer Simplified TinyBERT achieved an MRR of 0.3683, significantly higher than the teacher BERT-Base's 0.3589.
  • Robustness: The model maintained its performance advantage across different re-ranking depths (top-10 vs. top-100 documents), proving it is stable for various IR pipeline configurations.

Limitations and Future Work

  • Teacher Constraints: The study primarily used BERT-Base as the teacher. The authors note that investigating even larger teachers (like BERT-Large or RoBERTa) could yield different results.
  • Architecture Scope: The simplifications were tested on the TinyBERT architecture. It remains to be seen if these "one-step" and "hard label" improvements generalize as effectively to other distillation methods like DistilBERT or MiniLM.
  • Future Directions: The authors expressed interest in applying these simplified distillation techniques to more advanced generative ranking models, such as T5.

Summary updated

BibTeX
@inproceedings{chen2021simplified,
  author = {Xuanang Chen and Ben He and Kai Hui and Le Sun and Yingfei Sun},
  title = {{Simplified TinyBERT: Knowledge Distillation for Document Retrieval}},
  booktitle = {ECIR},
  year = {2021},
  doi = {10.1007/978-3-030-72240-1\_21},
}
Figure