Differentiable Network Pruning for Microcontrollers

Edgar Liberis, Nicholas D. LanearXiv 2021 · DOI

TL;DR

This paper introduces a novel "differentiable network pruning" technique specifically designed to create highly compressed neural networks for resource-constrained microcontrollers (MCUs). By integrating MCU-specific resource usage (like memory and latency) directly into the pruning process, they achieve significant model compression (up to 80x) while maintaining or even improving accuracy, making on-device AI more feasible for a wider range of IoT applications.

What Problem Does This Paper Address?

Modern deep learning models are incredibly powerful but also computationally demanding, requiring significant storage, memory, and processing power. This makes them unsuitable for embedded devices like microcontrollers (MCUs), which are the backbone of the Internet of Things (IoT). MCUs have orders of magnitude less resources than typical computing platforms (e.g., smartphones or servers). Consequently, applications requiring on-device AI often have to offload computation to more powerful devices, leading to increased latency, reliance on network connectivity, and privacy concerns. Existing model compression techniques, while effective for larger platforms, often don't adequately address the unique constraints of MCUs, particularly their extremely limited RAM and Flash storage. This paper aims to bridge this gap by developing a specialized pruning method that directly targets these MCU-specific resource limitations.

Methods

The core of this work is a differentiable structured network pruning method. Here's a breakdown of the key techniques:

  • Structured Pruning: Instead of removing individual weights (unstructured pruning), this method removes entire feature maps or channels. This results in dense models that are more compatible with existing microcontroller deep learning frameworks.
  • Differentiable Optimization: The pruning process is integrated into the training loop using gradient descent. This allows for iterative pruning and learning of layer sizes simultaneously, minimizing the need for separate fine-tuning steps and reducing overhead.
  • MCU-Specific Resource Objectives: The novelty lies in incorporating differentiable objectives that directly model MCU constraints:
  • Model Size: Minimizing the total storage required for network weights.
  • Latency (MACs): Minimizing the number of multiply-accumulate operations, a proxy for inference speed.
  • Peak Memory Usage (PMU): This is a crucial and challenging objective. The authors use an accurate dynamic programming approach to calculate the minimum peak memory required by the network, considering layer execution order, which is critical for fitting within limited SRAM.
  • Budgeted Pruning: The method uses these resource objectives as "budgets" that the pruning process aims to satisfy.
  • Iterative Pruning: Pruning is performed iteratively throughout training, allowing the model to adapt and recover accuracy more effectively than post-training pruning.
  • Channel Importance: Pruning decisions are guided by channel salience, derived from batch normalization scaling coefficients or L2 norms of weights, ensuring that less important channels are removed first.

Datasets

The paper evaluates its methodology on several standard datasets commonly used for benchmarking embedded systems and computer vision tasks:

  • Speech Commands: For keyword spotting.
  • Visual Wake Words (VWW): For person detection.
  • CIFAR-10: A common image classification benchmark.
  • ImageNet: For image classification.

The authors note that these datasets are suitable for microcontrollers and represent real-world sensing applications.

Key Insights and Ideas

  • MCU Constraints are Unique: The paper strongly emphasizes that MCU resource limitations (especially peak memory usage) are fundamentally different from those on larger platforms and require specialized solutions.
  • Accurate Peak Memory Usage is Crucial: Using an imprecise approximation for peak memory usage can lead to models that violate actual memory budgets, even if the objective is met during training. The precise dynamic programming approach is essential.
  • Combined Task and Resource Objectives are Necessary: Pruning solely based on task accuracy (ignoring resources) or solely on resource usage (ignoring accuracy) leads to suboptimal results. Both are required for highly compressed, accurate models.
  • Pruning is More Efficient than Uniform Scaling: Differentiable pruning can achieve better accuracy-resource trade-offs than simply scaling network layers uniformly, as it allows for layer-wise adjustments.
  • Early Termination Can Save Training Time: Pruning can be stopped once resource budgets are met, potentially reducing overall training computation without significant accuracy loss.

Key Results

  • Significant Compression: The methodology achieves substantial improvements in key resource usage, with models compressed up to 80x compared to original models.
  • Improved Resource Usage: Compressed models show up to 40% better resource usage compared to prior MCU-specific methods.
  • Competitive Performance: The pruned models achieve comparable or better classification accuracy than baseline methods, often with significantly reduced resource footprints.
  • Faster Compression: The iterative, during-training pruning approach results in negligible overhead and can even accelerate training time compared to traditional NAS methods.
  • Viable Deployment: Deployed models on MCU development boards (NUCLEO-F767ZI and NUCLEO-H743ZI2) demonstrated viable inference times (10s-100s ms) and energy usage (10s-100s mJ), confirming practical applicability.
  • Low Hyperparameter Sensitivity: The method shows low sensitivity to the choice of hyperparameters (resource/task loss weights and learning rate), making it more robust and easier to use.

Limitations and Future Work

  • Hyperparameter Tuning: While the method is shown to be robust, finding the absolute optimal hyperparameters might still require some experimentation, though the paper suggests practical starting points.
  • Task-Specific Adaptation: While the paper suggests the methodology is task-agnostic, further exploration on a wider variety of complex, real-world tasks could be beneficial.
  • Future Work: The authors suggest that differentiable pruning is broadly applicable to many "smart" embedded systems and could be a valuable tool for domain experts to easily integrate on-device deep learning without extensive ML expertise. They also highlight the potential for further optimization by exploring different quantization schemes or more advanced pruning techniques.

Summary updated

BibTeX
@misc{liberis2021differentiable,
  author = {Edgar Liberis and Nicholas D. Lane},
  title = {{Differentiable Network Pruning for Microcontrollers}},
  year = {2021},
  eprint = {2110.08350},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.08350},
}
Figure