Source-linked AI summary

Improved Knowledge Distillation via Teacher Assistant

Seyed-Iman Mirzadeh, Mehrdad Farajtabar, Ang Li, Nir Levine, Akihiro Matsukawa, Hassan Ghasemzadeh

arXiv:1902.03393v2cs.LGcs.AIstat.ML

TL;DR

Large teacher–student capacity gaps can make knowledge distillation less effective for compressing networks to resource-constrained devices. The paper introduces teacher assistants and multi-step distillation to bridge the gap, finding improved student performance across tested settings while noting theoretical and selection limitations.

  • Problem

    Knowledge distillation effectiveness is insufficiently understood when fixed large teachers are transferred to much smaller students, especially under extreme compression.

  • Method

    Teacher Assistant Knowledge Distillation inserts one or more intermediate networks, distilling each from the preceding larger network before training the student.

  • Results

    TAKD improves distillation performance across CIFAR-10, CIFAR-100, and ImageNet experiments using CNN and ResNet architectures.

  • Takeaways & Limitations

    The teacher–student capacity gap is a key factor in distillation efficacy, and intermediary assistants can remedy performance loss from large gaps.

  • Takeaways & Limitations

    The theoretical analysis relies on upper bounds and asymptotic reasoning, while automated data-driven teacher-assistant selection remains future work.

Abstract

from arXiv · show

Despite the fact that deep neural networks are powerful models and achieve appealing results on many tasks, they are too large to be deployed on edge devices like smartphones or embedded sensor nodes. There have been efforts to compress these networks, and a popular method is knowledge distillation, where a large (teacher) pre-trained network is used to train a smaller (student) network. However, in this paper, we show that the student network performance degrades when the gap between student and teacher is large. Given a fixed student network, one cannot employ an arbitrarily large teacher, or in other words, a teacher can effectively transfer its knowledge to students up to a certain size, not smaller. To alleviate this shortcoming, we introduce multi-step knowledge distillation, which employs an intermediate-sized network (teacher assistant) to bridge the gap between the student and the teacher. Moreover, we study the effect of teacher assistant size and extend the framework to multi-step distillation. Theoretical analysis and extensive experiments on CIFAR-10,100 and ImageNet datasets and on CNN and ResNet architectures substantiate the effectiveness of our proposed approach.

Introduction

Knowledge distillation compresses large networks for resource-constrained devices, but large teacher–student capacity gaps can reduce student performance. The paper proposes Teacher Assistant Knowledge Distillation, using intermediate models to bridge that gap and extending the approach to multiple assistants.

  • Deep networks often improve accuracy with greater depth and parameter count but can be too computationally expensive for mobile phones and embedded sensors.
  • Knowledge distillation trains a smaller student by encouraging it to mimic a pretrained teacher’s behavior alongside classification training.
  • A large teacher can produce worse student performance than a smaller teacher despite having more parameters and better accuracy.
  • TAKD inserts intermediate teacher assistants between teacher and student, distilling each assistant from the teacher before training the student from the assistants.
  • The paper studies capacity gaps, proposes teacher assistants for extreme compression, extends the framework to multiple assistants, and supports it theoretically and empirically.

Related Work

Prior work established model compression and knowledge distillation, but the effectiveness of transferring knowledge from large models to small models remained insufficiently studied. This paper addresses that gap by introducing moderate-capacity intermediate networks as a complementary distillation strategy.

  • Model Compression: Model compression includes reducing connections through weight magnitudes or importance scores, followed by fine-tuning to retain accuracy.
  • Knowledge Distillation: Knowledge distillation transfers soft targets from a large teacher to a computationally efficient student on a transfer set.
  • Related Distillation Variants: Related approaches transfer information from intermediate layers or train multiple models in parallel with distillation losses.
  • This work studies fixed teacher and student sizes and introduces intermediate networks with moderate capacity to improve distillation, while remaining complementary to existing approaches.
  • Distillation Theory: The paper uses theoretical analysis and empirical loss visualization to support the effectiveness of an intermediate network.

Assistant based Knowledge Distillation

