Learning Sparsity and Quantization Jointly and Automatically for Neural Network Compression via Constrained Optimization

Haichuan Yang, Shupeng Gui, Yuhao Zhu, Ji Liu

Abstract

Deploying deep neural networks (DNNs) on edge devices requires significant model compression. Traditional methods treat pruning and quantization as separate, manually-tuned hyperparameters. This paper introduces a framework that automatically compresses DNNs by jointly optimizing for sparsity and bit-precision under a fixed size budget. By formulating compression as a constrained optimization problem solved via the Alternating Direction Method of Multipliers (ADMM), the approach achieves state-of-the-art size reductions—up to 836× for ResNet-50—without accuracy loss.

Introduction

The deployment of state-of-the-art DNNs on resource-constrained hardware like smartphones and IoT sensors is limited by memory and computational power. Two primary techniques for compression are pruning (removing connections) and quantization (reducing bit-precision). However, determining the optimal sparsity and bit-width for each layer is a complex combinatorial problem. Previous automated attempts using Reinforcement Learning (RL) or Evolutionary Search (ES) are computationally expensive and introduce additional hyperparameters. This work proposes a mathematically principled, end-to-end optimization framework to automate this process.

Methodology: Joint Optimization via ADMM

The authors frame model compression as a constrained optimization problem: minimize the network loss $\ell(W)$ subject to a total size budget $S_{budget}$.

Overview of the joint pruning and quantization framework using ADMM.

To solve this, they employ the Alternating Direction Method of Multipliers (ADMM). ADMM decouples the non-differentiable constraints from the standard training process by introducing auxiliary variables and alternating between three steps:

  1. Weight Update ($W$): A standard gradient descent step modified by a penalty term to keep $W$ close to the constrained variable $V$.
  2. Projection Step ($V$): Projecting the weights onto the feasible set defined by the size budget. This is the core innovation, where the authors map the sub-problems to classical combinatorial optimization:
  3. Pruning is treated as a 0-1 Knapsack Problem, selecting weights that maximize "profit" (importance) within the size "weight" (budget).
  4. Quantization is treated as a Multiple-Choice Knapsack Problem (MCKP), selecting the optimal bit-width for each layer to balance accuracy and size.
  5. Dual Variable Update ($y$): Updating the Lagrange multipliers to enforce the constraint $W = V$.

Experimental Results

The framework was evaluated on MNIST (LeNet-5), CIFAR-10 (ResNet-20/50), and ImageNet (AlexNet, MobileNet, MnasNet, ProxylessNAS).

Convergence and Robustness

The optimization process is robust to the choice of the penalty parameter $\rho$. As shown in the convergence plots, the Mean Squared Error (MSE) between the weights $W$ and the constrained weights $V$ decreases over time, and the loss stabilizes, indicating successful convergence to a compressed model that satisfies the budget.

Convergence of loss and MSE(W, V) for different values of the penalty parameter $\rho$.

Compression Performance

The method achieves aggressive compression rates with negligible to no accuracy loss:

  • ResNet-50 (CIFAR-10): 836× reduction in size with 0.0% accuracy loss.
  • AlexNet (ImageNet): 205× reduction with no accuracy loss, outperforming CLIP-Q (119×) and Ye et al. (210× with accuracy degradation).
  • MobileNet (ImageNet): 26.7× compression, significantly better accuracy than Hardware-Aware Quantization (HAQ).
  • LeNet-5 (MNIST): 2,120× compression.

Discussion

A key insight is that joint optimization is superior to sequential application of pruning and quantization. The algorithm automatically discovers the optimal trade-off between sparsity and precision for each layer. For instance, it may choose higher precision for sensitive convolutional layers while applying aggressive pruning and low-bit quantization to fully connected layers. Unlike RL-based methods, this approach integrates directly into the training loop, making it more efficient and easier to deploy.

Conclusion and Future Work

While the framework provides a powerful tool for size-constrained compression, it currently optimizes for raw model size. Future work could extend this to hardware-specific metrics like latency or energy consumption, which are not always perfectly correlated with model size due to overheads in sparse indexing and hardware-specific execution patterns.

Summary updated

BibTeX
@misc{yang2019learning,
  author = {Haichuan Yang and Shupeng Gui and Yuhao Zhu and Ji Liu},
  title = {{Learning Sparsity and Quantization Jointly and Automatically for Neural Network Compression via Constrained Optimization}},
  year = {2019},
  eprint = {1910.05897},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.05897},
}
Figure