One-Shot Pruning of Recurrent Neural Networks by Jacobian Spectrum Evaluation

Matthew Shunshi Zhang, Bradly C. Stadie

Abstract

Recent advances in the sparse neural network literature have made it possible to prune many large feed forward and convolutional networks with only a small quantity of data. Yet, these same techniques often falter when applied to the problem of recovering sparse recurrent networks. These failures are quantitative: when pruned with recent techniques, RNNs typically obtain worse performance than they do under a simple random pruning scheme. The failures are also qualitative: the distribution of active weights in a pruned LSTM or GRU network tend to be concentrated in specific neurons and gates, and not well dispersed across the entire architecture. We seek to rectify both the quantitative and qualitative issues with recurrent network pruning by introducing a new recurrent pruning objective derived from the spectrum of the recurrent Jacobian. Our objective is data efficient (requiring only 64 data points to prune the network), easy to implement, and produces 95% sparse GRUs that significantly improve on existing baselines. We evaluate on sequential MNIST, Billion Words, and Wikitext.

Introduction

Pruning Recurrent Neural Networks (RNNs) at initialization is notoriously difficult because standard methods often ignore the temporal dynamics inherent in the model. While network pruning—removing unnecessary weights to create smaller, faster models—is well-established for feed-forward and convolutional architectures, RNNs present unique challenges. Existing "at-initialization" methods suffer from two primary failures:

  1. Quantitative Failure: State-of-the-art techniques often perform worse than simple random pruning when applied to RNNs.
  2. Qualitative Failure: These methods tend to prune weights unevenly, concentrating active weights in specific gates or neurons rather than dispersing them across the architecture.

The root cause is that standard methods, such as SNIP, rely on loss gradients. In RNNs, these gradients often vanish over long sequences, causing the pruning algorithm to ignore long-term temporal dependencies and focus almost exclusively on input connections.

Methodology: Jacobian Spectrum Evaluation

To address these issues, we introduce a new objective: Jacobian Spectrum Evaluation. Instead of relying on the loss gradient, this method focuses on the temporal Jacobian ($J_t$), which describes how the hidden state at one time step affects the next.

To ensure effective information propagation through temporal depth without vanishing or exploding signals, the singular values of the Jacobian should remain close to 1. Our algorithm proceeds as follows:

  • Sensitivity Scoring: A score ($d_n$) is calculated for each weight based on how much its removal decreases the Frobenius norm of the temporal Jacobian.
  • Normalization: This score is divided by the expected magnitude of the gradient for that parameter to ensure fairness across different gate types (e.g., forget vs. input gates).
  • One-Shot Pruning: The top $K$ weights with the highest sensitivity scores are retained. This process is highly efficient, requiring only 64 data points and two backward passes without any actual training.

Experimental Results

We evaluated our method across several challenging benchmarks, including Sequential MNIST, WikiText-2, WikiText-103, and the One Billion Word Benchmark.

Performance on Sequential MNIST

On Sequential MNIST using a 400-unit GRU at 95% sparsity, our method achieved a 1.46% error rate, outperforming random pruning (1.50%) and SNIP (1.52%). The advantage scales with network size; for a 1600-unit GRU, our method achieves a 1.01% error, while the best baseline (random) sits at 1.15%.

Language Modeling

On the Billion Words dataset, our method achieved a perplexity of 53.26, a significant improvement over random pruning's 59.17. Furthermore, the method is computationally efficient, performing faster than Foresight (which requires Hessian calculations) and only slightly slower than SNIP.

Analysis of Sparse Architectures

Gate Balance and Temporal Awareness

Pruning algorithms that do not explicitly account for recurrent structure often "kill" entire gates. Our method maintains a healthier balance of input-to-recurrent connections. As shown in the comparison below, methods like SNIP and Foresight exhibit significantly higher I/R ratios, indicating a bias toward input parameters at the expense of recurrent dynamics.

Comparison of remaining weights by gate and type across SNIP, Foresight, and our proposed method.

Spatial Weight Distribution

Qualitative analysis reveals that the connections retained by our method are significantly more dispersed across neurons and gates. This spatial diversity is vital for the network's representational capacity and prevents the concentration of active weights in narrow sub-structures.

Sparsity maps showing the distribution of remaining connections for SNIP, Foresight, and our method.

Limitations and Conclusion

While our method significantly improves upon existing baselines, it remains sensitive to initialization. If initial weights have extremely high variance, the first-order Taylor expansion approximation can fail, leading to performance below random pruning. Additionally, a performance gap still exists between 95% sparse models and fully dense models on complex language tasks. Future work will explore the relationship between the Jacobian spectrum, network width, and the generalizability of these sparse subnetworks.

Summary updated

Abstract

Recent advances in the sparse neural network literature have made it possible to prune many large feed forward and convolutional networks with only a small quantity of data. Yet, these same techniques often falter when applied to the problem of recovering sparse recurrent networks. These failures are quantitative: when pruned with recent techniques, RNNs typically obtain worse performance than they do under a simple random pruning scheme. The failures are also qualitative: the distribution of active weights in a pruned LSTM or GRU network tend to be concentrated in specific neurons and gates, and not well dispersed across the entire architecture. We seek to rectify both the quantitative and qualitative issues with recurrent network pruning by introducing a new recurrent pruning objective derived from the spectrum of the recurrent Jacobian. Our objective is data efficient (requiring only 64 data points to prune the network), easy to implement, and produces 95% sparse GRUs that significantly improve on existing baselines. We evaluate on sequential MNIST, Billion Words, and Wikitext.
BibTeX
@inproceedings{zhang2020one,
  author = {Matthew Shunshi Zhang and Bradly C. Stadie},
  title = {{One-Shot Pruning of Recurrent Neural Networks by Jacobian Spectrum Evaluation}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=s-TuDxPQUu},
}
Figure