Learning Intrinsic Sparse Structures within Long Short-Term Memory

Wei Wen, Yuxiong He, Samyam Rajbhandari, Minjia Zhang, Wenhan Wang, Fang Liu, Bin Hu, Yiran Chen, Hai Li

Model compression is critical for deploying Recurrent Neural Networks (RNNs) on resource-constrained edge devices and for ensuring quick response times in large-scale server clusters. This paper introduces Intrinsic Sparse Structures (ISS), a novel method to compress Long Short-Term Memory (LSTM) networks by identifying and removing redundant components that span across all internal gates and states.

By utilizing Group Lasso regularization to prune these structures, the authors achieved a remarkable 10.59x inference speedup on language modeling tasks without sacrificing accuracy, producing compact models that run efficiently on standard hardware.

The Problem with Non-Structured Sparsity

Recurrent Neural Networks, particularly LSTMs, are notoriously computationally expensive. While model compression is a popular solution, most existing methods rely on non-structured pruning, which involves zeroing out individual, random weights.

The primary issue with this approach is that randomly sparse matrices are "hardware-unfriendly." Standard CPUs and GPUs are highly optimized for dense matrix mathematics. Unless a matrix is extremely sparse (often >90%), the overhead of tracking random zeros actually makes the model slower than the original dense version.

Speedup comparison between structured and non-structured sparsity across different matrix sizes.

To achieve real-world speedups, models require structured sparsity—the removal of entire rows or columns. However, LSTMs are complex architectures featuring interwoven input updates, forget gates, output gates, and hidden states. If a neuron is independently pruned in the "forget gate" but not the "hidden state," the matrix dimensions no longer match, rendering the LSTM mathematically invalid.

Methods: Intrinsic Sparse Structures (ISS)

To overcome the dimension consistency problem, the authors propose Intrinsic Sparse Structures (ISS).

Defining Intrinsic Sparse Structures

The researchers identified that for an LSTM to remain functional after pruning, certain groups of weights across all internal weight matrices must be treated as a single, cohesive unit. If you remove the $k$-th component of an ISS, you simultaneously reduce the size of the input updates, all gates, hidden states, and cell states by exactly one. This synchronized reduction maintains strict dimension consistency across the entire LSTM unit.

Intrinsic Sparse Structures (ISS) within LSTM units.

Group Lasso Regularization and Thresholding

To automate this structured pruning, the authors incorporated a Group Lasso penalty into the loss function during training. This penalty effectively "squeezes" the Euclidean length of an entire ISS weight group toward zero. During the training process, any weight group that falls below a predefined, tiny threshold is entirely zeroed out.

Hardware Optimization

Because the resulting compressed model is fundamentally just a smaller, standard LSTM, it can be deployed using standard, highly optimized linear algebra libraries (like Intel MKL). It does not require specialized sparse-computation software, allowing for immediate, out-of-the-box speedups.

Key Insights and Results

The researchers evaluated their approach on several benchmarks, including the Penn TreeBank (PTB) dataset for language modeling and the Stanford Question Answering Dataset (SQuAD) for machine reading comprehension.

  • Massive Inference Speedups: On the PTB task, the ISS method achieved a 10.59x speedup in inference time. The model automatically reduced its hidden layer sizes from 1500 to 373 and 315 in a two-layer stack, with zero loss in perplexity.
  • Automatic Architecture Search: Instead of relying on a human expert to guess the optimal hidden size, the ISS method allows a large model to naturally "shrink" during training to its ideal, data-driven size. Interestingly, a model shrunk via ISS performed better than a model manually designed to be that same small size from the start.
  • SQuAD Compression: When applied to the BiDAF (Bi-Directional Attention Flow) model for SQuAD, the method significantly reduced the parameter count (down to 2.69M weights) while maintaining highly competitive Exact Match (EM) and F1 scores.
  • Beyond LSTMs: The method's versatility was proven by successfully extending it to non-LSTM architectures, such as Recurrent Highway Networks (RHNs), reducing network width from 830 to 517 without performance degradation.

Limitations and Future Work

While highly effective, the authors noted a few limitations. First, it is difficult to remove ISS components in the contextual embedding layers of models like BiDAF. These layers are very close to the raw input and are inherently dense, making them less susceptible to pruning. Second, the strength of the regularization hyperparameter ($\lambda$) must be carefully tuned to balance model size and accuracy, which can be computationally intensive.

Looking forward, the underlying philosophy of "dimension-consistent structured pruning" holds significant promise. While this paper focuses on LSTMs and RHNs, the ISS framework could likely be adapted for other complex architectures, paving the way for more efficient deployment of advanced neural networks on edge devices.

Summary updated

BibTeX
@inproceedings{wen2018learning,
  author = {Wei Wen and Yuxiong He and Samyam Rajbhandari and Minjia Zhang and Wenhan Wang and Fang Liu and Bin Hu and Yiran Chen and Hai Li},
  title = {{Learning Intrinsic Sparse Structures within Long Short-Term Memory}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=rk6cfpRjZ},
}
Figure