Learning to Augment for Data-Scarce Domain BERT Knowledge Distillation

Lingyun Feng, Minghui Qiu, Yaliang Li, Hai-Tao Zheng, Ying Shen

Large-scale pre-trained language models like BERT have revolutionized NLP, but their massive size (110M+ parameters) makes them difficult to deploy on mobile devices or in real-time environments. While Knowledge Distillation (KD)—where a small "student" model learns to mimic a large "teacher"—is a popular solution, it often fails when training data is scarce. If the teacher only has a handful of examples to show the student, the student cannot capture the subtle nuances of the task.

The Learning to Augment (L2A) Framework

To address this, we propose Learning to Augment (L2A), a framework that automates data augmentation for BERT distillation in low-resource domains. By using a reinforcement learning-based "selector" to pick the best samples from a generator that leverages resource-rich source domains, L2A produces compact student models that are highly effective even in data-starved environments.

The L2A framework architecture, illustrating the interaction between the generator, reinforced selector, and the teacher-student distillation process.

The L2A framework consists of four interactive components:

  1. Teacher & Student Modules: A standard BERT-base (teacher) and a 4-layer tiny BERT (student).
  2. Data Generator: Instead of simple word-swapping, the generator uses a "constrained search space." It uses BERT itself to predict contextually relevant word replacements (mask-and-predict) while ensuring samples stay semantically close to the original data.
  3. Reinforced Selector: This is the core innovation. It is a reinforcement learning (RL) policy network that observes the student's performance. If an augmented sample helps the student improve its validation score, the selector receives a positive reward, learning to filter out "noisy" or unhelpful data over time.
  4. Distillation Objectives: The student doesn't just learn from labels; it mimics the teacher’s attention matrices, hidden states, and prediction logits.

Experimental Results

We evaluated L2A across four distinct tasks, pairing a "resource-rich" source domain with a "data-scarce" target domain (e.g., General NLI $\rightarrow$ Science domain). To simulate scarcity, target datasets were subsampled to as few as 40 instances per class.

As shown in the results below, L2A consistently outperformed state-of-the-art distillation methods like TinyBERT, DistilBERT, and BERT-PKD. The L2A student is 7.5x smaller (only ~13.3% of the parameters) and significantly faster than BERT-base, yet it achieved a ~6% average improvement over a standard fine-tuned student.

Performance comparison of L2A against various baseline models across NLI, PI, Text Classification, and Regression tasks.

Key Insights

  • The "Student Surpassing Teacher" Phenomenon: In data-scarce settings, the compressed student actually outperformed the original teacher. The student likely acts as a regularizer, stripping away the redundancy and noisy knowledge the teacher acquired during its massive pre-training that isn't relevant to the specific niche task.
  • Cross-Domain Synergy: The model successfully "borrows" the structure of a related source domain to bolster the target domain. For example, using general electronic reviews to help the model understand reviews about watches.
  • Stability via Constraints: RL in text generation is notoriously unstable. By restricting the generator to a "stationary distribution" near the real data, the framework keeps the search space manageable and training stable.

Conclusion

L2A demonstrates that automated, reinforced data selection is just as critical as data generation itself. By intelligently augmenting data, we can bridge the gap between giant teachers and tiny students, enabling high-performance NLP in specialized, low-resource domains.

Summary updated

BibTeX
@inproceedings{feng2021learning,
  author = {Lingyun Feng and Minghui Qiu and Yaliang Li and Hai-Tao Zheng and Ying Shen},
  title = {{Learning to Augment for Data-Scarce Domain BERT Knowledge Distillation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i8.16910},
}
Figure