Filter Pruning for Efficient CNNs via Knowledge-driven Differential Filter Sampler

Shaohui Lin, Wenxuan Huang, Jiao Xie, Baochang Zhang, Yunhang Shen, Zhou Yu, Jungong Han, David S. DoermannarXiv 2023 · DOI

TL;DR

This paper introduces KDFS, a novel filter pruning method that uses knowledge from a pre-trained "teacher" model to intelligently remove redundant filters in a Convolutional Neural Network (CNN). KDFS achieves significant reductions in computation and parameters while maintaining high accuracy, making CNNs more efficient for deployment on resource-constrained devices.

What Problem Does This Paper Address?

Convolutional Neural Networks (CNNs) are incredibly powerful for tasks like image classification and object detection, but they often come with a hefty computational and memory cost. This makes it challenging to deploy them on edge devices (like smartphones or autonomous vehicles) or even to serve many users efficiently in the cloud. Filter pruning is a popular technique to tackle this by removing entire filters (and their associated computations) from a CNN. However, existing methods often struggle to find the right balance between compression and accuracy, sometimes making irreversible pruning decisions or requiring tedious trial-and-error to set pruning rates. This paper aims to address these limitations by proposing a more intelligent, knowledge-driven, and end-to-end filter pruning approach.

Methods

The core of KDFS lies in its Knowledge-driven Differential Filter Sampler (KDFS) and Masked Filter Modeling (MFM) framework.

  • Differential Filter Sampler: Instead of relying on fixed criteria or iterative pruning, KDFS uses a learnable "sampler" with parameters that generate a binary mask for each layer. This mask determines which filters are kept and which are pruned. The sampler is trained using the Gumbel-Softmax trick with a Straight-Through Gradient Estimator, allowing for end-to-end optimization of the pruning masks alongside the network's weights.
  • Masked Filter Modeling (MFM): To guide the sampler effectively, KDFS leverages knowledge from a pre-trained "teacher" model. MFM constructs "PCA-like" knowledge by aligning intermediate features from the teacher with the outputs of a student decoder that processes the sampled features. This helps the student network learn to mimic the teacher's representational power, even with pruned filters.
  • End-to-End Optimization: KDFS optimizes the network weights, the sampler parameters (which generate the masks), and the decoder parameters simultaneously. This is achieved by minimizing a combined loss function that includes:
  • Cross-entropy loss: For standard classification accuracy.
  • Knowledge Distillation (KD) loss: To transfer the teacher's "dark knowledge" (soft predictions) to the student.
  • MFM reconstruction loss: To ensure the student's sampled features align with the teacher's.
  • FLOPs regularization term: A novel constraint that directly encourages the pruned network to meet a global FLOPs reduction target, replacing the need for layer-wise pruning rate settings and avoiding trial-and-error.

Datasets

The paper evaluates KDFS on several standard datasets for image classification:

  • CIFAR-10
  • CIFAR-100
  • ImageNet ILSVRC 2012

It also demonstrates the transferability of KDFS-pruned models to downstream tasks using:

  • PASCAL VOC (for object detection)
  • MS COCO (for instance segmentation)

Key Insights and Ideas

  • Knowledge-driven pruning is superior: Leveraging a pre-trained teacher model's knowledge significantly improves the effectiveness of filter pruning, leading to better accuracy-compression trade-offs.
  • Differential sampling for flexibility: Using a learnable, differentiable sampler allows for dynamic and adaptive filter selection, avoiding the rigidity of hard pruning methods.
  • PCA-like knowledge for better guidance: The MFM approach, which constructs PCA-like knowledge by aligning teacher and student features, provides a more effective way to guide the pruning process than simple feature matching.
  • Global FLOPs constraint simplifies pruning: Replacing layer-specific pruning rates with a global FLOPs constraint simplifies the pruning process and avoids tedious hyperparameter tuning.
  • End-to-end optimization is key: Jointly optimizing weights, masks, and the decoder enables a more holistic and effective compression strategy.

Key Results

KDFS demonstrates strong performance across various models and datasets:

  • ResNet-50 on ImageNet: Achieved a remarkable 55.36% computation reduction and 42.86% parameter reduction while only dropping 0.35% Top-1 accuracy. This significantly outperforms state-of-the-art methods.
  • ResNet-56 on CIFAR-10: KDFS-0.4, KDFS-0.5, and KDFS-0.6 achieved FLOPs reductions of 40.85%, 51.19%, and 59.17%, respectively, with minimal accuracy loss (even slight improvements in some cases).
  • ResNet-110 on CIFAR-10: KDFS-0.6 achieved a 60.93% FLOPs reduction and improved accuracy by 0.15% compared to the base model.
  • DenseNet-40 on CIFAR-10: KDFS-0.6 achieved a 61.78% FLOPs reduction with only a 0.37% accuracy drop.
  • MobileNetV2 on ImageNet: KDFS-0.3 achieved a ~30% FLOPs reduction with improved Top-1 and Top-5 accuracy.
  • Downstream Tasks: Pruned ResNet-50 backbones using KDFS showed improved performance (e.g., +0.73% mAP for Faster-RCNN) and significant FLOPs reduction (34%) for object detection and instance segmentation.

Limitations and Future Work

  • Hyperparameter Sensitivity: While KDFS is generally robust, the paper notes that the balanced weights ($\lambda_1, \lambda_2, \lambda_3$) and temperature annealing schedule for the Gumbel-Softmax are important and require careful tuning, though they provide sensitivity analysis.
  • Decoder Complexity: The effectiveness of the MFM decoder is explored with one or two hidden layers, suggesting that deeper decoders might not always yield better results, possibly due to the difficulty of transferring rich knowledge.
  • Future Work: The paper implicitly suggests that further exploration of decoder architectures and more sophisticated knowledge transfer mechanisms could lead to even better pruning performance. The success on downstream tasks also opens avenues for applying KDFS to a wider range of computer vision applications.

Summary updated

BibTeX
@misc{lin2023filter,
  author = {Shaohui Lin and Wenxuan Huang and Jiao Xie and Baochang Zhang and Yunhang Shen and Zhou Yu and Jungong Han and David S. Doermann},
  title = {{Filter Pruning for Efficient CNNs via Knowledge-driven Differential Filter Sampler}},
  year = {2023},
  eprint = {2307.00198},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.00198},
}
Figure