Learning to Augment for Data-scarce Domain BERT Knowledge Distillation

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

Abstract

Knowledge Distillation (KD) is a critical technique for compressing large-scale pre-trained language models like BERT into smaller, deployable versions. However, its effectiveness is often hampered in target domains with limited labeled data, where the "dark knowledge" of the teacher model cannot be effectively transferred. This paper introduces Learning to Augment (L2A), a novel framework that employs reinforcement learning to dynamically generate and select the most informative data samples for a student model. By utilizing a cross-domain approach and a reinforced feedback loop, L2A enables compact student models to match or even surpass the performance of their much larger teachers in data-scarce scenarios.

Introduction

The rise of pre-trained language models (PLMs) has revolutionized NLP, but their massive parameter counts pose significant challenges for real-time applications and mobile deployment. While Knowledge Distillation offers a path toward model compression, it typically relies on a large volume of in-domain data to align the student's outputs with the teacher's soft probabilities. In many real-world applications, the target domain is "data-scarce," making standard KD less effective.

Traditional data augmentation techniques, such as synonym replacement or back-translation, are often static and fail to capture the specific needs of the student model during the learning process. To address this, the authors propose L2A, an automated, dynamic framework that learns to augment data specifically to improve the distillation process.

The L2A Framework

The L2A framework is composed of four primary interacting components: a Teacher model, a Student model, a Data Generator, and a Reinforced Selector.

The L2A framework architecture featuring the Generator, Reinforced Selector, and the feedback loop between Student and Teacher models.

1. The Generator

Unlike rule-based augmentation, L2A uses a BERT-based generator. It takes existing data samples, masks specific tokens, and predicts new ones to create variants. To ensure the generated text remains semantically coherent and relevant to the task, the generator operates within a constrained search space (a stationary distribution). This prevents the model from training on low-quality or nonsensical data.

2. The Reinforced Selector

The selector acts as the "brain" of the augmentation process. Implemented as a reinforcement learning policy network, it evaluates each generated sample and decides whether it should be included in the student's training set.

3. The Feedback Loop

The selector is optimized based on a reward signal derived from the student’s performance on a held-out validation set. If the student's accuracy improves after training on a selected sample, the selector receives a positive reward. This creates a dynamic system where the augmentation strategy evolves in real-time, focusing on the specific weaknesses of the student model.

4. Cross-Domain Leverage

L2A is designed to bridge the gap between a resource-rich "source" domain and a data-scarce "target" domain. The system pulls data from the source domain and manipulates it to help the student generalize better within the target domain.

Experimental Evaluation

The authors evaluated L2A across four distinct NLP tasks, simulating extreme data scarcity by subsampling target datasets to as few as 40 examples per class. The tasks included Natural Language Inference (NLI), Paraphrase Identification (PI), Text Classification, and Regression.

Key Results

The L2A framework consistently outperformed state-of-the-art distillation baselines, including TinyBERT, DistilBERT, and standard augmentation methods like EDA and CBERT.

Performance comparison of L2A against various distillation and augmentation baselines across four NLP tasks.

As shown in the results table, the L2A student (with only 14.5M parameters) achieved an accuracy of 78.27% on the NLI task, significantly outperforming the "Student-FT" baseline (73.80%) and even the 109M-parameter "Teacher-FT" (76.39%). This demonstrates that a well-augmented distillation process can produce a student that is not only smaller but potentially more robust than its teacher in low-data regimes.

Discussion and Insights

A key insight from this work is the advantage of dynamic vs. static augmentation. While methods like EDA apply the same transformations throughout training, L2A adapts. Once a student has mastered a particular linguistic pattern, the Reinforced Selector learns to stop providing redundant samples, focusing instead on more challenging examples.

Furthermore, the authors addressed the inherent instability of reinforcement learning in text generation by restricting the generator's search space. This constraint ensures that the RL policy remains focused on high-quality, task-relevant data, making the training process viable and efficient.

Conclusion and Future Work

L2A provides a powerful solution for deploying high-performance NLP models in environments where labeled data is a luxury. By automating the data augmentation process through reinforcement learning, it bridges the gap between massive pre-trained models and compact, task-specific students.

However, the framework does have limitations. Its performance is partially dependent on the similarity between the source and target domains. Additionally, the training phase is computationally more intensive than standard KD due to the inclusion of the generator and the RL policy. Future research could explore more efficient training strategies and the application of L2A to complex generative tasks like summarization.

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