Activity Sparsity Complements Weight Sparsity for Efficient RNN Inference

Rishav Mukherji, Mark Schöne, Khaleelulla Khan Nazeer, Christian Mayr, Anand Subramoney

TL;DR

This paper demonstrates that combining weight pruning with sparse neuron activations in a specialized Recurrent Neural Network (RNN) leads to a multiplicative 20× reduction in computational operations. By using an event-based Gated Recurrent Unit (EGRU), the authors achieve state-of-the-art efficiency for language modeling on edge-compatible benchmarks without sacrificing task performance.

What Problem Does This Paper Address?

Deep learning models are notoriously power-hungry, making deployment on mobile and edge devices a significant challenge. While researchers often use weight pruning (removing unnecessary connections) to compress models, they rarely leverage activity sparsity (where only a few neurons "fire" at any given time).

In biology, brains are incredibly efficient because they use both: they have sparse connections and sparse activity. In artificial intelligence, however, the interaction between these two types of sparsity isn't well understood. Furthermore, while sparse models work well for simple tasks like speech recognition, they often struggle with the complex dynamics required for high-quality language modeling. The authors set out to prove that these two techniques are complementary and can be combined to drive massive efficiency gains in RNNs.

Methods

The researchers focused on a specific architecture called the Event-based Gated Recurrent Unit (EGRU). Unlike a standard GRU, the EGRU uses a Heaviside thresholding function to sparsify its internal state. It only communicates information when a neuron's internal "cell state" crosses a certain threshold—effectively mimicking the behavior of biological spiking neurons.

To achieve maximum efficiency, they combined this architecture with Global Unstructured Weight Magnitude Pruning. Their approach involved a two-step process:

  1. Train the EGRU model to convergence.
  2. Iteratively prune the weights with the smallest magnitudes and fine-tune the remaining network.

The core mathematical insight is that these sparsities are multiplicative. If only 20% of your neurons are active ($\lambda_a = 0.2$) and you've pruned 80% of your weights ($\lambda_w = 0.2$), the total number of operations drops to just 4% ($0.2 \times 0.2 = 0.04$) of the original dense model.

Datasets

The authors evaluated their approach on two standard word-level language modeling benchmarks:

  • Penn Treebank (PTB): A classic dataset for testing RNN performance.
  • WikiText-2: A larger and more diverse dataset than PTB, providing a more rigorous test of the model's ability to handle complex language patterns.

Key Insights and Ideas

  • Multiplicative Efficiency: The most significant finding is that activity sparsity and weight sparsity are largely orthogonal. You can prune a network heavily without significantly reducing its ability to maintain sparse activations, leading to the compound efficiency mentioned above.
  • Weight Decay as a Sparsity "Knob": The authors found that weight decay regularization doesn't just help with generalization; it directly influences activity sparsity. By driving weights and biases toward negative values, weight decay makes it harder for neurons to reach their firing threshold, thus increasing sparsity.
  • Regularization Effect: Interestingly, the sparse activations in the EGRU seem to provide an additional layer of regularization. This allowed the EGRU to match or even slightly outperform standard LSTMs on small datasets where overfitting is a common problem.
Figure 1: The trade-off between MAC reduction and test perplexity. Note how the EGRU (orange) maintains lower perplexity at much higher reduction factors compared to the LSTM (blue).

Key Results

The combined approach yielded impressive quantitative gains:

  • 20× Reduction in Operations: On the Penn Treebank task, the model achieved a 20-fold reduction in Multiply-Accumulate (MAC) operations while maintaining a perplexity below 60.
  • Superiority over Baselines: This level of reduction significantly outperforms previous attempts using only sparsely connected LSTMs, which typically see performance degrade much earlier.
  • Sparsity Levels: The authors successfully pushed weight sparsity to 85% while maintaining high activity sparsity, as shown in the trade-off curves in Figure 1.
Figure 2: Analysis of how weight decay affects the distribution of weights and biases, ultimately controlling the "firing" rate of the neurons.

Limitations and Future Work

Despite the theoretical gains, the authors note several practical hurdles:

  • Hardware Mismatch: Current mainstream hardware (like GPUs) is designed for dense, regular matrix math. Unstructured weight sparsity and dynamic activation sparsity are difficult to accelerate on these platforms. The authors argue that this work highlights the need for neuromorphic accelerators (like SpiNNaker2 or Loihi) that are built for event-driven, sparse computation.
  • Embedding Bottleneck: The EGRU currently requires larger word embeddings than LSTMs to reach peak performance, which adds some computational overhead that partially offsets the sparsity gains.
  • Output Layer Activity: The final output layer of the model remains relatively high-activity because it must compare the hidden state against a large dictionary of possible words. Future work will look into more efficient decoding strategies to keep the entire pipeline sparse.

Overall, this research provides a strong case for moving away from "dense-by-default" AI and toward architectures that embrace the dual efficiencies of sparse connections and sparse activity.

Summary updated

BibTeX
@inproceedings{mukherji2023activity,
  author = {Rishav Mukherji and Mark Schöne and Khaleelulla Khan Nazeer and Christian Mayr and Anand Subramoney},
  title = {{Activity Sparsity Complements Weight Sparsity for Efficient RNN Inference}},
  booktitle = {MLNCP @ NeurIPS},
  year = {2023},
  url = {https://openreview.net/forum?id=hL4zZlCvWv},
}
Figure