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.
- 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.
- 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.
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.
- 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.
- 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