Paper commentary
Relational Knowledge Distillation
Relational knowledge distillation has students copy relations between examples, not single outputs
- Problem Distillation usually makes the student copy each teacher output on its own, so it ignores how examples relate to one another.
- Method RKD scores tuples of examples by their distances and angles in the teacher's embeddings. It then penalizes the student for scoring them differently, using a Huber loss.
- Results On Cars 196, a ResNet18 student trained without ℓ2 normalization reaches 82.50 Recall@1, above the 77.17 of its triplet-trained teacher.
Why match relations instead of outputs
Distillation is usually framed as training a student on the teacher's outputs as targets, whether those outputs come from the last layer or a hidden layer. In that framing the knowledge is a mapping from inputs to outputs, so each example is handled in isolation. The authors argue instead that the knowledge sits in how learned representations relate to one another, so an example's meaning depends on its position relative to other examples.
They draw this view from structuralist linguistics, where a sign's meaning depends on its relations with other signs.
Relational Knowledge Distillation (RKD) follows from this view: the student is asked to reproduce a structure of relations among outputs rather than the outputs themselves. The Figure 1 description frames the contrast as point-wise transfer in conventional KD against structure-wise transfer in RKD, with RKD presented as a generalization of conventional KD.
Relational potentials and the two RKD losses
Conventional KD minimizes a loss between the teacher and student outputs of each example, as in Eq. (1), and Hinton-style KD adds a softmax with temperature and a Kullback-Leibler divergence to that pattern. Romero-style hint training matches hidden outputs with a squared Euclidean distance and a linear map β when the student's hidden layer is narrower.
RKD replaces the per-example term with a sum over n-tuples drawn from X^N, where a relational potential ψ is computed on the teacher outputs and on the student outputs of each tuple. \[ L_{RKD}=\sum_{(x_1,\dots,x_n)\in X^N} l\big(\psi(t_1,\dots,t_n),\psi(s_1,\dots,s_n)\big) \] Here t_i is the teacher output and s_i the student output of x_i, and when the tuple has one element and ψ is the identity, the expression reduces to conventional KD.
The distance-wise potential takes a pair of examples and returns the Euclidean distance between their teacher or student outputs, divided by a normalizer µ. \[ \psi_D(t_i,t_j)=\frac{1}{\mu}\lVert t_i-t_j\rVert_2 \] µ is the average of the pairwise distances over all pairs in X^2 inside the mini-batch, as in Eq. (6). \[ \mu=\frac{1}{|X^2|}\sum_{(x_i,x_j)\in X^2}\lVert t_i-t_j\rVert_2 \] As written, µ is computed from the teacher distances, and the authors motivate the normalizer by the scale gap between teacher and student distances, which can arise from different output dimensions.
The authors report that this normalization gave more stable and faster convergence in their training.
The distance-wise loss sums a Huber penalty over all pairs, comparing the teacher's potential for a pair with the student's potential for the same pair. \[ L_{RKD\text{-}D}=\sum_{(x_i,x_j)\in X^2} l_\delta\big(\psi_D(t_i,t_j),\psi_D(s_i,s_j)\big) \] The Huber loss l_δ is quadratic when the absolute difference is at most 1 and linear beyond it.
\[ l_\delta(x,y)=\begin{cases}\tfrac{1}{2}(x-y)^2 & |x-y|\le 1\\ |x-y|-\tfrac{1}{2} & \text{otherwise}\end{cases} \]
The angle-wise potential takes a triplet and returns the cosine of the angle at t_j, computed as the inner product of two unit vectors that point from t_j to t_i and to t_k. \[ \psi_A(t_i,t_j,t_k)=\cos\angle t_i t_j t_k=\langle e_{ij},e_{kj}\rangle,\quad e_{ij}=\frac{t_i-t_j}{\lVert t_i-t_j\rVert_2},\; e_{kj}=\frac{t_k-t_j}{\lVert t_k-t_j\rVert_2} \] The angle-wise loss has the same Huber form and sums over all triplets in X^3.
\[ L_{RKD\text{-}A}=\sum_{(x_i,x_j,x_k)\in X^3} l_\delta\big(\psi_A(t_i,t_j,t_k),\psi_A(s_i,s_j,s_k)\big) \]
Training objective, tuple sampling and target layer
RKD losses can be used alone or with a task-specific loss, giving the objective \[ L_{task}+\lambda_{KD}\cdot L_{KD} \] where λKD balances the two terms. When several KD losses are used, each one has its own balancing factor.
The tuples are not subsampled: every pair or triplet that can be formed from the examples in a mini-batch is used. For metric learning the student is trained with the RKD losses alone and without the triplet loss, because the authors found the task loss added no gain in their experiments.
The distillation target can be any layer, but the distance and angle losses do not transfer individual outputs. Where exact output values matter, such as a softmax layer for classification, the RKD losses need to be paired with IKD losses or task-specific losses, and in most other cases the authors found RKD applicable and effective.
Metric learning protocol
Experiments use the image retrieval benchmarks CUB-200-2011, Cars 196 and Stanford Online Products, with the train/test splits suggested in [21]. Recall@K takes each test image as a query, retrieves its top K nearest neighbors from the test set without the query, and scores a hit when a retrieved image shares the query's category, averaged over the test set.
The teacher is an ImageNet-pretrained ResNet50 cut at avgpool, followed by a fully connected layer with a 512-dimensional embedding and ℓ2 normalization. The student is an ImageNet-pretrained ResNet18 built the same way with different embedding sizes, and the teacher is trained with the triplet loss. Training uses Adam with batch size 128, random 224 by 224 crops from resized 256 by 256 images with random horizontal flips, and five positive images per category in each mini-batch.
Smaller students against the triplet baseline and DarkRank
Table 1 compares the triplet baseline, FitNet, Attention, DarkRank and the three RKD variants for ResNet18 students at four embedding sizes on CUB-200-2011 and Cars 196. On CUB-200-2011 with ℓ2 normalization, the ResNet18-128 student reaches 53.92 Recall@1 with the triplet baseline and 59.69 with RKD-DA. Without ℓ2 normalization the same RKD-DA student reaches 60.67 on CUB-200-2011.
The authors read this as students with a smaller backbone and smaller embedding outperforming their teacher on Cars 196. The relative gain of RKD-DA over the triplet baseline grows as the embedding shrinks, and the triplet baseline falls more sharply at small embedding sizes than the RKD students do.
DarkRank on Cars 196 with ResNet18-128 reaches 52.92 Recall@1 without ℓ2 normalization, against 77.00 with it. The authors attribute this to the triplet loss inside DarkRank, which they describe as fragile without normalization. RKD-DA scores higher without normalization than with it at every embedding size on both CUB-200-2011 and Cars 196 in Table 1.
The authors also state that removing normalization degraded all the other methods in their experiments.
Self-distillation across generations
Students have the same architecture as the teacher, are trained with RKD-DA without ℓ2 normalization, and each new generation uses the previous student as its teacher. Table 2 reports Recall@1 on CUB, Cars and SOP for the triplet-trained ResNet50-512 teacher and the generations after it.
The authors say every generation outperforms the initial teacher. The second and third generations are lower than the first on all three benchmarks, so the gains do not grow with further generations in these experiments.
Comparison with published metric learning methods
Table 3 groups the compared methods by GoogLeNet and ResNet50 backbones and lists recall at K for CUB-200-2011, Cars 196 and Stanford Online Products. For these comparisons the RKD-DA students use the same embedding sizes as the other methods.
With ResNet50, RKD-DA-128 reaches 64.9 Recall@1 on CUB-200-2011 against 63.6 for Margin [42]-128, 84.9 against 79.6 on Cars 196, and 77.5 against 72.7 on Stanford Online Products. The authors state that the method outperforms all others on CUB-200-2011 regardless of backbone, and is best among ResNet50 models on all benchmarks.
With GoogLeNet, RKD-DA-512 reaches 61.4 Recall@1 on CUB-200-2011, against 60.6 for ABE8 [13]-512. ABE8 is higher on Cars 196 with 85.2 against 82.3 for RKD-DA-512, and on Stanford Online Products with 76.3 against 75.1. The authors note that ABE8 uses additional attention modules for each branch, whereas their GoogLeNet student has a single embedding layer.
Recall on other datasets after training on Cars 196
The comparison trains the triplet teacher and an RKD-DA student on Cars 196, then measures Recall@1 on the test splits of Cars 196, CUB-200-2011, Stanford Dog and CIFAR-100, alongside a pretrained feature model.
The RKD-DA student has much lower Recall@1 on the other domains, while the triplet teacher stays close to the pretrained feature model. The authors read this as RKD strongly adapting the model to its training domain, at the cost of generalization to other domains. The text gives no numeric values for this comparison, which is shown only as a plot.
Image classification with HKD, FitNet and Attention
On CIFAR-100 the teacher is ResNet50 and the student is VGG11 with batch normalization, and on Tiny ImageNet the teacher is ResNet101 and the student is ResNet18.
On CIFAR-100 the baseline student reaches 71.26 and RKD-DA reaches 72.97, while HKD reaches 74.26 and HKD with RKD-DA reaches 74.66. On Tiny ImageNet the baseline reaches 54.45, RKD-DA 56.36, HKD 57.65 and HKD with RKD-DA 58.15, with the teacher at 61.55. The authors state that RKD-DA combined with HKD outperforms all configurations on both datasets.
Adding RKD-DA to FitNet gives 72.98 on CIFAR-100 against 70.81 for FitNet alone, but 55.54 on Tiny ImageNet against 55.59. Adding RKD-DA to Attention gives 73.53 against 72.68 on CIFAR-100 and 56.55 against 55.51 on Tiny ImageNet. The authors describe RKD as complementary to other KD methods, with the model improving in most cases when combined.
Few-shot classification with prototypical networks
The teacher and student are both four-layer prototypical networks, so this is self-distillation, and RKD, FitNet and Attention are applied to the final embedding. λRKD-D is set to 50 and λRKD-A to 100, the final loss is divided by 2 when both RKD losses are combined, and λAttention is set to 10. Accuracy is averaged over 1000 episodes on Omniglot and 600 episodes on miniImageNet, with miniImageNet results given with 95% confidence intervals.
On Omniglot, RKD-D reaches 98.58 at 5-way 1-shot and 95.45 at 20-way 1-shot, against 98.55 and 95.11 for the teacher. RKD-DA reaches 98.67 at 20-way 5-shot, slightly below the teacher's 98.68 on that setting.
FitNet is higher at 50.38 ± 0.81 for 1-shot 5-way, and Attention is much lower at 34.67 ± 0.65.
Limitations
The distance-wise and angle-wise losses do not transfer individual outputs, so they are insufficient alone where those outputs matter, such as softmax layers in classification. The study uses only the distance-wise and angle-wise potentials, and the authors name higher-order potentials beyond these two as an open direction.
In self-distillation, performance does not improve after the second generation in these experiments. The few-shot experiments use only same-architecture self-distillation on four-layer networks, not smaller students. Classification is evaluated only on CIFAR-100 and Tiny ImageNet.
The few-shot gains are small, FitNet is higher on 1-shot miniImageNet, and RKD-DA is slightly below the teacher on 20-way 5-shot Omniglot. The cross-domain comparison uses a student trained only on Cars 196.
Paper info
- Authors
- Wonpyo Park, Dongju Kim, Yan Lu, Minsu Cho
- Venue
- arXiv · Preprint
- First published
- 2019-4-10
- Added
- 2026-11-12
- Updated
- 2019-5-1
- Version
- v2
- arXiv
- 1904.05068
- Category
- cs.CV · cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Wonpyo Park, Dongju Kim, Yan Lu, Minsu Cho (2019). Relational Knowledge Distillation. arXiv:1904.05068v2. https://arxiv.org/abs/1904.05068v2
BibTeX
@misc{park2019relational,
title = {{Relational Knowledge Distillation}},
author = {Wonpyo Park and Dongju Kim and Yan Lu and Minsu Cho},
year = {2019},
eprint = {1904.05068},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1904.05068v2}
}