AMC: AutoML for Model Compression and Acceleration on Mobile Devices

Yihui He, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, Song Han

Abstract

Model compression is an effective technique to efficiently deploy neural network models on mobile devices which have limited computation resources and tight power budgets. Conventional model compression techniques rely on hand-crafted features and require domain experts to explore the large design space trading off among model size, speed, and accuracy, which is usually sub-optimal and time-consuming. In this paper, we propose AutoML for Model Compression (AMC) which leverages reinforcement learning to efficiently sample the design space and can improve the model compression quality. We achieved state-of-the-art model compression results in a fully automated way without any human efforts. Under 4 $\times$ FLOPs reduction, we achieved 2.7% better accuracy than the hand-crafted model compression method for VGG-16 on ImageNet. We applied this automated, push-the-button compression pipeline to MobileNet-V1 and achieved a speedup of 1.53 $\times$ on the GPU (Titan Xp) and 1.95 $\times$ on an Android phone (Google Pixel 1), with negligible loss of accuracy.

Introduction

Deep neural networks are notoriously resource-hungry, making them difficult to deploy on mobile devices with limited memory, battery, and processing power. To fit these models, researchers use model compression—specifically "pruning," which involves removing redundant weights or channels. Traditionally, engineers relied on trial-and-error or simple rules of thumb (like pruning all layers by 50%). However, the design space is mathematically enormous and non-linear. Manual search is not only time-consuming but usually results in sub-optimal models that either sacrifice too much accuracy or do not provide enough speedup.

The AMC Framework

The authors propose an automated engine that treats model compression as a reinforcement learning (RL) problem. By replacing manual, "hand-crafted" heuristics with a hardware-aware search agent, AMC achieves significantly higher compression rates and faster inference speeds on mobile devices than human experts.

The AMC framework uses a DDPG agent to automate channel pruning, replacing labor-intensive manual heuristics.

Reinforcement Learning Agent

AMC utilizes a Deep Deterministic Policy Gradient (DDPG) agent. Unlike many architecture search methods that use discrete choices, DDPG allows for a continuous action space. This is crucial because pruning ratios (e.g., 32.5% vs 33%) are continuous, and fine-grained control is necessary to preserve accuracy. The agent processes the network layer-by-layer, receiving a "state" (features like layer index, channel count, and FLOPs) and outputting an "action" (the sparsity ratio).

Search Protocols

Two specific reward schemes were designed to handle different deployment needs:

  1. Resource-constrained: The agent maximizes accuracy within a hard budget (e.g., "The model must be 50% smaller").
  2. Accuracy-guaranteed: The agent finds the smallest possible model that maintains the original accuracy.

To ensure efficiency, the agent evaluates the "pruned-but-not-yet-fine-tuned" accuracy as a fast proxy for final performance, allowing the RL search to complete in just one hour on a single GPU.

Key Results

AMC was evaluated across several standard benchmarks, including CIFAR-10, ImageNet, and PASCAL VOC. The results consistently showed that automated pruning outperforms human-designed policies.

Performance comparison of AMC against hand-crafted pruning policies (deep, shallow, and uniform) across various architectures.
  • VGG-16 (ImageNet): Under a 4x FLOPs reduction, AMC achieved 2.7% better accuracy than the best hand-crafted pruning methods.
  • MobileNet-V1: Despite being highly optimized, AMC achieved a 1.53x speedup on a Titan Xp GPU and a 1.95x speedup on an Android phone (Google Pixel 1) with negligible accuracy loss.
  • ResNet-50: AMC pushed the compression limit from the human-expert-tuned 3.4x to 5x compression without any loss in accuracy.

Discussion and Insights

A key advantage of AMC is its Hardware-Awareness. While most compression papers focus on reducing FLOPs, AMC can optimize directly for latency on specific hardware. Because some operations run faster on mobile CPUs than others regardless of FLOP count, AMC learns to prune in a way that actually speeds up the device. Furthermore, AMC automatically discovers architectural efficiencies; for example, when compressing ResNet-50, it learned to prune $3 \times 3$ convolutions more aggressively than $1 \times 1$ convolutions, effectively "discovering" the efficiency of bottleneck architectures on its own.

Conclusion

AMC demonstrates that reinforcement learning can effectively automate the complex task of model compression. By leveraging a continuous action space and hardware-aware rewards, it provides a "push-the-button" solution that surpasses human expertise in both efficiency and final model performance. Future work may involve combining this automated pruning with other techniques like quantization or applying it to Transformer-based architectures.

Summary updated

BibTeX
@inproceedings{he2018amc,
  author = {Yihui He and Ji Lin and Zhijian Liu and Hanrui Wang and Li-Jia Li and Song Han},
  title = {{AMC: AutoML for Model Compression and Acceleration on Mobile Devices}},
  booktitle = {European Conference on Computer Vision},
  year = {2018},
  url = {https://openreview.net/forum?id=ByW8ot-ubB},
}
Figure