Transferring Inductive Biases through Knowledge Distillation

Samira Abnar, Mostafa Dehghani, Willem H. Zuidema

Abstract

Knowledge distillation (KD) is traditionally viewed as a tool for model compression. However, recent research reveals that KD can also transfer a teacher’s inductive biases to a student. By distilling models like LSTMs into Transformers or CNNs into MLPs, students can inherit the "architectural wisdom" of their teachers. This leads to better generalization, improved calibration, and more robust performance on out-of-distribution data, even when the student's underlying architecture remains unchanged.

Introduction: The Role of Inductive Bias

In machine learning, inductive biases are the prior beliefs baked into an architecture. For example, Convolutional Neural Networks (CNNs) assume patterns are local and translation-invariant, while Long Short-Term Memory (LSTM) networks assume data is sequential. These biases are vital when data is scarce or when the test environment differs from the training set.

Highly flexible models like Transformers or Multi-Layer Perceptrons (MLPs) have "weak" inductive biases. While powerful, they require massive amounts of data to learn patterns that a more "biased" model might pick up instantly. This paper investigates whether Knowledge Distillation can "inject" the beneficial biases of a specialized teacher into a more flexible student, effectively providing the best of both worlds.

Methodology

The researchers employed Offline Knowledge Distillation, where a pre-trained teacher model provides soft targets (logits) to train a student. To isolate the transfer of architectural information, they often used pure distillation, training only on the teacher's outputs without ground-truth labels.

To measure bias transfer beyond simple accuracy, the authors used several diagnostic tools:

  • Representational Similarity Analysis (RSA): Comparing internal latent spaces to see if the student organizes information similarly to the teacher.
  • Training Path Visualization: Projecting the model’s state during training into 2D space to observe optimization trajectories.
  • Loss Landscape Analysis: Using linear interpolation to see if students and teachers converge to similar solution basins.
Training path visualization comparing (a) MLP, (b) CNN, and (c) CNN-distilled MLP. The distilled student's optimization path mimics the teacher's.

Key Insights: Mimicry and Dark Knowledge

The study suggests that a teacher’s logits contain "dark knowledge"—probabilities for every class that encode the teacher's preferences and errors rooted in its architecture.

Internal Mimicry and Path Dependency

Distillation reshapes the student's internal representations. RSA showed that distilled Transformers began to represent data in a way that looked more like an LSTM. Strikingly, the training path of a distilled student mimics its teacher's path. As shown in the visualization, an MLP distilled from a CNN "walks" through the optimization landscape in a CNN-like fashion rather than following the standard MLP trajectory.

Experimental Results

The findings were validated across two distinct domains: Natural Language Processing (NLP) and Computer Vision (CV).

Natural Language Processing

In subject-verb agreement tasks (e.g., identifying the correct verb form despite "distractor" nouns), LSTMs naturally outperform Transformers due to their recurrent bias. Distilling an LSTM into a Transformer significantly closed this gap, particularly in difficult cases with multiple "agreement attractors."

Accuracy vs. Perplexity on NLP tasks. Knowledge distillation shifts Transformer students toward the high-accuracy, low-perplexity region occupied by LSTM teachers.

Computer Vision

On the Translated MNIST benchmark, a standard MLP achieved only 37.3% accuracy. When distilled from a CNN teacher, the same MLP architecture reached 51.0% accuracy. This demonstrates that the student inherited a degree of translation equivariance from the teacher. Furthermore, distilled students showed lower Expected Calibration Error (ECE), meaning their confidence levels were better aligned with actual performance.

Conclusion and Limitations

While KD effectively transfers bias, students rarely reach the full performance of the teacher on out-of-distribution tasks. This suggests a limit to how much "architectural wisdom" a student can absorb if its own structure is fundamentally different. Future work may explore multi-teacher distillation and scaling these techniques to larger models and more complex datasets like ImageNet.

Summary updated

BibTeX
@misc{abnar2020transferring,
  author = {Samira Abnar and Mostafa Dehghani and Willem H. Zuidema},
  title = {{Transferring Inductive Biases through Knowledge Distillation}},
  year = {2020},
  eprint = {2006.00555},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.00555},
}
Figure