The State of Sparsity in Deep Neural Networks

Trevor Gale, Erich Elsen, Sara HookerarXiv 2019

TL;DR

This paper rigorously evaluates state-of-the-art sparsity techniques on large-scale deep learning models, finding that simple magnitude pruning often outperforms complex methods. They also show that sparse architectures learned through pruning cannot be effectively trained from scratch to match the performance of models trained with joint sparsification and optimization, highlighting the need for better large-scale benchmarks.

What Problem Does This Paper Address?

Deep neural networks have achieved remarkable performance across various domains, but their large size and computational demands make them prohibitive for deployment in resource-constrained environments. Sparsity, the practice of setting model parameters to zero, is a promising avenue for reducing model size and computational cost. However, the sparsity literature is fragmented, with many techniques evaluated on small datasets and limited architectures, making it difficult to compare their effectiveness and understand their true potential. This paper aims to provide a clear, large-scale evaluation of prominent sparsity techniques to establish rigorous baselines and clarify ambiguities in the field.

Methods

The authors compare three main sparsity-inducing techniques:

  • Magnitude Pruning: A simple heuristic that removes weights with the smallest absolute values. They use an implementation that allows for gradual pruning and reactivation of weights.
  • Variational Dropout: A Bayesian approach that reinterprets dropout as variational inference, learning per-parameter dropout rates that can be used to identify weights for removal post-training.
  • L0 Regularization: A technique that directly penalizes the number of non-zero weights using a reparameterization of weights with stochastic gates.

They also include a Random Pruning Baseline to establish a lower bound for performance. A key aspect of their methodology is the extensive hyperparameter tuning and evaluation across two large-scale tasks, aiming for a fair comparison. They also investigate the "lottery ticket hypothesis" by attempting to train sparse architectures from scratch.

Datasets

The paper uses two prominent large-scale datasets:

  • WMT 2014 English-to-German: Used for training a Transformer model for neural machine translation.
  • ImageNet: Used for training a ResNet-50 model for image classification.

These datasets represent complex, real-world tasks that are more indicative of the challenges in model compression than smaller, toy datasets often used in prior work.

Key Insights and Ideas

  • Simplicity Wins (Often): Surprisingly, simple magnitude pruning often matches or even surpasses the performance of more complex, theoretically motivated techniques like variational dropout and L0 regularization, especially at high sparsity levels. This suggests that the overhead of complex methods might not always translate to better results on large-scale problems.
  • Scale Matters: Techniques that perform well on small datasets don't necessarily generalize to larger ones. Variational dropout and L0 regularization, while promising on smaller tasks, showed inconsistent performance on the large-scale Transformer and ResNet-50 models.
  • "Lottery Ticket" Hypothesis Challenged at Scale: The idea that sparse architectures can be trained from scratch to match the performance of jointly optimized models (the "lottery ticket" hypothesis) does not hold up for unstructured sparsity on these large-scale tasks. This suggests that the original weight initialization and the joint optimization process are crucial for achieving high performance.
  • Need for Large-Scale Benchmarks: The inconsistencies observed across different tasks and scales highlight the critical need for standardized, large-scale benchmarks in model compression research to enable reliable comparisons and progress.
  • Magnitude Pruning's New State-of-the-Art: By carefully tuning magnitude pruning and slightly modifying its application (e.g., leaving early layers dense), the authors achieve a new state-of-the-art sparsity-accuracy trade-off for ResNet-50.

Key Results

  • Transformer (NMT): Magnitude pruning achieved comparable or better BLEU scores than variational dropout and L0 regularization across various sparsity levels, especially at high sparsity (90%+). Magnitude pruning also trained significantly faster.
  • ResNet-50 (Image Classification): Magnitude pruning and variational dropout achieved comparable performance. L0 regularization struggled to produce sparse models without significant accuracy degradation. A modified magnitude pruning approach (leaving early layers dense) achieved a new state-of-the-art sparsity-accuracy trade-off.
  • Scratch Training: For both Transformer and ResNet-50, training sparse architectures from scratch (with random or original initialization) failed to match the performance of models trained with sparsity as part of the optimization process, especially at higher sparsity levels. Doubling training steps improved results but did not close the gap.

Limitations and Future Work

  • Hyperparameter Exploration: While extensive, the authors acknowledge that the vast search space means they cannot guarantee they've found the absolute optimal settings for every technique.
  • Neural Architectures and Datasets: The study focused on Transformer and ResNet-50. It's possible other architectures or datasets might yield different results.
  • Future Work: The authors suggest further exploration of efficient sparsification techniques that can learn optimal sparsity distributions across layers. They also emphasize the need for more large-scale benchmarks to guide future research in model compression. They have open-sourced their code, checkpoints, and results to facilitate this.

Summary updated

BibTeX
@misc{gale2019state,
  author = {Trevor Gale and Erich Elsen and Sara Hooker},
  title = {{The State of Sparsity in Deep Neural Networks}},
  year = {2019},
  eprint = {1902.09574},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.09574},
}
Figure