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

CompactNet: Platform-Aware Automatic Optimization for Convolutional Neural Networks

Weicheng Li, Rui Wang, Zhongzhi Luan, Di Huang, Zidong Du, Yunji Chen, Depei Qian

TL;DR

CompactNet is an automated, platform-aware framework that optimizes pre-trained Convolutional Neural Networks (CNNs) for specific resource-constrained hardware. By combining a hardware-validated latency simulator with an iterative filter-pruning loop, it delivers up to a 1.8x inference speedup on mobile CPUs and NPUs while maintaining or even improving model accuracy.

What Problem Does This Paper Address?

Deploying deep learning models on edge devices like smartphones is notoriously difficult due to strict latency and memory constraints. While network compression techniques like weight pruning exist, they are rarely "platform-aware." A model architecture that runs blindingly fast on a desktop GPU might crawl on a mobile NPU due to differences in hardware parallelism, memory bandwidth, and toolchain configurations.

Manually tailoring a CNN for a specific hardware backend requires deep, proprietary knowledge of the hardware architecture, which is rarely accessible to software engineers. CompactNet addresses this gap by treating the hardware as a black box, automatically generating optimal, platform-specific models based on a user-defined inference speedup target.

Methods

CompactNet consists of two primary components operating in a closed loop: a General and Adaptable Platform Simulator and an Automatic Searching Algorithm.

Figure 1: Framework of CompactNet.
  1. Platform Simulator: Instead of modeling complex hardware microarchitectures, the simulator empirically measures the actual kernel computation latency of individual convolutional layers with varying numbers of input and output channels directly on the target device. The total latency of a pruned candidate model is then estimated by simply summing the pre-measured latencies of its constituent layers.
Figure 2: Illustration of collecting latency data by the simulator and using it to simulate the kernel computation of a certain trimmed model as the one in Table 2.
  1. Searching Algorithm & Trimming: The framework breaks the overall speedup target into $N$ iterations, each with a progressively decaying sub-target. During each iteration, CompactNet generates candidate models by systematically removing entire filters (structured pruning) from each trimmable layer, prioritizing those with the smallest L2-norm magnitude. The candidate model that retains the highest validation accuracy while meeting the iteration's speedup sub-target is selected and fine-tuned for the next round.
Figure 3: Searching Loop inside CompactNet. We break the target speedup into N iterations and each of the iterations has a sub-target. Overall (left), we progressively trim the model until finishing the last iteration when the target speedup is reached. For each iteration (right), guided by the simulated latency, we generate k candidate models satisfying the sub-target where k is the number of trimmable layers in the model and select the one with the highest accuracy. In one iteration, we essentially trim only the one layer that loses the least accuracy to satisfy the sub-target.

Datasets

The authors evaluated CompactNet using the standard CIFAR-10 dataset (50,000 training images, 10,000 validation images) to optimize a pre-trained MobileNetV2 architecture.

Key Insights and Ideas

  • Optimal Architectures are Hardware-Dependent: The most striking finding is that the "optimal" pruned architecture for a given speedup target looks completely different on an ARM mobile CPU than it does on a dedicated Machine Learning Network Processing Unit (NPU). When the authors cross-deployed the CPU-optimized model onto the NPU, it failed to meet the speedup target, proving that hardware-agnostic optimization is fundamentally sub-optimal.
  • Late-Stage Redundancy: For image classification on CIFAR-10, CompactNet aggressively pruned the final layers of MobileNetV2, indicating that the massive channel expansion at the end of standard architectures contains significant redundancy for simpler datasets.

Key Results

The framework was evaluated on a Huawei Mate10 smartphone across two hardware backends: an ARM mobile CPU and a Cambricon-1A NPU accelerator.

  • Mobile CPU: CompactNet achieved a 1.5x speedup while actually increasing Top-1 accuracy from 71.98% to 72.12%. At a more aggressive 1.8x speedup target, it maintained a high accuracy of 71.59%, outperforming state-of-the-art frameworks like NetAdapt, MorphNet, and ADC.
Figure 4: Number of filters per layer in the original MobileNetV2 and optimal models for mobile CPU generated by CompactNet.
  • NPU Accelerator: CompactNet successfully delivered a 1.3x speedup (with an accuracy bump to 72.56%) and a 1.5x speedup (71.68% accuracy) on the specialized hardware.
Figure 5: Number of filters per layer in original MobileNetV2 and op- timal models for the NPU accelerator generated by CompactNet.
  • Simulator Accuracy: The empirical layer-summation method proved highly accurate, closely matching the real-world execution latency measured on the physical device.

Limitations and Future Work

While highly effective, the paper notes a few areas for expansion:

  • Pruning Strategy: The core framework currently relies on a simple magnitude-based (L2-norm) filter selection strategy. The authors note that more sophisticated pruning methods, such as reinforcement learning for fine-grained channel selection, could be integrated into the CompactNet framework to yield even better results.
  • Scope of Latency: The simulator focuses strictly on kernel computation latency. It does not explicitly account for broader system-level overheads like data transfer or OS scheduling, though the experimental validation shows it serves as an excellent proxy.

Summary updated

BibTeX
@inproceedings{li2019compactnet,
  author = {Weicheng Li and Rui Wang and Zhongzhi Luan and Di Huang and Zidong Du and Yunji Chen and Depei Qian},
  title = {{CompactNet: Platform-Aware Automatic Optimization for Convolutional Neural Networks}},
  booktitle = {Pmam@ppopp},
  year = {2019},
  doi = {10.1145/3448290.3448560},
}
Figure