TL;DR
Feature Correlation Distillation (FCD) is a new, lightweight approach to compressing large language models by teaching a "student" model to mimic the internal relationships found in a "teacher" model. By focusing on the correlation between features—at both the token and sample levels—rather than trying to match exact numerical values, FCD produces smaller models that outperform existing distillation methods like TinyBERT and MiniLM while using significantly less computational power during training.
What Problem Does This Paper Address?
Large Pre-trained Language Models (PLMs) like BERT and GPT are incredibly capable but notoriously resource-heavy, making them difficult to deploy on mobile devices or in real-time applications. Knowledge Distillation (KD) is the standard solution: a large "teacher" model trains a smaller "student" model.
However, existing KD methods have two major drawbacks:
- The "Exact Match" Trap: Most methods use Mean Squared Error (MSE) or KL-divergence to force the student’s features to match the teacher’s exactly. This is often too restrictive because the student has fewer parameters and a different architecture; it cannot realistically replicate the teacher's high-dimensional space perfectly.
- Complexity and Rigidity: Some methods distill the "attention maps," but these are computationally expensive to calculate and often require the student to have the same number of attention heads as the teacher, limiting architectural flexibility.
Methods
The authors introduce FCD, which shifts the focus from values to relationships.
Their approach consists of three main components:
- Token-level Relations: For a single sentence, the model calculates how each token relates to every other token. This captures long-term dependencies and linguistic structure.
- Sample-level Relations: This is a novel addition. FCD looks across a batch of different sentences to see how they relate to one another semantically. This helps the student understand the broader "semantic space" of the data.
- Pearson Linear Correlation (PLC) Loss: Instead of MSE, the authors use the Pearson correlation coefficient as a loss function. This is the "secret sauce"—it allows the student to be "correct" as long as its features are linearly correlated with the teacher's, even if the absolute numbers are different. This provides the student with more "breathing room" to learn efficiently.
Crucially, FCD works directly on the output features of Transformer blocks, meaning it doesn't care how many attention heads the student has, making it highly flexible.
Datasets
The researchers evaluated FCD across a wide range of standard Natural Language Processing (NLP) benchmarks:
- GLUE (General Language Understanding Evaluation): Includes 8 tasks such as sentiment analysis (SST-2), natural language inference (MNLI, QNLI, RTE), and linguistic acceptability (CoLA).
- SQuAD (Stanford Question Answering Dataset) v1.1 and v2.0: Used to test the model's ability to extract answers from text.
- Teacher Models: BERT-base/large, RoBERTa-base/large, and GPT-2.
Key Insights and Ideas
- Relationships > Values: The core "aha moment" is that the structure of the knowledge (how concepts relate) is more important for a student to learn than the specific numerical outputs of a teacher's hidden layers.
- The Power of the Batch: By including sample-level relations, the authors recognize that a model learns not just from individual sentences, but from how those sentences differ from or resemble others. This "inter-sample" knowledge is a powerful signal that previous distillation methods largely ignored.
- Mathematical Equivalence: The authors provide a theoretical proof showing that under certain conditions (high temperature and normalized features), minimizing KL-divergence or MSE is actually a special, more restrictive case of maximizing Pearson correlation. By using PLC, they are essentially using a more generalized and flexible version of traditional losses.
- Efficiency Gains: FCD is remarkably efficient. For a standard BERT-base model, FCD requires only 0.6 GFLOPs for relation mapping, compared to 3.2 GFLOPs for MiniLM and a staggering 14.5 GFLOPs for MiniLMv2.
Key Results
FCD consistently outperformed state-of-the-art distillation methods across various architectures.
- Ablation Success: As shown in the ablation studies, removing either token-level ($L_t$) or sample-level ($L_s$) relations degrades performance, proving that both dimensions are critical for optimal distillation.
- BERT Compression: A 6-layer student distilled via FCD achieved an average score of 79.6 on GLUE, surpassing MiniLMv2 (79.2) and TinyBERT (78.6), while being 2x faster than the original BERT-base.
- RoBERTa & GPT: The method showed similar gains for RoBERTa (81.9 AVG on GLUE) and GPT-2 (77.1 AVG), proving it isn't just a "BERT-only" trick.
- SQuAD Performance: On SQuAD v2.0, the FCD student achieved an F1 score of 78.4, nearly matching the teacher (78.8) and significantly beating DistilBERT (69.5).
Limitations and Future Work
- Architecture Specificity: While FCD works great for Transformers, the authors note it might be less effective for Recurrent Neural Networks (RNNs), where feature relationships are less explicit.
- Environmental Cost: The authors acknowledge that the initial training/distillation process requires significant compute (and thus has a carbon footprint), though they argue this is offset by the long-term energy savings of running the smaller, more efficient student models in production.
- Future Directions: The paper suggests exploring FCD in "task-agnostic" settings (distilling during the pre-training phase) rather than just fine-tuning on specific tasks.
Summary updated