Abstract
Knowledge distillation has emerged as a highly effective method for bridging the representation discrepancy between large-scale models and lightweight models. Prevalent approaches involve leveraging appropriate metrics to minimize the divergence or distance between the knowledge extracted from the teacher model and the knowledge learned by the student model. Centered Kernel Alignment (CKA) is widely used to measure representation similarity and has been applied in several knowledge distillation methods. However, these methods are complex and fail to uncover the essence of CKA, thus not answering the question of how to use CKA to achieve simple and effective distillation properly. This paper first provides a theoretical perspective to illustrate the effectiveness of CKA, which decouples CKA to the upper bound of Maximum Mean Discrepancy (MMD) and a constant term. Drawing from this, we propose a novel Relation-Centered Kernel Alignment (RCKA) framework, which practically establishes a connection between CKA and MMD. Furthermore, we dynamically customize the application of CKA based on the characteristics of each task, with less computational source yet comparable performance than the previous methods. The extensive experiments on the CIFAR-100, ImageNet-1k, and MS-COCO demonstrate that our method achieves state-of-the-art performance on almost all teacher-student pairs for image classification and object detection, validating the effectiveness of our approaches. Our code is available at https://github.com/Klayand/PCKA.
Introduction
Knowledge Distillation (KD) aims to transfer knowledge from a complex teacher network to a compact student network. A central challenge lies in defining a metric that accurately captures the similarity between their internal representations. While Centered Kernel Alignment (CKA) has gained popularity for its ability to measure representational similarity, its application in KD has often been heuristic and computationally intensive. Moreover, standard CKA implementations struggle with instance-level tasks such as object detection, where small batch sizes limit the metric's ability to capture meaningful relational knowledge.
Methodology
The proposed approach rethinks CKA by providing a theoretical foundation and task-specific frameworks: RCKA for classification and PCKA for detection.
Theoretical Foundation
The authors prove that maximizing CKA similarity is mathematically equivalent to minimizing the upper bound of the Maximum Mean Discrepancy (MMD) distance. This theoretical link suggests that CKA acts as a robust weight regularizer, facilitating more stable convergence compared to direct MMD minimization.
Relation-Centered Kernel Alignment (RCKA)
For image classification, the RCKA framework applies CKA to both intermediate features and output logits. As shown in Figure 1, it captures high-order relationships by considering both inter-class and intra-class similarities, ensuring the student mimics the teacher's relational structure across the entire network.
Patch-based CKA (PCKA)
To address the limitations of CKA in object detection—where mini-batches are typically very small—the authors introduce PCKA. Instead of computing similarity across the batch, PCKA divides feature maps into patches. By treating these patches as individual samples, the framework artificially increases the sample size for the Gram matrix computation. As illustrated in Figure 2, these similarities are computed per channel and averaged, allowing the model to learn fine-grained spatial knowledge effectively.
Experimental Results
The frameworks were evaluated across multiple benchmarks:
- Image Classification (CIFAR-100 & ImageNet-1k): RCKA consistently outperformed existing feature-based and logit-based methods. On CIFAR-100, for the WRN-40-2 to WRN-16-2 pair, RCKA achieved a top-1 accuracy of 76.51%, surpassing previous state-of-the-art methods like DKD and ReviewKD.
- Object Detection (MS-COCO): PCKA demonstrated significant gains across various detector types. For instance, using a RetinaNet-X101 teacher, a RetinaNet-R50 student improved its mAP from 37.4 to 40.7.
Discussion and Conclusion
A key insight of this work is that CKA's effectiveness stems from its role as an MMD upper bound, providing stronger optimization constraints. The patch-based approach in PCKA successfully overcomes the "small batch" bottleneck in detection tasks. Notably, these improvements are achieved with simpler architectures and lower computational costs than previous state-of-the-art methods. While cross-architecture distillation remains a challenge for patch-wise mimicry, this work provides a solid theoretical and practical foundation for using CKA in diverse knowledge distillation scenarios.
Summary updated