DeepHoyer: Learning Sparser Neural Network with Differentiable Scale-Invariant Sparsity Measures

Huanrui Yang, Wei Wen, Hai Li

TL;DR

DeepHoyer introduces a new family of sparsity-inducing regularizers that are both differentiable (like $\ell_1$) and scale-invariant (like $\ell_0$). By utilizing the "Hoyer-Square" measure, researchers can prune neural networks more aggressively than previous state-of-the-art methods while maintaining high accuracy using standard gradient-based optimization.

What Problem Does This Paper Address?

In the quest to deploy deep learning on edge devices, "pruning"—removing unnecessary weights from a model—is essential. Traditionally, researchers have relied on two types of regularizers to encourage sparsity during training, both of which have significant drawbacks:

  1. The $\ell_1$ norm: It is easy to optimize because it is differentiable almost everywhere. However, it isn't "scale-invariant." It penalizes all weights proportionally, meaning it "shrinks" large, important weights at the exact same rate as small, useless ones.
  2. The $\ell_0$ norm: This is the "gold standard" for sparsity because it simply counts non-zero elements. It is scale-invariant (the penalty doesn't change if you scale the weights), but it is a mathematical nightmare: it is discrete and provides no useful gradients for standard optimizers like SGD.
Comparison of contours and gradient fields between the standard $\ell_1$ norm and the scale-invariant Hoyer measure.

The core challenge is finding a measure that possesses the optimization friendliness of $\ell_1$ but the sparsity-seeking "intelligence" of $\ell_0$.

Methods

The authors propose DeepHoyer, inspired by the Hoyer measure (the ratio between $\ell_1$ and $\ell_2$ norms) traditionally used in signal processing.

The Hoyer-Square (HS) Regularizer

For element-wise pruning, they introduce the Hoyer-Square (HS) measure: $$H_S(W) = \frac{(\sum |w_i|)^2}{\sum w_i^2}$$

This formula exhibits several brilliant properties:

  • Scale-Invariance: If you multiply the weight matrix by any constant $\alpha$, the value of $H_S$ remains unchanged. This prevents the "blind shrinking" effect characteristic of $\ell_1$.
  • Differentiability: Unlike $\ell_0$, it is differentiable almost everywhere, meaning it can be plugged directly into standard deep learning frameworks like PyTorch or TensorFlow.

The Trimming Effect

Mathematically, the gradient of HS creates a dynamic threshold. If a weight is smaller than a certain ratio of the total weight volume, the optimizer pushes it toward zero. If it's larger, the optimizer actually protects it.

Evolution of individual weight magnitudes over training steps under the Hoyer-Square regularizer.

Group-HS for Structural Pruning

Beyond individual weights, the authors extend this concept to Group-HS. This allows for "structural pruning," where entire neurons, filters, or channels are removed. Structural pruning is vastly more useful for actual hardware acceleration than random, element-wise sparsity.

Key Insights and Ideas

  • The "Aha" Moment on Scale: The authors realized that scale-invariance is the key to efficient pruning. Because $\ell_1$ isn't scale-invariant, it forces a trade-off between sparsity and the magnitude of surviving weights. DeepHoyer decouples these.
  • Dynamic Thresholding: Unlike "hard" pruning (where you simply delete the bottom 10% of weights), DeepHoyer acts as a "soft" trimmer that gradually identifies which weights are redundant as the model learns.
  • Optimization Simplicity: One of the biggest wins is that DeepHoyer doesn't require complex optimization tricks like ADMM or stochastic approximations. It works seamlessly with the Adam or SGD optimizers you are already using.

Key Results

The authors evaluated DeepHoyer on standard computer vision benchmarks (MNIST, CIFAR-10, ImageNet) and consistently outperformed previous state-of-the-art (SOTA) pruning methods:

  • LeNet-300-100 (MNIST): Achieved a 54.5× reduction in non-zero weights, representing a 38% improvement in sparsity over the previous best method without losing accuracy.
  • LeNet-5 (MNIST): Achieved a 122× reduction, a 63% improvement over previous SOTA.
  • AlexNet (ImageNet): Reached a 21.3× compression rate (only 4.69% of parameters remaining), the highest reported at the time for this model without accuracy loss.
  • Structural Pruning: On ResNet models, DeepHoyer consistently stayed above the "Pareto frontier" of the accuracy-vs-FLOPs tradeoff, meaning it provided more speedup for the same level of accuracy than competing techniques.

Limitations and Future Work

  • Pre-training Requirement: The authors typically start with a pre-trained model before applying the DeepHoyer regularizer. It remains unclear how well it performs when training entirely from scratch, though this is a common limitation in the pruning literature.
  • Hyperparameter Sensitivity: While simpler than some methods, DeepHoyer still requires tuning "decay" parameters ($\alpha$ and $\beta$) to balance the sparsity penalty against the original loss function.
  • Non-convexity: The regularizer is non-convex. While the authors found this didn't hurt performance in practice, it theoretically lacks the strict convergence guarantees of convex methods like $\ell_1$.

In summary, DeepHoyer provides a mathematically elegant and practically powerful tool for anyone looking to shrink massive models down to size without breaking their existing optimization pipelines.

Summary updated

BibTeX
@inproceedings{yang2020deephoyer,
  author = {Huanrui Yang and Wei Wen and Hai Li},
  title = {{DeepHoyer: Learning Sparser Neural Network with Differentiable Scale-Invariant Sparsity Measures}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=q82V1uNRE1},
}
Figure