Activity Sparsity Complements Weight Sparsity for Efficient RNN Inference

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

TL;DR

By pairing dynamic neuron activation sparsity with static weight pruning, this paper demonstrates that the efficiency gains of both methods multiply together in recurrent networks. Using an Event-based Gated Recurrent Unit (EGRU), the authors achieve up to a $20\times$ reduction in multiply-accumulate (MAC) operations on language modeling while maintaining competitive perplexity below 60 on Penn Treebank.

What Problem Does This Paper Address?

In edge and mobile computing—especially during single-sample (batch size 1) inference—energy and latency are overwhelmingly dominated by fetching model weights from off-chip DRAM.

While weight pruning (removing static connections) is well-studied, activation sparsity (where neurons output zero for a majority of time steps) is underutilized in mainstream deep learning. Biologically inspired Spiking Neural Networks (SNNs) excel at activation sparsity on neuromorphic hardware, but they struggle to match artificial neural networks (ANNs) on complex sequence modeling tasks like natural language processing. Furthermore, little was known about whether activation sparsity and weight pruning could be stacked together without severely degrading language model performance.

Methods

The authors bridge deep learning accuracy and neuromorphic event-driven efficiency using the following design:

  • Event-based Gated Recurrent Unit (EGRU): Unlike standard GRUs or LSTMs, the EGRU decouples its hidden state into an internal continuous state $c$ and a communicated state $y$. The communicated state is thresholded via a Heaviside step function: $$y^{\langle t \rangle} = c^{\langle t \rangle} H(c^{\langle t \rangle} - \vartheta)$$ If the state is below the threshold $\vartheta$, the neuron emits zero, triggering no downstream weight fetches or arithmetic operations. A bio-inspired reset term subtracts threshold values after firing, and surrogate gradients enable backpropagation.

  • Global Unstructured Weight Magnitude Pruning: After training the network to convergence using AdamW, weights with the smallest magnitudes across all recurrent tensors are zeroed out iteratively over fine-tuning cycles. Embedding weights are preserved dense.

  • Multiplicative Efficiency Formulation: The theoretical computational workload scales with the product of non-zero activation fraction ($\lambda_a$) and non-zero weight fraction ($\lambda_w$): $\text{Cost} \propto \lambda_a \cdot \lambda_w$.

Datasets

The authors evaluated word-level language modeling across two classic sequence modeling benchmarks:

  • Penn Treebank (PTB)
  • WikiText-2

No new datasets were introduced. Language modeling was deliberately selected over speech recognition because recurrent networks applied to text are historically much more sensitive to parameter pruning.

Key Insights and Ideas

  • Sparsities are orthogonal and multiplicative: Rather than interfering with each other, activation sparsity remained nearly constant as weight pruning increased up to roughly 85% sparsity. Their combined reduction factors multiply, enabling massive computational savings without performance collapse.
  • Weight decay acts as an activation-sparsity dial: Recurrent weights and biases naturally skew negative, holding cell activations below threshold. Applying stronger weight decay penalizes large weights and pulls the distribution closer to zero, which counter-intuitively pushes preactivations above threshold and reduces activation sparsity. This provides a direct hyperparameter lever to trade compute cost for task perplexity.
  • Pruning schedules depend on target compression: Low weight sparsity targets (20–40%) perform best with one-shot pruning at low learning rates, whereas high sparsity targets (80–95%) require multi-step iterative pruning with higher learning rates.

Key Results

  • $20\times$ MAC Reduction: On Penn Treebank, an EGRU with 85% weight sparsity slashed operations from the standard dense baseline of 20.2M MACs down to 1.2M MACs, while preserving a test perplexity (PPL) of 58.7 (vs. 57.3 baseline).
  • Dense EGRU Baseline Wins: Even without weight pruning (0% weight sparsity), the EGRU’s intrinsic activity sparsity reduced MACs to 6.4M ($3.1\times$ reduction) and achieved a test perplexity of 56.6, outperforming the dense LSTM baseline (57.1 PPL at 20.2M MACs).
  • WikiText-2 Performance: Compressed the dense baseline (20.2M MACs, 65.8 PPL) down to 1.6M MACs at 85% sparsity with a test PPL of 70.7.
  • Outperforming Prior Pruned LSTMs: Surpassed previous state-of-the-art pruned LSTM results on Penn Treebank by roughly 20 perplexity points.

Limitations and Future Work

  • Hardware Mismatch: Standard GPUs cannot efficiently exploit unstructured weight sparsity or dynamic, unpredictable activation sparsity. Realizing these theoretical gains in physical latency and energy requires event-driven neuromorphic platforms (such as SpiNNaker2 or Loihi) or custom irregular accelerators.
  • Output Layer Bottleneck: The final output layer exhibited significantly higher activity than lower layers. Because the network must generate continuous-space candidate vectors to match dense dictionary word embeddings, it forces non-zero activity at the output. Alternative decoding heads are needed.
  • Embedding Dimension Overhead: The EGRU required larger embedding dimensions than standard LSTMs, offsetting some activation-sparsity benefits and limiting dense-model MAC reduction to ~3x.
  • Model Scale: Evaluations were limited to small-scale RNN benchmarks. Extending this dual-sparsity paradigm to modern linear-recurrent architectures (e.g., RWKV, State Space Models) is left for future research.

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