NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CPrune: Compiler-Informed Model Pruning for Efficient Target-Aware DNN Execution

Taeho Kim, Yongin Kwon, Jemin Lee, Sangtae Ha

Abstract

Mobile devices run deep learning models for various purposes, such as image classification and speech recognition. Due to the resource constraints of mobile devices, researchers have focused on either making a lightweight deep neural network (DNN) model using model pruning or generating an efficient code using compiler optimization. Surprisingly, we found that the straightforward integration between model compression and compiler auto-tuning often does not produce the most efficient model for a target device. We propose CPrune, a compiler-informed model pruning for efficient target-aware DNN execution to support an application with a required target accuracy. CPrune makes a lightweight DNN model through informed pruning based on the structural information of subgraphs built during the compiler tuning process. Our experimental results show that CPrune increases the DNN execution speed up to 2.73x compared to the state-of-the-art TVM auto-tune while satisfying the accuracy requirement.

The Blind Spot in Model Optimization

To run Deep Neural Networks (DNNs) on resource-constrained mobile devices, researchers typically use two separate toolboxes: model compression (pruning or quantizing the network) and compiler optimization (using tools like Apache TVM to auto-tune code for specific hardware).

However, a critical "blind spot" exists: the best-pruned model is often not the fastest model after compilation. Standard pruning methods use indirect metrics like FLOPs or pre-optimization execution speed to decide which neurons to cut. Compilers, however, optimize code based on specific hardware-aware subgraphs. If pruning destroys a structure that the compiler was particularly good at optimizing, the final "optimized" model might actually be slower than a version that had more parameters but a more "compiler-friendly" layout.

The paradox of model pruning: the best-pruned model (A) is often outperformed by a seemingly suboptimal model (B) after compiler optimization.

The CPrune Framework

CPrune introduces a joint optimization loop that makes pruning "compiler-aware." Instead of pruning then compiling, it prunes based on what the compiler discovers during its tuning phase. The framework consists of five key stages that bridge the gap between model structure and hardware execution.

The CPrune framework architecture, illustrating the iterative joint optimization loop between model pruning and compiler tuning.

Key Methodology

  • Task and Subgraph Mapping: CPrune builds a relationship table between the DNN's subgraphs and the "tasks" the compiler creates for the target hardware.
  • Informed Task Ordering: It prioritizes pruning tasks with the highest "pruning impact"—a metric calculated by multiplying the task's execution time by the frequency of that subgraph structure in the model.
  • Structure-Preserving Pruning: When deciding how many filters to prune, CPrune analyzes the "fastest program" found by the compiler's auto-tuner. It uses the Least Common Multiple (LCM) of the filter arrangement shapes to ensure that the remaining filters still fit the parallel processing patterns (e.g., vector widths of 4, 8, or 16) the compiler prefers.
  • Iterative Refinement: The process is iterative—pruning, checking accuracy and speed, and repeating until the target accuracy is reached.

Key Insights

  • The "Suboptimal is Optimal" Paradox: A model that looks suboptimal immediately after pruning can become the best after the compiler applies its hardware-specific magic.
  • Compilers Love Patterns: Execution time doesn't decrease linearly with the number of filters. It often drops in "steps" because hardware and compilers are optimized for specific vector widths. CPrune exploits this by pruning in steps that match the compiler's preferred structures.
  • Global Subgraph Pruning: Instead of pruning one layer at a time, CPrune prunes all subgraphs associated with a specific compiler task simultaneously, significantly speeding up the optimization process.

Experimental Results

The researchers evaluated CPrune using ImageNet and CIFAR-10 benchmarks across various mobile hardware, including the Samsung Galaxy S8, S9, S20+, and Google Pixel 3 XL. CPrune consistently outperformed both standard compiler tuning and hardware-aware pruning frameworks like NetAdapt:

  • Speedups: Achieved up to a 2.73x speedup on MobileNetV2 (Kryo 385) compared to standard TVM auto-tuning.
  • Efficiency vs. NetAdapt: On ResNet-18, CPrune achieved a 1.96x speedup, outperforming NetAdapt (1.86x) while maintaining similar accuracy levels.
  • Cross-Platform Success: The benefits were consistent across different mobile CPUs and GPUs, proving that the compiler-informed approach is hardware-agnostic in its logic but hardware-specific in its results.

Conclusion and Future Work

CPrune demonstrates that hardware-aware pruning must account for the compiler's role in the final execution. While the current results focus on Convolutional Neural Networks (CNNs), future work could explore applying this compiler-informed approach to Transformers or Recurrent Neural Networks. Additionally, combining this method with quantization (reducing bit-precision) could yield even greater efficiency gains for mobile deep learning deployment.

Summary updated

BibTeX
@inproceedings{kim2022cprune,
  author = {Taeho Kim and Yongin Kwon and Jemin Lee and Taeho Kim and Sangtae Ha},
  title = {{CPrune: Compiler-Informed Model Pruning for Efficient Target-Aware DNN Execution}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=CKJmKWNsD_6},
}
Figure