Classic distillation combines supervised classification with softened teacher outputs, but increasing teacher size can eventually reduce student performance. Teacher assistants address this gap by providing a closer intermediate target, and experiments compare TAKD with established baselines.

  • Background and Notations: Knowledge distillation trains students using both true-label information and the teacher’s representation of data.
  • Background and Notations: The standard distillation objective matches softened student and teacher outputs using a temperature-controlled KL-divergence term.
  • Background and Notations: The student loss combines supervised learning and distillation losses, with λ controlling their trade-off; this approach is called BLKD.
  • The Gap Between Student and Teacher: For a 2-layer CNN student, teacher candidates have 4, 6, 8, or 10 convolutional layers, with layer count serving as a capacity proxy.
  • The Gap Between Student and Teacher: Teacher accuracy increases with size, but student accuracy first rises and then falls as the teacher becomes harder to mimic and its logits become less soft.
  • The Gap Between Student and Teacher: With a fixed 10-layer teacher, decreasing student size initially increases the performance boost, but larger gaps eventually worsen that gain.
  • Teacher Assistant Knowledge Distillation: TAKD uses an intermediate-capacity network distilled from the teacher, then uses that assistant to distill the student.
  • Teacher Assistant Knowledge Distillation: TAKD outperforms baseline distillation and normal training across three datasets and two architectures, including an ImageNet demonstration.

Experimental Setup

The experiments use CIFAR-10, CIFAR-100, and ImageNet image-classification datasets with plain CNN and ResNet architectures, implemented and optimized under specified training settings.

  • Datasets: Experiments cover CIFAR-10, CIFAR-100, and ImageNet image classification, with 10, 100, and 1000 classes, respectively.
  • Implementation: Training uses PyTorch, standardized image preprocessing, stochastic gradient descent with Nesterov momentum, and scheduled learning-rate reductions for ResNet.
  • Network Architectures: The study evaluates a VGG-like plain CNN and ResNet architectures, using convolutional cells and ResNet blocks as capacity proxies.
  • Evaluation Design: The evaluation includes student-accuracy tables for varied teacher-assistant sizes with configurations S=2, T=10 and S=8, T=110.

Results and Analysis

The experiments compare TAKD with baseline distillation and no distillation across datasets and architectures, then analyze assistant size and multi-step distillation paths. Results show that teacher assistants improve student performance, while an assistant near the teacher–student average performance is a useful size heuristic.

  • Overall Comparison: TAKD outperforms baseline knowledge distillation and normal training across the three datasets and two architectures.ImageNet is included in this comparison to demonstrate that TAKD also works on web-scale data.
  • Teacher-Assistant Size: Any teacher assistant size improves results over BLKD and NOKD in the varied-size evaluation.
  • Teacher-Assistant Size: TA=4 performs better than TA=6 or TA=8 for plain CNN, while optimal ResNet assistants are TA=14 on CIFAR-10 and TA=20 on CIFAR-100.
  • Teacher-Assistant Size: An assistant close to the average performance of teacher and student is proposed as a reasonable heuristic for selecting TA size.For plain CNN, size 4 is closer to the mean performance than sizes 6 or 8; the analogous ResNet choices are 14 and 20.
  • Multi-Step Distillation: For student sizes S=2, 4, and 6, all tested TAKD paths outperform BLKD and NOKD; full paths perform best for S=2 and S=4.The paper frames path choice as a trade-off involving available time and computing resources.
  • Comparison with Other Methods: The paper compares single-TA TAKD with FITNET, AT, FSP, and BSS under matched CIFAR-10 evaluation settings.The comparison uses ResNet26 as teacher and ResNet8 and ResNet14 as students.

Why Does Distillation with TA work?

TA-based distillation improves knowledge transfer by replacing a difficult direct teacher–student transition with smaller capacity gaps. Theoretical bounds and loss-landscape analysis link this design to lower error bounds and flatter minima, while identifying finite-sample limitations.

  • Mechanism: TAKD inserts an intermediate teacher assistant between teacher and student, splitting direct knowledge transfer into two stages.The TA learns from the teacher, and the student learns from the TA.
  • Mechanism: A large teacher–student capacity gap lowers the direct learning rate, making direct distillation harder than either TA-mediated stage.The analysis states α_st ≤ α_sa and α_st ≤ α_at.
  • Theoretical comparison: TAKD has a smaller asymptotic upper error bound than baseline knowledge distillation under the stated inequalities.The result relies on transfer-rate and error conditions such as α_st ≤ α_sa, α_st ≤ α_at, and ε_at + ε_sa ≤ ε_st.
  • Theoretical comparison: The theoretical comparison is asymptotic and may fail in finite samples when the teacher class is very large or teacher–student capacities differ greatly.In the latter case, the TA splits a very small α_st into the larger components α_sa and α_at.
  • Empirical interpretation: On CIFAR-100 loss landscapes, TAKD produces a flatter surface around local minima than no-distillation and baseline-distillation alternatives.The paper relates flatter minima to robustness against noisy inputs and better generalization.

