Abstract
Knowledge Distillation (KD) is a cornerstone technique for model compression, yet traditional methods often fail to capture the complex structural dependencies within visual data. Standard Relation Knowledge Distillation (RKD) typically operates on inter-sample relations, and its direct application to intra-image tokens in Vision Transformers (ViTs) often leads to performance degradation due to noise and high dimensionality. We introduce Semantics-based Relation Knowledge Distillation (SeRKD), which shifts the focus to the geometric relationships between semantically meaningful regions. By employing an iterative clustering mechanism to construct "superpixel tokens," SeRKD filters out noise and distills the spatial logic of an image. Our approach consistently improves the performance of lightweight ViTs and CNNs, achieving state-of-the-art results on ImageNet-1k and various transfer learning tasks.
What Problem Does This Paper Address?
Knowledge Distillation (KD) aims to transfer knowledge from a large "teacher" model to a smaller "student" model. While matching logits or intermediate feature maps is common, these approaches often treat images as collections of independent elements, ignoring the intricate semantic relationships that define an object's structure.
Existing Relation Knowledge Distillation (RKD) methods primarily focus on how different images in a batch relate to one another. However, when researchers attempted to apply RKD to the internal tokens of Vision Transformers (ViTs), they observed a drop in performance. The raw tokens were found to be too numerous and noisy for the student to learn meaningful structural patterns. The core challenge lies in capturing the "geometric" logic of an image—such as the spatial relationship between a bird’s wing and its beak—in a representation that is both semantically rich and computationally manageable for the student model.
Methods
The authors introduce SeRKD, a framework that bridges the gap between raw features and high-level semantics through a structured three-step process.
- Superpixel Token Construction: Instead of processing hundreds of individual image patches, SeRKD uses an iterative clustering mechanism to group patches into "superpixel tokens." These tokens represent semantically coherent regions, such as an animal's ear or a car's wheel, effectively acting as a denoising step.
- Relation Distillation on Tokens: Once the image is decomposed into these semantic parts, the student model is tasked with mimicking the teacher’s geometric relationships. This involves distance-wise loss ($L_{RD}$) to preserve Euclidean distances between token pairs and angle-wise loss ($L_{RA}$) to maintain the angular layout of token triplets.
- Cross-Architecture Compatibility: While natively suited for ViTs, the authors developed a tokenization strategy using strided convolutions or pooling to allow CNNs to benefit from the same semantic-relation logic, ensuring the method's versatility across different model families.
Key Insights and Ideas
- Semantics as a Denoiser: The most significant finding is that applying RKD to raw tokens is counterproductive. Grouping data into superpixels allows the model to ignore pixel-level noise and focus on structural relationships that are critical for high-level classification.
- Optimal Granularity: The researchers identified a "Goldilocks" zone for superpixel grid sizes. A $2 \times 2$ initial grid provided the best balance; smaller grids lacked context, while larger ones blurred semantic boundaries, losing fine-grained details.
- Geometric Consistency: By incorporating angle-wise loss, the model learns higher-order geometric structures. This forces the student to understand not just individual features, but the relative "pose" and "layout" of objects within a scene.
- Computational Efficiency: Reducing the token count to a set of superpixels (e.g., 49 tokens) makes the $O(L^3)$ complexity of angle-wise distillation manageable, avoiding the memory bottlenecks associated with dense relation methods.
Key Results
SeRKD consistently outperformed state-of-the-art distillation methods across multiple benchmarks:
- ImageNet-1k: SeRKD-Small achieved 82.5% top-1 accuracy, significantly outperforming the baseline DeiT-S (81.2%) and surpassing other advanced methods like CSKD (82.3%).
- CNN Performance: In a ResNet-101 to ResNet-18 distillation setup, SeRKD reached 72.25% accuracy, a notable improvement over standard KD (71.09%).
- Transfer Learning: The framework showed strong generalization on specialized datasets. On Stanford Cars, SeRKD-S reached 94.1% accuracy, compared to the student's baseline of 91.7%.
Limitations and Future Work
Despite its success, SeRKD introduces some computational overhead. Calculating triplets for angle-wise loss remains intensive ($O(BL^3)$), requiring careful selection of hardware settings and grid sizes. Additionally, the final loss function involves multiple balancing weights ($\lambda$), which may require tuning for different architectures. Future research could extend this semantic approach to temporal relations in video or multi-modal tasks, exploring the interplay between visual semantics and textual descriptions.
Summary updated