Soft Masking for Cost-Constrained Channel Pruning

Ryan Humble, Maying Shen, Jorge Albericio Latorre, Eric Darve, José M. Álvarez · DOI

Abstract

Structured channel pruning is essential for deploying deep convolutional neural networks (CNNs) on resource-constrained edge devices. However, traditional methods often rely on "hard" pruning—permanently removing channels early in training—which can lead to suboptimal architectures and gradient instability at high compression ratios. This paper presents Soft Masking for cost-constrained Channel Pruning (SMCP), a novel framework that treats pruning as a global resource allocation problem. By utilizing soft masking with a Straight-Through Estimator (STE) and a specialized Batch Normalization (BN) scaling technique, SMCP allows pruned channels to adaptively return to the network, ensuring stable training and state-of-the-art accuracy-latency tradeoffs.

Introduction

The deployment of high-performance CNNs on mobile phones and autonomous vehicles is often hindered by computational and memory constraints. Structured channel pruning addresses this by removing entire filters, resulting in direct hardware speedups without requiring specialized sparse kernels. Despite its popularity, channel pruning faces two significant hurdles: myopic decision-making and training divergence.

Existing "hard pruning" techniques zero out weights permanently. If a channel is erroneously removed early in the process, its capacity is lost, often leading to a "greedy" local optimum. Furthermore, at high pruning ratios (70-90%), the sudden loss of signal causes massive gradient spikes in Batch Normalization layers, leading to training instability. SMCP addresses these issues through a reversible masking strategy and a global optimization formulation.

Methodology

The SMCP framework is built upon three technical pillars designed to maintain flexibility and stability during the pruning process.

Soft Input Channel Masking and STE

Unlike traditional methods that delete weights, SMCP re-parameterizes weights using a mask variable. By employing a Straight-Through Estimator (STE), gradients are allowed to flow back even to masked (pruned) weights. This "soft" approach enables the network to "regrow" channels if they are deemed important later in training, effectively correcting early pruning mistakes.

Input-Oriented Pruning and BN Stability

A key insight of SMCP is the necessity of input-oriented pruning. In the standard Conv-BN-ReLU sequence, pruning output channels can lead to zero or infinite gradients due to the ReLU activation. By focusing on input channels, SMCP ensures that masked weights remain "alive" in the background, facilitating the soft masking strategy. To further stabilize training, the authors introduce a BN scaling technique that adjusts weights based on the fraction of remaining channels, preventing the exploding gradient problem common in aggressive compression.

Global Resource Allocation via MCKP

Rather than applying uniform pruning ratios across all layers, SMCP formulates the architecture search as a Multiple-Choice Knapsack Problem (MCKP). This global approach optimizes the entire network's configuration to maximize accuracy while strictly adhering to a predefined latency or FLOPs budget. This often results in aggressive pruning of early layers while preserving the capacity of deeper layers—a configuration that is difficult to achieve via manual heuristic tuning.

Experimental Results

The researchers evaluated SMCP across several benchmarks, including ImageNet (ILSVRC2012) and PASCAL VOC, using architectures such as ResNet50, ResNet101, and MobileNet-V1.

ImageNet Classification

On ResNet50, SMCP demonstrated superior efficiency compared to state-of-the-art methods like AutoSlim and MetaPruning. It achieved a 20% speedup at the same accuracy level as competitors, or a 0.6% accuracy improvement at equivalent inference speeds. Notably, a ResNet101 pruned by 50% outperformed a standard, unpruned ResNet50 by 1.6%, illustrating that intelligent pruning can make larger architectures more efficient than smaller native designs.

Object Detection

When applied to the SSD512 detector (ResNet50 backbone), SMCP produced a model 2.12x faster than the baseline. This pruned model exceeded the speed of the smaller SSD300 model while maintaining higher mean Average Precision (mAP), proving the method's efficacy beyond simple classification tasks.

Discussion and Limitations

While SMCP excels at channel pruning, the authors noted limitations regarding layer pruning (reducing network depth). The current mathematical formulation assumes a degree of layer independence that breaks down when entire layers are removed, leading to performance degradation. Future research may explore extending soft masking to N:M structured sparsity to leverage hardware-specific acceleration, such as that found in modern NVIDIA GPUs.

Conclusion

SMCP provides a robust solution for cost-constrained pruning by combining reversible soft masking with global optimization. By stabilizing the training of highly compressed models and allowing for adaptive architecture refinement, SMCP sets a new standard for efficient neural network design on edge hardware.

Summary updated

BibTeX
@inproceedings{humble2022soft,
  author = {Ryan Humble and Maying Shen and Jorge Albericio Latorre and Eric Darve and José M. Álvarez},
  title = {{Soft Masking for Cost-Constrained Channel Pruning}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=Hu1ti7gcyd},
}
Figure