Intrinsically Sparse Long Short-Term Memory Networks

Shiwei Liu, Decebal Constantin Mocanu, Mykola PechenizkiyarXiv 2019

Abstract

Long Short-Term Memory (LSTM) networks are powerful for sequential data but are often memory-intensive and computationally expensive. Traditional compression techniques like pruning typically require training a large dense model first. We introduce SET-LSTM, an architecture that utilizes Sparse Evolutionary Training to maintain high sparsity from initialization through inference. SET-LSTM sparsifies both internal gates and embedding layers, achieving higher accuracy than standard LSTMs on sentiment analysis tasks while using less than 4% of the parameters.

Introduction

LSTMs are a staple for sequential data tasks, but their massive parameter counts make them memory-bandwidth limited and slow to train or run inference on. This is a major bottleneck for deploying these models on resource-constrained edge devices. While model compression techniques exist, most rely on a "train dense, then prune" paradigm. This requires training a massive, computationally expensive fully-connected network before compression can begin. We address this by designing an LSTM that is intrinsically sparse from initialization.

Methods

The proposed SET-LSTM integrates Sparse Evolutionary Training (SET) directly into the LSTM architecture. Instead of starting dense, the network's layers are initialized as sparse bipartite graphs using an Erdős-Rényi random topology.

Sparse LSTM Cells and Embeddings

The dense weight matrices inside the LSTM's four control gates (input, forget, output, cell state) are replaced with sparse matrices. Additionally, the word embedding layer—typically the largest parameter sink in NLP models—is also sparsified.

Schematic diagram of the LSTM cell showing the internal gates that are sparsified in SET-LSTM.

Evolutionary Training

During training, the network dynamically "rewires" itself. After each epoch, a fraction of the weights closest to zero are pruned. To maintain a constant sparsity budget, an equal number of new random connections are grown. This allows the network to adapt its sparse topology to the data distribution during training, bypassing the need for a dense pre-training phase.

Illustration of the sparse embedding layer integrated with the LSTM sequence.

Experimental Setup

The method is evaluated on four standard sentiment analysis classification datasets: IMDB (movie reviews), Sanders Corpus Twitter (tweet sentiment), Yelp 2018 (business reviews), and Amazon Fine Food Reviews.

Results

SET-LSTM achieved a 95.69% sparsity rate, reducing parameters from ~5.6 million to ~243,000. Despite this reduction, SET-LSTM outperformed the fully connected LSTM baseline on three of the four datasets: IMDB (+0.78%), Twitter (+1.43%), and Yelp 2018 (+4.64%). At an extreme sparsity level of 99.1%, SET-LSTM still achieved 78.85% accuracy on the Twitter dataset, beating the dense LSTM baseline (77.79%).

Discussion

Our analysis reveals that different training runs evolve into different sparse topologies with low similarity (~4-8%), yet achieve similar high accuracies. This suggests that overparameterized dense networks contain many amenable low-dimensional sub-networks. Furthermore, joint optimization of weights and topology is crucial; re-initializing a learned topology with random weights leads to performance drops, highlighting the importance of the evolutionary training trajectory.

Conclusion

SET-LSTM demonstrates that extreme sparsity is viable for recurrent networks from the start of training. Future work will involve implementing strictly sparse data structures to realize hardware-level speedups and testing on other sequential tasks like speech recognition.

Summary updated

BibTeX
@misc{liu2019intrinsically,
  author = {Shiwei Liu and Decebal Constantin Mocanu and Mykola Pechenizkiy},
  title = {{Intrinsically Sparse Long Short-Term Memory Networks}},
  year = {2019},
  eprint = {1901.09208},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1901.09208},
}
Figure