Selfish Sparse RNN Training

Shiwei Liu, Decebal Constantin Mocanu, Yulong Pei, Mykola Pechenizkiy

Abstract

Traditional deep learning efficiency relies on pruning dense models, a process that is computationally expensive during the training phase. We present Selfish-RNN, a novel framework for training highly sparse Recurrent Neural Networks (RNNs) from scratch. By implementing a "selfish" parameter competition between cell gates and a sparse-aware optimizer, Selfish-RNN achieves state-of-the-art performance while significantly reducing training FLOPs compared to traditional dense-to-sparse methods.

Introduction

As deep learning models scale, the demand for memory and computational efficiency grows. Sparsity—the practice of zeroing out unimportant weights—is a primary strategy to address these costs. However, the standard "dense-to-sparse" pruning workflow requires training a full-sized model before sparsification, which is energy-intensive. While Dynamic Sparse Training (DST) aims to train sparse models from the start, it has historically struggled to match dense model performance in RNNs. This difficulty stems from the complex temporal dependencies in RNNs and the limitations of standard optimizers like Averaged Stochastic Gradient Descent (ASGD) when applied to dynamic topologies.

Methodology: The Selfish-RNN Framework

Selfish-RNN addresses these challenges through two primary innovations:

1. Cell Gate Redistribution

In a standard LSTM cell, four gates (input, forget, cell, and output) typically share a uniform sparsity level. Selfish-RNN allows these gates to "selfishly" compete for a fixed parameter budget. During training, parameters are redistributed toward gates exhibiting larger weight magnitudes. This ensures that the most critical components of the recurrent cell—most notably the forget gate—receive the necessary capacity to handle long-term dependencies.

2. SNT-ASGD (Sparse Non-monotonically Triggered ASGD)

Standard ASGD improves generalization by averaging weights over time. However, in a sparse-to-sparse setting, newly "grown" weights start at zero. Standard averaging would immediately pull these new connections back toward zero, preventing them from learning. SNT-ASGD solves this by averaging only active (non-zero) weights, allowing new connections to stabilize and contribute to the model's performance.

The Selfish-RNN training cycle: (1) Pruning the smallest weights, (2) Redistributing the parameter budget across cell gates, and (3) Regrowing weights to maintain constant sparsity.

The training loop follows a continuous "remove-and-regrow" cycle. Every epoch, the smallest weights are pruned, and an equal number of new weights are initialized elsewhere, maintaining a constant parameter count throughout training.

Key Insights

  • Random vs. Gradient Growth: Contrary to common practice in CNNs, the authors found that growing new weights randomly outperforms gradient-based growth in RNNs. This suggests that random exploration is more effective for discovering optimal sparse topologies in recurrent structures.
  • The Primacy of the Forget Gate: Empirical analysis of the redistribution process showed that the forget gate consistently became the least sparse component. This aligns with theoretical understanding of the forget gate's vital role in managing long-term memory.
  • Topological Diversity: Using Graph Edit Distance (GED), the researchers observed that different training runs resulted in vastly different internal structures (topologies) despite achieving nearly identical performance. This indicates a high density of "winning tickets" within the sparse landscape of RNNs.

Results and Efficiency

Selfish-RNN was evaluated on the Penn TreeBank (PTB) and WikiText-2 benchmarks. On PTB, a sparse stacked LSTM (67% sparsity) achieved a test perplexity of 71.65, significantly outperforming the dense baseline (78.57) and traditional pruning methods like ISS (78.65).

Beyond accuracy, the primary advantage of Selfish-RNN is its computational efficiency. By maintaining sparsity throughout the entire training process, it avoids the high FLOP count associated with dense pre-training.

Comparison of training FLOPs: Selfish-RNN requires significantly fewer operations than the traditional dense-to-sparse pruning and retraining pipeline.

As shown in the comparison, Selfish-RNN uses approximately 0.33x the training FLOPs of a dense model while delivering superior results.

Conclusion and Future Work

Selfish-RNN demonstrates that training sparse RNNs from scratch is not only possible but can surpass the performance of dense models. While current hardware (optimized for dense operations) limits immediate wall-clock speedups for unstructured sparsity, emerging architectures offer a path toward realizing these algorithmic gains. Future research will explore the application of "selfish" redistribution to other architectures, such as Transformers, and investigate more hardware-friendly structured sparsity patterns.

Summary updated

BibTeX
@inproceedings{liu2021selfish,
  author = {Shiwei Liu and Decebal Constantin Mocanu and Yulong Pei and Mykola Pechenizkiy},
  title = {{Selfish Sparse RNN Training}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=EKfrfPX5lL9},
}
Figure