Knowledge Distillation via Instance Relationship Graph

Yufan Liu, Jiajiong Cao, Bing Li, Chunfeng Yuan, Weiming Hu, Yangxi Li, Yunqiang Duan

Introduction

Knowledge Distillation (KD) has emerged as a cornerstone technique for model compression, enabling a compact "student" network to inherit the performance of a large, complex "teacher" network. Traditional KD methods typically focus on point-wise alignment, where the student attempts to match the teacher's final class probabilities (logits) or intermediate feature maps. However, this approach suffers from two fundamental limitations. First, it treats data instances as independent, ignoring the underlying topology of the feature space—the relative relationships between different samples. Second, forcing a student to replicate exact feature values imposes a "hard constraint" that can be counterproductive when the teacher and student possess significantly different architectures.

To address these issues, this work introduces Knowledge Distillation via Instance Relationship Graph (IRG). By modeling the relationships between data samples as a graph and tracking how these relationships evolve across layers, IRG provides a more flexible and informative "hint" for student training.

The Instance Relationship Graph (IRG)

The core of the proposed method is the IRG, which captures three distinct types of knowledge: instance features, instance relationships, and feature space transformations.

Conceptual overview of the Instance Relationship Graph (a) and the transformation of relationships between layers (b).
  1. Instance Features (Vertices): These represent the standard feature embeddings of individual data samples within a batch.
  2. Instance Relationships (Edges): For a given batch, the IRG calculates the Euclidean distance between the features of every pair of samples. This results in an adjacency matrix that represents the structural organization of the feature space. This relational knowledge is more robust than raw features because while absolute feature values may vary across architectures, the relative distances between samples (e.g., two different "cat" images being closer to each other than to a "dog" image) remain more consistent.
  3. Feature Space Transformation: This component models the "logic" of the teacher's inference by observing how the graph structure changes as data flows from one layer to another. By distilling this transformation, the student learns the process of feature refinement rather than just memorizing static intermediate states.

Training Framework and Loss Functions

The student network is optimized using a Multi-Type Knowledge (MTK) loss function, which integrates several supervisory signals to ensure comprehensive knowledge transfer.

The overall IRG distillation framework, illustrating the flow of supervision from the teacher network to the student network across different blocks and the final logits.

As shown in the framework above, the total loss consists of:

  • $L_{logits}$: The standard distillation loss applied to the final output layer.
  • $L_{IRG}$: A loss term that encourages the student's instance relationship edges to align with those of the teacher.
  • $L_{IRG-t}$: A loss term that forces the student to mimic the teacher’s transformation process between layers.
  • $L_{GT}$: The standard cross-entropy loss against ground-truth labels.

A significant finding in this research is the effectiveness of the "One-to-Many" deployment mode. The authors observed that the teacher's final layers often contain the most discriminative and generalizable knowledge. Consequently, using the teacher's final layer to supervise multiple intermediate layers of the student proved more effective than a strict one-to-one layer mapping, particularly when bridging different network architectures.

Experimental Results

The IRG method was rigorously evaluated across various benchmarks, including CIFAR-10, CIFAR-100, and ImageNet.

  • State-of-the-Art Performance: On CIFAR-10, the MTK method achieved an accuracy of 90.69%, a substantial improvement over the 88.36% baseline and surpassing other established KD methods like FitNet (89.15%).
  • Cross-Architecture Robustness: The method demonstrated remarkable stability when distilling between mismatched architectures (e.g., ShuffleNet to ResNet). Unlike traditional feature-mimicking methods that often struggle in such scenarios, IRG maintained consistent performance gains.
  • Data Efficiency: In low-data regimes (tested on a 10% subset of CIFAR-10), the performance gain of the IRG method was tripled compared to standard settings. This indicates that relational knowledge acts as a powerful regularizer, helping the student generalize better when training samples are scarce.
  • Feature Separability: t-SNE visualizations confirmed that students trained with IRG develop a more structured feature space, with clearer clustering and better class separability compared to those trained with standard KD.

Conclusion

Knowledge Distillation via Instance Relationship Graph represents a shift from point-wise feature matching to a more holistic, relational approach. By focusing on the topology of the feature space and the transformation process between layers, IRG overcomes the rigid constraints of traditional KD. While the method introduces some computational overhead due to the $O(I^2)$ complexity of edge calculations, its superior accuracy and robustness make it a compelling choice for modern model compression tasks. Future work may explore applying these relational insights to embedding-heavy tasks such as face verification and scene recognition.

Summary updated

BibTeX
@inproceedings{liu2019knowledge,
  author = {Yufan Liu and Jiajiong Cao and Bing Li and Chunfeng Yuan and Weiming Hu and Yangxi Li and Yunqiang Duan},
  title = {{Knowledge Distillation via Instance Relationship Graph}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00726},
}
Figure