Soft Threshold Weight Reparameterization for Learnable Sparsity

Aditya Kusupati, Vivek Ramanujan, Raghav Somani, Mitchell Wortsman, Prateek Jain, Sham M. Kakade, Ali Farhadi

Deep Neural Networks (DNNs) are powerful, but they are also notoriously "heavy." Deploying a state-of-the-art model on a smartphone or an IoT sensor often requires significant compression to fit within memory and power constraints. While sparsity (pruning unnecessary weights) is a popular solution, most existing methods rely on "gut feelings"—heuristics or uniform rules about which layers should be pruned and by how much.

In their ICML 2020 paper, researchers introduce Soft Threshold Weight Reparameterization (STR). Instead of telling the network how sparse to be, STR allows the network to learn its own optimal, non-uniform sparsity budget across different layers using standard backpropagation.

TL;DR

STR uses a differentiable soft-thresholding operator to let neural networks learn layer-specific pruning thresholds during training. This approach achieves state-of-the-art accuracy for unstructured sparsity—notably boosting accuracy by up to 10% in the "ultra-sparse" (99%) regime—while simultaneously cutting inference costs (FLOPs) by up to 50% compared to traditional methods.

What Problem Does This Paper Address?

The standard approach to model pruning usually involves one of two paths:

  1. Uniform Sparsity: Every layer is pruned to the same percentage (e.g., 90% sparse). This is easy but sub-optimal because some layers are more critical than others.
  2. Heuristic Non-Uniform Sparsity: Researchers use "common wisdom" to decide which layers to prune more aggressively. For example, many believe initial layers should stay dense to avoid losing raw input information.

The gap here is learnability. We want a stable, automated way to determine the "sparsity budget" for each layer. If a layer is redundant, the network should prune it heavily; if it's vital, it should stay dense. Current methods that try to learn this often involve complex reinforcement learning or non-differentiable operations that are difficult to optimize.

Methods

The core of STR is a clever reparameterization of the weights. Instead of training the weights $W$ directly, the authors train the weights through a soft-threshold operator:

$$S_g(w, s) = \text{sign}(w) \cdot \text{ReLU}(|w| - g(s))$$

Here’s the breakdown:

  • $s$ is a learnable parameter: Each layer has its own $s$.
  • $g(s)$ is the threshold: This function (typically a Sigmoid or Exponential) transforms $s$ into a pruning threshold $\alpha$.
  • The "Pruning" Mechanism: If the magnitude of a weight $|w|$ is less than the threshold $\alpha$, the weight becomes exactly zero. If it's larger, it's slightly reduced ("shrunk") toward zero.

Because this operator is differentiable (or has a well-defined sub-gradient), the network can use gradient descent to update both the weights and the thresholds simultaneously. If the loss decreases by making a layer sparser, the optimizer will naturally increase that layer's threshold.

Key Insights and Ideas

  • Challenging Conventional Wisdom: Most heuristics suggest keeping initial layers dense. STR found the opposite: it often prunes initial and middle layers more aggressively. Since initial layers process the highest-resolution images, pruning them leads to massive savings in FLOPs (Floating Point Operations) without sacrificing much accuracy.
FLOPs per layer
  • The "Ultra-Sparse" Frontier: At 99% sparsity, most models fall apart. STR maintains surprisingly high accuracy here (e.g., ~50% top-1 on ResNet50), outperforming the standard Gradual Magnitude Pruning (GMP) by 10%.
Accuracy vs Sparsity
  • Automatic Budgeting: STR doesn't require a global sparsity constraint. The overall sparsity is controlled by the weight decay parameter ($\lambda$). A higher $\lambda$ pushes the network toward higher global sparsity, but the network decides how to distribute that sparsity across layers.
  • Transferable Backbones: The non-uniform sparsity budgets learned by STR on one task can be transferred to other methods (like DNW or GMP), improving their performance as well.

Key Results

  • MobileNetV1: On ImageNet, STR achieved 90% sparsity with a 0.3% boost in accuracy while using 50% fewer FLOPs than the leading baseline.
  • ResNet50: STR consistently formed a "frontier curve," providing the best accuracy-to-FLOPs trade-off across all sparsity regimes (80% to 99%).
  • RNNs (FastGRNN): When applied to induce low-rank structures on the Google-12 speech dataset, STR outperformed vanilla training by up to 2.47% in accuracy while reducing model size by 50-70%.

Limitations and Future Work

The authors note a few challenges:

  • Hyperparameter Sensitivity: The final sparsity level is sensitive to the weight decay ($\lambda$) and the initialization of the threshold parameters ($s_{init}$). Finding the exact target sparsity (e.g., exactly 90.00%) requires some tuning.
  • Optimization Dynamics: While the thresholds are learnable, the "speed" of learning depends on the choice of function $g$. The authors used Sigmoid for unstructured and Exponential for structured sparsity, but other functions might yield different results.
  • Hardware Realization: While STR reduces FLOPs and parameters, the resulting "unstructured" sparsity requires specialized hardware or software kernels to see actual wall-clock speedups on standard CPUs/GPUs.

Summary updated

BibTeX
@inproceedings{kusupati2020soft,
  author = {Aditya Kusupati and Vivek Ramanujan and Raghav Somani and Mitchell Wortsman and Prateek Jain and Sham M. Kakade and Ali Farhadi},
  title = {{Soft Threshold Weight Reparameterization for Learnable Sparsity}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=MSFox2ochSr},
}
Figure