Meta-KD: A Meta Knowledge Distillation Framework for Language Model Compression across Domains

Haojie Pan, Chengyu Wang, Minghui Qiu, Yichang Zhang, Yaliang Li, Jun Huang

Introduction: The Challenge of Model Compression

Pre-trained Language Models (PLMs) like BERT have set new benchmarks in NLP, but their massive parameter counts—often in the hundreds of millions—pose significant deployment challenges for real-time applications and mobile devices. Knowledge Distillation (KD) is the standard technique for compressing these "heavy" teacher models into smaller, more efficient "student" models.

However, traditional KD often operates within isolated domains. A teacher trained on legal documents teaches a student about legal documents, ignoring the potential for cross-domain knowledge transfer. This leads to two primary issues:

  1. Domain Isolation: Useful linguistic features shared across domains are overlooked.
  2. Data Scarcity: In niche domains with limited data, a single-domain teacher lacks sufficient information to guide a student effectively.

Methods: The Meta-KD Framework

The authors introduce Meta-Knowledge Distillation (Meta-KD), a framework designed to capture and transfer cross-domain knowledge. The process unfolds in two stages:

1. Meta-teacher Learning

The Meta-teacher is trained on data from multiple domains simultaneously. To ensure it learns generalizable features rather than domain-specific noise, two mechanisms are employed:

  • Instance-level Transfer (Prototype Scores): The model identifies "prototypes" (centroid representations) for classes across all domains. It prioritizes examples that align closely with these prototypes, emphasizing core concepts.
  • Feature-level Transfer (Domain-Adversarial Loss): A sub-network attempts to identify the source domain of an input. The main model is trained to "fool" this discriminator, forcing it to learn domain-agnostic internal representations.
The Meta-KD architecture showing the interaction between the meta-teacher and domain-specific student models.

2. Meta-distillation

During student training, the framework applies a Domain-expertise weight. This weight determines how much the student should trust the teacher for a specific instance, based on the teacher's confidence and the instance's proximity to cross-domain prototypes.

Datasets and Evaluation

Meta-KD was evaluated on two multi-domain benchmarks:

  • MNLI (Multi-Genre Natural Language Inference): Covering five domains (Fiction, Government, Slate, Telephone, and Travel).
  • Amazon Reviews: Covering four product categories (Books, DVD, Electronics, and Kitchen).

Key Insights: The "All-Purpose Teacher"

The core philosophy of Meta-KD is that a student learns better from a versatile educator. Just as a physics student benefits from a teacher who understands both the specific physics equations and the broader mathematical principles, an NLP student model benefits from a teacher with a broad, cross-domain perspective.

Comparison of learning strategies: (a) in-domain, (b) multi-domain, and (c) the Meta-KD all-purpose teacher approach.

By weighting the distillation process, the student selectively inherits knowledge, avoiding the biases or errors inherent in any single domain.

Key Results

  • Superior Performance: Meta-KD consistently outperformed standard distillation methods like TinyBERT. On MNLI, it achieved an average accuracy of 80.4%, compared to the 79.3% baseline.
  • Efficient Compression: On Amazon Reviews, a BERT-Base model (110M parameters) was compressed into a 4-layer student (14.5M parameters)—a 7.5x reduction—with only a 0.5% drop in accuracy.
  • Robustness in Low-Data Regimes: With only 1% of training data, Meta-KD improved student accuracy by nearly 10% over standard KD, demonstrating its effectiveness as a "knowledge anchor" for new domains.

Limitations and Future Work

The current study focuses on BERT-style architectures and classification tasks. Future research will explore:

  • Task Expansion: Applying meta-distillation to sequence labeling and text generation.
  • Algorithmic Integration: Incorporating other meta-learning algorithms like MAML.
  • Zero-Shot Generalization: Testing the framework's ability to generalize to entirely unseen domains.

Summary updated

BibTeX
@inproceedings{pan2021meta,
  author = {Haojie Pan and Chengyu Wang and Minghui Qiu and Yichang Zhang and Yaliang Li and Jun Huang},
  title = {{Meta-KD: A Meta Knowledge Distillation Framework for Language Model Compression across Domains}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.236},
}
Figure