Abstract
Knowledge Distillation (KD) is a cornerstone technique for model compression, yet standard methods often fail to ensure that the student model inherits the teacher's underlying reasoning. We introduce Explanation-Enhanced Knowledge Distillation ($e^2KD$), which incorporates teacher attribution maps into the distillation process. By matching explanations, students achieve higher accuracy in low-data settings and demonstrate greater robustness to distribution shifts by focusing on causal rather than spurious features.
Introduction
In the pursuit of efficient deep learning, Knowledge Distillation has become the standard for model compression. By training a compact student model to mimic the soft targets of a high-capacity teacher, researchers can deploy high-performing models on edge devices. Yet, a fundamental flaw remains: mimicking the final answer does not guarantee understanding the underlying logic. A student might correctly classify a "waterbird" by looking at the water in the background, whereas the teacher focuses on the bird itself. This lack of alignment makes student models fragile under distribution shifts and inconsistent with their larger counterparts.
To bridge this gap, we propose $e^2KD$. By forcing the student to match the teacher's explanations, we provide a richer training signal that guides the student toward the causal features identified by the teacher.
Methodology: Learning from Explanations
The core of $e^2KD$ is the integration of an explanation-matching term into the standard distillation loss.
Explanation Generation
The method is model-agnostic and can utilize various differentiable explanation techniques. For standard Convolutional Neural Networks (CNNs), we employ GradCAM, which produces heatmaps highlighting the input regions most influential to a prediction. For inherently interpretable architectures like B-cos models, we use their native attribution maps.
The $e^2KD$ Loss Function
The total training objective combines the standard KD loss ($\mathcal{L}_{KD}$) with a new explanation loss ($\mathcal{L}_{exp}$): $$\mathcal{L} = \mathcal{L}_{KD} + \lambda \mathcal{L}_{exp}$$ The explanation loss $\mathcal{L}_{exp}$ is defined as the cosine similarity between the teacher’s and student’s attribution maps. This encourages the student to attend to the same spatial features as the teacher.
Computational Efficiency
To mitigate the overhead of pre-computing teacher explanations during every training step, we introduce "frozen explanations." We pre-calculate the teacher's attribution maps for the entire training set once. During training, we apply the same stochastic data augmentations (e.g., random crops, flips) to both the input image and its corresponding pre-computed heatmap, ensuring the spatial alignment is preserved without redundant teacher passes.
Experimental Results
We evaluated $e^2KD$ across several benchmarks, including ImageNet (in low-data settings), Waterbirds-100 (to test spurious correlations), and PASCAL VOC.
Performance in Low-Data Regimes
One of the most significant findings is that $e^2KD$ excels when training data is scarce. On ImageNet with only 50 shots per class, $e^2KD$ provides a substantial boost over vanilla KD. As shown in the table below, for standard ResNet architectures, $e^2KD$ improves top-1 accuracy by 5.1 percentage points and student-teacher agreement by 6.2 percentage points over standard KD.
Robustness and Feature Learning
On the Waterbirds-100 dataset, which is designed to trick models with background correlations, $e^2KD$ students successfully ignored spurious background features. In out-of-distribution (OOD) tests, where birds appeared in non-standard environments, $e^2KD$ achieved accuracy gains of up to 13 percentage points over standard KD when combined with Mixup augmentation. This confirms that the student is indeed learning the "right features."
Cross-Architecture Transfer
$e^2KD$ also facilitates the transfer of inductive biases between different architectures. For instance, distilling from a CNN to a Vision Transformer (ViT) allowed the ViT student to inherit the CNN's inherent shift-equivariance, a property ViTs typically lack without massive amounts of data.
Discussion and Limitations
While $e^2KD$ represents a significant step forward, its effectiveness is inherently tied to the quality of the teacher's explanations. If a teacher relies on flawed reasoning, the student will likely inherit those biases. Additionally, while "frozen explanations" reduce training time, the initial pre-computation phase remains a necessary cost. Future work could explore the impact of different explanation methods, such as Integrated Gradients, on the distillation process.
Conclusion
$e^2KD$ demonstrates that "showing the work" is as vital for machine learning models as it is for human students. By aligning the internal reasoning of student models with their teachers, we can create smaller, more efficient AI that is not only more accurate but also more robust and trustworthy.
Summary updated