Summary

The paper identifies the teacher–student capacity gap as an important, under-explored determinant of knowledge-distillation efficacy and proposes teacher assistants to address it. It supports the framework through empirical and theoretical analyses while leaving automated assistant selection and tighter bounds for future work.

  • Summary: Knowledge-distillation performance may decrease as the gap between student and teacher network capacities grows.The paper presents this gap as a key property affecting distillation efficacy.
  • Summary: Teacher Assistant Knowledge Distillation introduces intermediate models to remedy large-gap transfer and can extend to chains of multiple assistants.The framework is studied empirically and theoretically across multiple scenarios.
  • Future work: Fully data-driven teacher-assistant selection and tighter theoretical bounds remain open directions identified by the paper.The paper also calls for more rigorous analysis of knowledge distillation.

Network Architectures

The experiments use plain CNN architectures with standardized convolution and pooling components, and report separate CIFAR-10 and CIFAR-100 architecture tables. Layer notation encodes layer type and output dimensionality.

  • Layer notation: CB denotes convolution followed by batch normalization, MP denotes maxpooling, and FC denotes a fully connected layer.These abbreviations are used to describe the experimental networks.
  • Layer specification: All convolutional layers use 3×3 filters, while maxpooling uses stride 2 and kernel size 3.The number following a layer type gives convolutional output channels or fully connected output units.
  • Layer notation: CB32 represents a convolutional layer with 32 output channels followed by batch normalization.The notation illustrates how the architecture descriptions encode layer dimensions.
  • Experiment architectures: The CIFAR-10 and CIFAR-100 experiments use architecture specifications listed in separate tables.Table 4 covers CIFAR-10 and Table 5 covers CIFAR-100.

Why Using a Distilled TA?

The study examines whether a teacher assistant should itself be distilled rather than trained from scratch. Its experiments indicate that both assistant accuracy and distillation-based training affect student performance, with the distinction narrowing for larger assistants.

  • Motivation: Teacher-assistant effectiveness depends on its training method and achieved accuracy, not only on its size.The focused comparison uses plain CNNs on CIFAR-100.
  • Assistant quality: A more accurate six-convolution-layer network serves as a better teacher for a size-2 student in the reported experiment.The candidate teachers were trained from scratch for 5, 10, 15, or 100 epochs.
  • Assistant training: Distilled teacher assistants train students more successfully than from-scratch assistants in the size-2-student, size-10-teacher comparison.Figure 8-b compares KD-TA with FS-TA.
  • Assistant training: When the teacher-assistant size is 8, the performance difference between distilled and from-scratch assistants is small.This qualifies the stronger advantage observed for distilled assistants in the reported setting.

The Best TA Sequence

When the number of teacher assistants is constrained, selecting the best sequence is treated as an optimal-substructure problem. The paper gives a dynamic-programming procedure that searches efficiently over fixed-length distillation paths and validates the resulting substructure experimentally.

  • Motivation: A constrained TA-sequence problem arises when exhaustive search over exponentially many paths is impractical because resources or time are limited.The paper frames examples such as selecting two TAs between CNN-10 and CNN-2 or a length-3 path between ResNet-110 and ResNet-8.
  • Optimal substructure: The best length-k sequence has optimal substructure: an optimal path to an intermediate network must contain an optimal shorter path to that network.Replacing a nonoptimal prefix with a better one would produce a better complete path, contradicting optimality.
  • Dynamic-programming solution: The algorithm initializes one-step distillation from the teacher, then iteratively extends paths through additional distillation steps to return an optimal student and path.Algorithm 1 takes networks ordered by decreasing size and a target path length k.
  • Dynamic-programming solution: Dynamic programming defines the best path of length k for each candidate network size and selects the most accurate distilled network among possible predecessors.The recurrence evaluates BLKD candidates, chooses the minimizing loss, and appends the selected predecessor to the path.
  • Efficiency: The optimal path requires O(kn^2) knowledge-distillation operations, yielding an exponential speedup over exhaustive path enumeration.The computational result applies to finding the optimal length-k path among intermediate teacher assistants.
  • Empirical validation: In the T=10, S=2 experiment with exactly two TAs, the path 10 → 6 → 4 → 2 is best, and its prefix 10 → 6 → 4 is also best for reaching 4 with one TA.This experiment validates the predicted optimal-substructure behavior.
Loading 1902.03393v2…