Fast and Controllable Post-training Sparsity: Learning Optimal Sparsity Allocation with Global Constraint in Minutes

Ruihao Gong, Yang Yong, Zining Wang, Jinyang Guo, Xiuying Wei, Yuqing Ma, Xianglong Liu

Introduction

Deep Neural Networks (DNNs) are increasingly deployed on resource-constrained edge devices, necessitating efficient model compression techniques. While model sparsity—pruning unimportant weights—is a standard solution, it typically involves a trade-off between speed and performance. Training-aware pruning requires extensive retraining, while traditional post-training sparsity (PTS) often suffers from significant accuracy degradation at high sparsity levels. The primary bottleneck in PTS is the challenge of sparsity allocation: determining the optimal pruning ratio for each layer within a limited time and data budget.

Methodology: The FCPTS Framework

The authors propose FCPTS (Fast and Controllable Post-training Sparsity), a framework that treats sparsity allocation as a continuous optimization problem. Unlike previous heuristic-based or layer-wise approaches, FCPTS optimizes the entire network simultaneously using a differentiable mechanism.

The FCPTS framework integrates dense and sparse model comparison with a differentiable sparsity allocation module and a dual-objective loss function.

Differentiable Sparsity Allocation

The core innovation is the use of Kernel Density Estimation (KDE) to create a "differentiable bridge." Standard pruning thresholds are non-differentiable, preventing the use of gradient descent. By modeling the probability density of weights, FCPTS calculates the derivative of the sparsity rate with respect to the pruning threshold ($t$). This allows the model to "learn" the optimal threshold for every layer through standard backpropagation.

Controllable Sparsity Reconstruction

FCPTS employs a dual-objective loss function to maintain model integrity:

  1. Reconstruction Loss ($L_{rec}$): Uses KL-divergence to ensure the sparse model's output mimics the original dense model.
  2. Sparsity Control Loss ($L_c$): Acts as a global constraint, ensuring the total network sparsity hits a specific target (e.g., 80%) without requiring manual per-layer tuning.

Key Results and Performance

FCPTS demonstrates a significant breakthrough in maintaining accuracy at high sparsity rates. On ImageNet with a ResNet-50 architecture at 80% sparsity, FCPTS achieved 71.26% Top-1 accuracy, whereas the previous state-of-the-art method (POT) collapsed to 17.03%.

Accuracy comparison across different sparsity rates shows FCPTS (Ours) maintaining high performance even at 90% sparsity, significantly outperforming baselines like POT and ProbMask.

Beyond accuracy, the framework is remarkably efficient. It can generate a sparse ResNet-18 on ImageNet in just 29 minutes on a single GPU—a 3x speedup over competing methods. Hardware tests on an Ambarella CV22 autonomous driving chip showed that a 70% sparse ResNet-18 provided a 2.4x speedup and 50% memory savings compared to its dense counterpart.

Conclusion

FCPTS provides a "plug-and-play" solution for rapid model deployment. By transforming sparsity allocation into a differentiable optimization task with global constraints, it enables high-accuracy pruning in minutes rather than days. While currently focused on unstructured pruning, the underlying differentiable bridge concept offers a promising path toward optimizing structured pruning for general-purpose hardware in the future.

Summary updated

BibTeX
@inproceedings{gong2024fast,
  author = {Ruihao Gong and Yang Yong and Zining Wang and Jinyang Guo and Xiuying Wei and Yuqing Ma and Xianglong Liu},
  title = {{Fast and Controllable Post-training Sparsity: Learning Optimal Sparsity Allocation with Global Constraint in Minutes}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i11.29108},
}
Figure