Parallel Blockwise Knowledge Distillation for Deep Neural Network Compression

Cody Blakeney, Xiaomin Li, Yan Yan, Ziliang Zong

TL;DR

Deep neural networks are powerful but computationally expensive, making compression techniques like knowledge distillation essential for edge deployment. However, traditional distillation is notoriously slow due to sequential training dependencies. This paper introduces a parallel blockwise knowledge distillation algorithm that trains replacement network blocks independently across multiple GPUs, achieving near-linear speedups and significant energy savings with negligible accuracy loss.

What Problem Does This Paper Address?

To deploy massive Deep Neural Networks (DNNs) on resource-constrained edge devices (like smartphones or IoT sensors), engineers use compression techniques. One highly effective method is Knowledge Distillation (KD), where a smaller, simpler "student" model is trained to mimic the behavior of a larger, complex "teacher" model.

While KD preserves accuracy well, it is incredibly slow. It typically requires running both the massive teacher and the student models simultaneously. Even newer "progressive blockwise" KD methods—which simplify the process by replacing and training chunks of the network one at a time—still suffer from sequential bottlenecks. You have to finish training block $N$ before you can train block $N+1$. This long training time prevents KD from being widely adopted in rapid, iterative software development cycles.

Methods

The authors break the sequential dependency of traditional blockwise KD by making the process "embarrassingly parallel."

  • Independent Blockwise Distillation: Instead of training blocks bottom-up, the algorithm trains all candidate replacement blocks simultaneously. It uses a local loss function—comparing the feature maps of the student block directly to the feature maps of the corresponding teacher block. This eliminates the need to load the entire model into memory at once or wait for previous layers to finish.
  • Efficient Replacement Blocks: The expensive standard convolutional blocks in the teacher model are swapped out for lightweight depthwise separable convolutions (specifically, an optimized architecture using two depthwise separable layers, batch normalization, and ReLU).
  • Smart Task Scheduling: Each block replacement is treated as an independent task distributed across multiple GPUs using MPI. To prevent fast-training blocks from finishing early and leaving GPUs idle, the authors employ advanced scheduling algorithms like Bin Packing (when execution times are known in advance) or Work Stealing (for dynamic load balancing on the fly).

Datasets

  • CIFAR10: Used for rapid prototyping and initial evaluation (60,000 32x32 images across 10 classes).
  • ImageNet: Used to verify the algorithm's performance and scalability on a massive, real-world image recognition task (1.28 million training images across 1,000 classes).

Key Insights and Ideas

  • Local loss unlocks parallelism: By relying only on the local activations of the preceding block rather than the final network output, blocks can be distilled completely independently. The network is only stitched back together and fine-tuned at the very end.
  • Not all models scale equally with naive scheduling: A simple Round Robin task scheduler works fine for ResNet because its blocks take similar amounts of time to train. However, it fails miserably for VGG, where block training times vary wildly. Advanced schedulers (like Work Stealing) are absolutely required to maintain high GPU utilization for asymmetrical models.
  • CPU preprocessing can silently kill GPU scaling: The authors noticed their multi-GPU setup wasn't scaling linearly. They discovered that default TensorFlow data pipeline settings (which try to use all available CPU threads) caused CPU hyperthreading contention when feeding multiple GPUs simultaneously. Manually restricting the CPU threads and disabling hyperthreading restored near-linear multi-GPU speedups—a great reminder that systems-level bottlenecks often hide in ML pipelines.

Key Results

  • Speedup: The algorithm achieved a 3.53x speedup for ResNet and 3.08x for VGG on a single server with 4 RTX 2080Ti GPUs. On a distributed cluster with 4 RTX 6000 GPUs, the ResNet speedup reached 3.87x (near-perfect linear scaling).
  • Energy Efficiency: Because the training time was drastically shortened, the method reduced total energy consumption by 29% for ResNet and 19% for VGG.
  • Accuracy: The parallel approach maintained highly competitive accuracy. On CIFAR10, the student VGG lost only 0.73% accuracy (a massive improvement over the 3.05% drop seen in prior state-of-the-art sequential methods). On ImageNet, the student ResNet actually gained 1.91% accuracy over the teacher model.

Limitations and Future Work

  • Limitations: The current evaluation is primarily limited to standard convolutional layers in VGG and ResNet architectures. It is not explicitly clear how well the specific depthwise separable replacement blocks generalize to radically different architectures, such as Transformers or RNNs.
  • Future Work: The authors plan to test the method on other types of neural network layers. Additionally, because their independent blockwise distillation relies only on local feature map loss (and does not strictly require ground-truth labels for the block-training phase), they plan to explore using this method with unlabeled data for unsupervised learning compression.

Summary updated

BibTeX
@article{blakeney2021parallel,
  author = {Cody Blakeney and Xiaomin Li and Yan Yan and Ziliang Zong},
  title = {{Parallel Blockwise Knowledge Distillation for Deep Neural Network Compression}},
  journal = {IEEE Trans. Parallel Distributed Syst.},
  year = {2021},
  url = {https://openreview.net/forum?id=76tp03RlC88},
}
Figure