EAPruning: Evolutionary Pruning for Vision Transformers and CNNs

Qingyuan Li, Bo Zhang, Xiangxiang Chu · DOI

Introduction

As deep learning models continue to scale in size and complexity, deploying them on resource-constrained environments—such as mobile devices or IoT hardware—remains a significant challenge. High computational costs and power consumption often necessitate model compression. Structured pruning, which involves removing entire filters or channels, is a primary strategy for creating leaner, more efficient models. However, current pruning methodologies often suffer from architecture-specific designs, high expertise requirements for hyperparameter tuning, and prohibitive computational costs during the search for optimal sub-networks.

To address these challenges, this paper introduces EAPruning, a unified and efficient framework that leverages evolutionary algorithms to prune both Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs). By replacing traditional, slow iterative fine-tuning with a rapid weight reconstruction technique, EAPruning achieves significant speedups and FLOPs reduction with negligible impact on accuracy.

Methodology

EAPruning treats the pruning process as an evolutionary search problem, seeking the most efficient sub-network structure within a defined search space. The framework consists of several key innovations:

1. Coarse Search Space

Rather than utilizing a fine-grained "keep/drop" mask for every individual channel—which would result in an exponentially large search space—EAPruning employs a coarse-grained approach. For CNNs, the algorithm encodes the number of channels per layer. For ViTs, it focuses on the number of attention heads and the MLP expansion ratios. This simplification makes the search process significantly more manageable while still allowing for high-performance architectures.

2. Fast Weight Reconstruction

A major bottleneck in pruning is the "performance collapse" that occurs immediately after removing weights. Standard methods combat this with expensive fine-tuning for every candidate sub-network. EAPruning introduces a least-squares weight reconstruction (linear regression) technique. This method adjusts the remaining weights so that the layer's output feature maps match the original, unpruned layer as closely as possible. This reconstruction is orders of magnitude faster than fine-tuning, allowing the search to evaluate thousands of candidates in hours rather than days.

3. Multi-Objective Evolution (NSGA-III)

The framework utilizes the NSGA-III algorithm to evolve a population of sub-networks. This multi-objective approach allows the system to identify a "Pareto front"—a set of optimal models representing various trade-offs between accuracy and computational complexity (FLOPs)—in a single evolutionary run.

4. Random Channel Selection

An interesting finding of the study is that the specific identity of the channels kept is less critical than the overall architectural structure (the total number of channels). Consequently, EAPruning simply samples channels randomly to reach the target count determined by the evolutionary search, reinforcing the idea that the discovered "shape" of the network is the primary driver of performance.

Experimental Results

The authors benchmarked EAPruning primarily on the ImageNet dataset. To maintain efficiency, the evolutionary phase uses small subsets (1.5k to 3k images) for weight reconstruction and a 5k-image subset for proxy evaluation. Final models are then fine-tuned on the full dataset to recover peak accuracy.

Performance Benchmarks

EAPruning demonstrates state-of-the-art trade-offs across diverse architectures:

  • ResNet50: Achieved a 50% reduction in FLOPs with only a 0.3% loss in Top-1 accuracy, translating to a 1.37x real-world speedup on an NVIDIA A30 GPU.
  • MobileNetV1: Delivered a 1.34x speedup with minimal accuracy impact, outperforming specialized methods like AMC.
  • DeiT-Base (Vision Transformer): Reached nearly 40% FLOPs reduction and a 1.4x speedup with only a 0.5% drop in Top-1 accuracy.

In terms of search efficiency, the entire process for a single model takes approximately 3.17 GPU hours on an NVIDIA A100, during which roughly 1,500 sub-network candidates are evaluated.

Key Insights and Structural Patterns

The research yields several critical insights into the nature of model pruning:

  • Structure > Weights: The results support the "Rethinking Pruning" philosophy, suggesting that the architectural "shape" discovered during search is more vital than the specific values of inherited weights.
  • The "Double-Hump" Importance in ViTs: When analyzing pruned ViTs, the algorithm consistently prioritized keeping middle layers while pruning the last and first layers more aggressively. This suggests that middle projection layers are the most critical for maintaining classification accuracy in Transformers.
  • Heads vs. Dimensions: For ViTs, the authors found that pruning the number of attention heads is more effective for maintaining performance than shrinking the internal dimension of each head.

Conclusion and Future Work

EAPruning provides a robust, automated, and unified framework for model compression across CNNs and ViTs. While the search process is highly efficient, the final sub-networks still require a standard retraining phase to reach maximum accuracy. Future research may explore more flexible embedding pruning for large ViTs and broader testing on mobile-specific hardware (CPUs/DSPs) to further validate the real-world utility of the discovered structures.

Summary updated

BibTeX
@inproceedings{li2022eapruning,
  author = {Qingyuan Li and Bo Zhang and Xiangxiang Chu},
  title = {{EAPruning: Evolutionary Pruning for Vision Transformers and CNNs}},
  booktitle = {BMVC},
  year = {2022},
  url = {https://openreview.net/forum?id=e6fpu3VTcd},
}
Figure