TL;DR
This paper tackles the overfitting problem in Intermediate Layer Distillation (ILD) for compressing large language models (PLMs). They propose a simple yet effective method called Consistency Regularized ILD (CR-ILD) that leverages distilling only the last Transformer layer and using supplementary tasks, leading to improved generalization and state-of-the-art performance on standard and challenging datasets.
What Problem Does This Paper Address?
Large Language Models (LLMs) like BERT and RoBERTa achieve impressive results but come with significant computational and memory costs, making them impractical for deployment on resource-constrained devices. Knowledge Distillation (KD) is a popular technique to compress these models by transferring knowledge from a large "teacher" model to a smaller "student" model. Intermediate Layer Distillation (ILD), which distills knowledge from the teacher's internal Transformer layers, has become a de facto standard due to its effectiveness. However, this paper identifies a critical issue: existing ILD methods are prone to overfitting the training data, especially on challenging datasets like those with few samples or label noise, leading to performance degradation. This overfitting hinders the practical application of ILD for compressing LLMs.
Methods
The authors propose Consistency Regularized ILD (CR-ILD), built upon two key observations:
- Distill only the last Transformer layer: They found that distilling knowledge from all intermediate layers can lead to overfitting. Focusing on the last layer alone, while still effective, can be further improved.
- Utilize supplementary tasks: Distilling on additional, related tasks can help the student model generalize better and mitigate overfitting on the primary target task.
CR-ILD combines these ideas with a consistency regularization technique inspired by MixUp. Instead of directly applying MixUp to discrete text tokens, they perform it on the word embeddings. This creates interpolated samples and their corresponding interpolated outputs from the teacher model. The CR-ILD loss then encourages the student model's output for these interpolated inputs to match the interpolated outputs of the teacher, effectively regularizing the student and promoting smoother, more generalizable functions.
Datasets
The experiments were conducted on the GLUE benchmark, a standard suite of natural language understanding tasks. They specifically focused on tasks with fewer training samples (RTE, MRPC, STS-B, CoLA) to highlight the overfitting issue. Additionally, they created ill-conditioned GLUE datasets by:
- Down-sampling: Creating few-sample versions of GLUE tasks.
- Injecting label noise: Adding uniform noise to labels. They also used extracted Wiki Corpus for generating synthetic data to study the conditions for effective supplementary tasks.
Key Insights and Ideas
- Overfitting is the Achilles' heel of ILD: The paper provides strong empirical evidence that existing ILD methods suffer from overfitting, especially on challenging datasets, which is the primary cause of performance degradation. This is a crucial finding that challenges the assumption of ILD's universal effectiveness.
- Simplicity is key: Distilling only the last Transformer layer, rather than all intermediate layers, is a simple yet effective strategy to combat overfitting.
- Supplementary tasks are powerful regularizers: Using auxiliary tasks for distillation acts as a form of implicit regularization, preventing the student from memorizing the target task's training data.
- MixUp for text regularization: The paper demonstrates a novel application of MixUp for text data, interpolating word embeddings to create synthetic samples that improve model robustness and generalization.
- CR-ILD leads to flatter minima: The proposed CR-ILD method encourages the student model to converge to flatter minima in the loss landscape, which are known to correlate with better generalization.
Key Results
- CR-ILD consistently outperforms existing ILD methods (TinyBERT, BERT-EMD, PKD) and standard KD on both standard GLUE and ill-conditioned GLUE benchmarks.
- On ill-conditioned datasets (few-samples and label noise), CR-ILD shows significant performance improvements, alleviating the degradation seen with other methods.
- The proposed method achieves state-of-the-art performance on various GLUE tasks, often surpassing even the teacher model in the presence of label noise.
- Ablation studies confirm that each component of CR-ILD (last layer distillation, supplementary tasks, and consistency regularization) contributes to the overall performance gains.
Limitations and Future Work
- Layer mapping relationship: While the paper addresses overfitting caused by layer mapping, it acknowledges that the intricate relationship between layers and hidden states within a model was not fully explored.
- Task scope: The theoretical analysis and extensive experiments were primarily focused on sentence classification. The authors plan to extend their methods to token classification and question-answering tasks.
- Model architectures: The experiments were mainly conducted on BERT-based models. Further investigation on other architectures, including encoder-decoder models (like T5), was performed and showed promising results, but broader exploration could be beneficial.
Summary updated