Introduction
Large-scale pre-trained language models (PLMs) like BERT and RoBERTa have revolutionized natural language processing but remain computationally prohibitive for deployment on edge devices. Knowledge Distillation (KD) has emerged as the standard technique to mitigate this, where a compact "student" model is trained to mimic a larger "teacher." However, traditional KD is constrained by the student's parametric memory—its fixed number of weights. Once training concludes, the teacher's nuanced knowledge is typically lost to the student.
ReAugKD (Retrieval-Augmented Knowledge Distillation) overcomes this bottleneck by providing the student with a "cheat sheet": a non-parametric external memory of the teacher's knowledge. By allowing the student to query this memory during inference, ReAugKD effectively expands model capacity without a significant increase in parameter count or latency.
Methodology
The ReAugKD framework operates in two distinct phases: training for alignment and inference for augmentation.
1. Training Phase: Aligning Embedding Spaces
For retrieval to be effective, the student's query must reside in the same semantic space as the teacher's stored knowledge.
- Projection Head: A linear projection head is added to the teacher to map its high-dimensional embeddings into the student's lower-dimensional space. This is fine-tuned using a supervised contrastive loss.
- Relational KD Loss: The authors introduce a novel loss function that minimizes the divergence between teacher-teacher and teacher-student embedding distributions. This ensures that if the teacher perceives two inputs as similar, the student learns to represent them similarly, making the student's embeddings "retrieval-ready."
2. Inference Phase: Retrieval-Augmented Prediction
During inference, the model utilizes a Knowledge Base (KB) containing projected teacher embeddings and soft labels from the training set.
- Retrieval: For a new input, the student generates an embedding and uses the HNSW (Hierarchical Navigable Small World) algorithm to find the $K$ most similar entries in the KB.
- Aggregation: The final output is a convex combination of the student's own prediction and a weighted average of the retrieved teacher labels. A hyperparameter $\beta$ manages the balance between internal logic and external knowledge.
Experimental Results
The authors evaluated ReAugKD on the GLUE (General Language Understanding Evaluation) benchmark, using BERT-Base as the teacher and a 6-layer BERT as the student.
Performance and Efficiency
ReAugKD achieved state-of-the-art (SOTA) results on 5 out of 6 GLUE tasks, outperforming competitive baselines such as MetaDistil and TinyBERT. The method showed an average improvement of 0.34% over the previous best method. Crucially, the retrieval component itself contributed a 0.37% gain over a baseline that used the new loss function but lacked the external memory.
Despite the added retrieval step, the system remains highly efficient. By utilizing approximate kNN on the CPU, the authors kept the latency overhead below 3%, making it viable for real-time applications where speed is critical.
Key Insights and Conclusion
The primary innovation of ReAugKD is the shift from purely parametric learning to a hybrid approach. The "aha" moment lies in the realization that a small model does not necessarily need more parameters to be smarter; it needs better access to external information. Furthermore, the authors discovered that training for retrieval improves the student's internal representations even when the retrieval step is omitted, suggesting that the relational loss forces the student to learn higher-quality, teacher-aligned features.
While the method currently requires access to teacher internals (precluding "black-box" distillation) and carries a memory footprint for the Knowledge Base, it represents a significant step forward in efficient model compression. Future work may involve dataset distillation to compress the Knowledge Base itself, further optimizing the memory-performance trade-off.
Summary updated