Abstract
Knowledge Distillation (KD) typically focuses on forcing a student model to mimic the individual outputs of a teacher model. This paper introduces Relational Knowledge Distillation (RKD), a paradigm shift that transfers the structural relationships between data points rather than their absolute positions. By matching distances and angles in the latent space, RKD enables student models to capture the underlying organization of a dataset, often surpassing the performance of their larger teachers in metric learning tasks.
Introduction
Deep neural networks have achieved remarkable success but often require significant computational resources, hindering deployment on edge devices. Knowledge Distillation (KD) addresses this by training a compact "student" model to replicate the behavior of a high-capacity "teacher." Traditional KD methods are primarily "point-wise," meaning they aim to minimize the difference between the teacher's and student's outputs for a single input.
However, in many applications—particularly metric learning—the absolute coordinates of an embedding are less critical than its relationship to other embeddings. Relational Knowledge Distillation (RKD) posits that the "knowledge" of a teacher resides in how it structures the entire embedding space. By focusing on these mutual relations, RKD provides a more robust and flexible training signal.
Methodology
The core of RKD is the transfer of structural information through two primary mechanisms: distance-wise and angle-wise distillation.
Distance-wise Distillation (RKD-D)
RKD-D encourages the student to match the Euclidean distances between pairs of data points in the teacher's representation. To handle potential differences in embedding scales between models, the distances are normalized by the average distance within a mini-batch. This ensures that the student learns the relative spacing of the data rather than absolute magnitudes.
Angle-wise Distillation (RKD-A)
To capture higher-order geometric structures, RKD-A focuses on the angles formed by triplets of data points. Angles are inherently invariant to scale and rotation, making them a highly effective signal for transferring complex manifold structures. While traditional KD is first-order (points) and RKD-D is second-order (pairs), RKD-A represents a third-order relational transfer.
Both methods utilize a Huber loss function, which provides robustness against outliers during the distillation process. RKD can be used alone or as a "booster" alongside traditional point-wise KD methods.
Experimental Evaluation
The authors evaluated RKD across several domains, including metric learning (CUB-200-2011, Cars 196, SOP), image classification (CIFAR-100, Tiny ImageNet), and few-shot learning (Omniglot, miniImageNet).
A key finding was the ability of RKD to handle differing embedding dimensions. For instance, a teacher with a 512-dimensional space can effectively guide a student with only 128 dimensions, as the relational structure is preserved across these projections.
Key Results and Discussion
The most striking result of RKD is its ability to "break the teacher ceiling." In metric learning tasks, the student model frequently outperformed its teacher. On the Cars 196 dataset, a ResNet18 student trained with RKD achieved a Recall@1 of 82.50%, significantly exceeding the 77.17% achieved by its ResNet50 teacher.
Qualitative analysis via image retrieval confirms this improvement. As shown in the retrieval examples, the student model often identifies specific semantic categories (e.g., puffins or red convertibles) more accurately than the teacher model, which may retrieve more generic examples from the same broad class.
In classification tasks, RKD also showed consistent gains. Adding RKD to standard KD on CIFAR-100 improved accuracy from 74.26% to 74.66%, indicating that relational information is complementary to point-wise knowledge.
Limitations
While RKD offers significant performance benefits, it comes with trade-offs. Calculating relations for all pairs or triplets in a batch increases computational complexity ($O(N^2)$ or $O(N^3)$), though this remains manageable for standard mini-batch sizes. Additionally, RKD can lead to high specialization in the training domain, which may reduce generalization to significantly different datasets compared to models trained with standard triplet losses.
Conclusion
Relational Knowledge Distillation shifts the focus of model compression from individual data points to the global structure of the representation space. Inspired by Saussure’s linguistic structuralism—the idea that a sign has no absolute meaning except in relation to others—RKD demonstrates that the value of a representation lies in its structural context. By enabling students to surpass teacher performance and providing robustness across dimensions, RKD represents a significant advancement in efficient model training.
Summary updated