Discrete Model Compression With Resource Constraint for Deep Neural Networks

Shangqian Gao, Feihu Huang, Jian Pei, Heng Huang

Abstract

Structural pruning is a critical technique for deploying deep neural networks on resource-constrained devices. However, traditional methods often suffer from a "discreteness gap" between continuous importance scores used during training and the binary pruning decisions made at deployment. This paper introduces Discrete Model Compression (DMC), a framework that utilizes differentiable discrete gates to optimize sub-networks directly. By employing a straight-through estimator and a novel resource-constrained loss function, DMC achieves significant FLOPs reduction while maintaining or even improving model accuracy across standard benchmarks like CIFAR-10 and ImageNet.

Introduction

Deep Convolutional Neural Networks (CNNs) have achieved state-of-the-art performance in various computer vision tasks but at the cost of high computational complexity and memory footprint. This makes their deployment on mobile and edge devices challenging. Structural pruning, specifically channel pruning, offers a solution by removing entire filters, thereby reducing the model size and accelerating inference without requiring specialized hardware support.

Despite its benefits, structural pruning faces two primary challenges. First, the transition from continuous importance scores to discrete binary masks often introduces a performance gap. Second, manually determining the optimal pruning rate for each layer is a combinatorial problem that is difficult to solve efficiently.

Discrete Model Compression (DMC)

The proposed DMC framework addresses these issues by treating pruning as a differentiable optimization problem over discrete variables.

Differentiable Discrete Gates

DMC attaches a learnable gate to each channel. The gate function $g(\theta)$ is defined as a step function: if a learnable parameter $\theta$ is $\ge 0.5$, the channel is open ($1$); otherwise, it is closed ($0$). To enable gradient-based optimization of this non-differentiable function, the authors utilize a Straight-Through Estimator (STE). During the backward pass, the gradient is passed directly to $\theta$, allowing the model to learn which channels are essential for the task.

The DMC framework illustrates the sampling of sub-networks using stochastic discrete gates and the update process via STE.

Stochastic Exploration and Resource Constraint

To avoid local minima, DMC employs a stochastic version of the gate during training, enabling the exploration of various sub-network configurations. Furthermore, a global resource regularization term is introduced to guide the model toward a target FLOPs budget. Instead of per-layer pruning rates, a single global hyper-parameter is used. The authors propose a log-based loss function, $R_{log}(x, y) = \log(|x - y| + 1)$, which provides robust gradient signals to enforce the complexity constraint exactly at the target budget.

Experimental Evaluation

The effectiveness of DMC was evaluated on CIFAR-10 and ImageNet datasets using popular architectures such as ResNet and MobileNetV2.

Performance on ImageNet

On the ImageNet dataset, DMC demonstrated superior performance compared to state-of-the-art methods. For ResNet-101, DMC achieved a 56% reduction in FLOPs while slightly increasing the Top-1 accuracy by 0.03%. This suggests that the pruning process can act as a regularizer, removing redundant or noisy features.

In the case of MobileNetV2, which is already highly optimized, DMC reduced FLOPs by 46% with a minimal Top-1 accuracy drop of 3.51%. This significantly outperforms previous methods like DCP and CCP, which often see larger accuracy degradations on compact models.

Implementation Details

The placement of gates is crucial for maintaining the structural integrity of the network, especially in models with residual connections. In Bottleneck blocks, gates are typically placed after the first $1 \times 1$ convolution and the $3 \times 3$ convolution. In Inverted Residual blocks, gates are shared across layers to ensure compatibility with the shortcut connections.

Gate placement strategies for Bottleneck and Inverted Residual blocks to handle residual connections and weight sharing.

Conclusion

Discrete Model Compression (DMC) provides a robust and efficient framework for structural pruning. By bridging the "discreteness gap" with differentiable gates and enforcing global resource constraints, it automates the discovery of efficient sub-networks. The method's ability to maintain accuracy even under aggressive compression makes it a valuable tool for deploying deep learning models in real-world, resource-limited environments. Future work may explore extending this discrete gating mechanism to broader Neural Architecture Search (NAS) tasks.

Summary updated

BibTeX
@inproceedings{gao2020discrete,
  author = {Shangqian Gao and Feihu Huang and Jian Pei and Heng Huang},
  title = {{Discrete Model Compression With Resource Constraint for Deep Neural Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00197},
}
Figure