Revisiting Intermediate-Layer Matching in Knowledge Distillation: Layer-Selection Strategy Doesn't Matter (Much)

Zony Yu, Yuqiao Wen, Lili MouarXiv 2025

TL;DR

While intermediate-layer matching is a highly effective technique in knowledge distillation (KD), the specific strategy used to pair student layers with teacher layers surprisingly doesn't matter much. Even seemingly nonsensical strategies—like matching layers in reverse order or mapping all student layers to a single middle teacher layer—yield performance remarkably close to standard forward matching. This happens because different teacher layers share highly redundant information, presenting acute vector angles from the student's perspective.

What Problem Does This Paper Address?

Knowledge Distillation (KD) compresses large, cumbersome "teacher" models into smaller, faster "student" models by training the student to mimic the teacher. Beyond just matching the final predictions, a common practice is intermediate-layer matching, where hidden states of the student are forced to resemble those of the teacher.

Historically, researchers have spent significant effort designing complex layer-selection strategies to determine exactly which teacher layer should map to which student layer (e.g., using attention mechanisms, even spacing, or sorted random selections). However, these studies often lacked rigorous controlled comparisons, ignoring factors like weight initialization strategies or modern decoder-only architectures. This paper systematically investigates whether these meticulously designed layer-selection strategies actually drive student performance.

Methods

The authors evaluate four distinct layer-selection strategies, ranging from standard to intentionally counterintuitive:

  • Forward Matching: The baseline standard where lower student layers map to evenly spaced, lower teacher layers.
  • All-to-One Matching: All student layers are forced to match a single, middle layer of the teacher.
  • Reverse Matching: A deliberately nonsensical strategy where lower student layers are matched to upper teacher layers (reverse order).
  • Out-of-Order Random Matching: The teacher layers are randomly shuffled before being mapped to the student layers, maintaining this shuffled order throughout distillation.

These strategies were tested under two parameter initialization setups: random initialization (to isolate the effect of layer matching) and weight copying from the teacher (a common practical shortcut).

To explain their findings, the authors also introduced a geometric analysis method, measuring the cosine similarity (angles) between different teacher layers from the student's perspective.

Datasets

The authors evaluated their approaches across a diverse suite of eight tasks spanning classification, reasoning, and generation:

  • Classification: MNLI, QQP, QNLI, and SST-2 (using a 12-layer BERT teacher distilled to 3, 6, or 9-layer students).
  • Reasoning/Challenging Tasks: HellaSwag and CommonsenseQA (using a 40-layer Qwen3-8B teacher distilled to a 10-layer student).
  • Generation: DART (using BART-Large) and WMT16 En–Ro (using T5-Base).

Key Insights and Ideas

  • The Strategy Doesn't Matter (Much): Across almost all tasks and architectures, the performance variance between the best strategy (often forward or all-to-one) and the "nonsensical" ones (reverse or random) was incredibly small—typically only 2–3 accuracy points for classification and 1–2 BLEU points for generation.
  • Intermediate Matching is Still Crucial: Even though the strategy doesn't matter, doing intermediate-layer matching at all provides massive benefits, substantially outperforming the "No Matching" baseline. For example, on the MNLI task with random initialization, all matching strategies improved upon the baseline by 6 to 10 points.
  • The "Acute Angle" Explanation: Why do bad strategies work so well? The authors' geometric analysis revealed that the representations of different teacher layers are highly correlated. When viewed from the student's perspective, the vector angles between teacher layers are mostly acute (positive cosine similarity).
Illustration of the angle calculation and the resulting positive cosine similarity distributions across tasks

Because the teacher's layers point in a similar general direction, matching any teacher layer pulls the student layer in the correct direction.

Key Results

The main performance trends are highly consistent across models and initializations, as shown in the authors' primary evaluation table:

Main experimental results across BERT, BART, and T5 models

Key data points include:

  • MNLI (Randomly Initialized Student): The "No Matching" baseline scores 63.2%. Forward matching achieves 72.5%, while the "nonsensical" Reverse Matching still achieves 69.3%, and All-to-One actually scores the highest at 74.0%.
  • MNLI (Weights Copied Student): Performance tightly clusters together, with Forward at 79.7%, Reverse at 79.2%, and All-to-One at 79.4%.
  • Qwen3 on HellaSwag: Forward matching scored 37.85% accuracy, while Reverse Matching scored 35.01%, and Out-of-Order Random scored 35.47%—all outperforming the No Matching baseline (35.16%) or performing within a very narrow margin.

Limitations and Future Work

The authors note a few limitations to their study:

  • The DART Exception: In the DART generation dataset with a randomly initialized student, intermediate matching actually hurt performance. The authors attribute this to the student overfitting to the teacher's representations due to the small dataset size and wider student architecture.
  • Fine-Tuning Focus: The study focuses entirely on the fine-tuning stage of KD rather than the pre-training stage, due to computational resource constraints.
  • Domain Scope: The experiments are strictly confined to Natural Language Processing (NLP) models; computer vision models were not explored.

Practical Takeaway: For engineers and researchers building KD pipelines, the authors suggest stopping the search for the "perfect" layer-matching heuristic. Instead, stick to vanilla forward matching as a default and redirect engineering efforts toward loss functions, distillation temperatures, and weight initialization.

Summary updated

BibTeX
@misc{yu2025revisiting,
  author = {Zony Yu and Yuqiao Wen and Lili Mou},
  title = {{Revisiting Intermediate-Layer Matching in Knowledge Distillation: Layer-Selection Strategy Doesn't Matter (Much)}},
  year = {2025},
  eprint = {2502.04499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.04499},
}
Figure