Abstract
Recently, a lot of techniques were developed to sparsify the weights of neural networks and to remove networks' structure units, e.g. neurons. We adjust the existing sparsification approaches to the gated recurrent architectures. Specifically, in addition to the sparsification of weights and neurons, we propose sparsifying the preactivations of gates. This makes some gates constant and simplifies LSTM structure. We test our approach on the text classification and language modeling tasks. We observe that the resulting structure of gate sparsity depends on the task and connect the learned structure to the specifics of the particular tasks. Our method also improves neuron-wise compression of the model in most of the tasks.
Introduction
Recurrent Neural Networks (RNNs), particularly Long Short-Term Memory (LSTM) networks, are essential for sequence modeling but pose significant challenges for deployment on memory-constrained edge devices. Traditional compression techniques typically focus on either unstructured pruning (removing individual weights) or structured pruning (removing entire neurons). However, LSTMs possess a unique internal architecture consisting of four gates: input ($i$), forget ($f$), output ($o$), and information flow ($g$).
This paper introduces a three-level sparsification hierarchy that specifically targets these gates. By making certain gates constant, the researchers can simplify the LSTM cell's logic, achieve massive compression, and reveal how different tasks utilize internal neural structures differently.
Methods: A Three-Level Sparsification Hierarchy
The core contribution is the definition of a structured hierarchy for LSTM sparsity:
- Weights: Fine-grained pruning of individual connections.
- Gates: By zeroing out a specific row in the weight matrix, a gate's activation becomes constant, depending only on its bias.
- Neurons: Zeroing out a column removes the neuron entirely, as it no longer contributes to subsequent layers.
The authors implemented this using two frameworks:
- Pruning via Regularization: Using Lasso and Group Lasso to penalize non-zero weights in specific groups (gates or neurons).
- Bayesian Sparsification: Utilizing Sparse Variational Dropout with learned "group weights" that allow the model to automatically turn off redundant gates and neurons during training.
Task-Specific Architectural Insights
The researchers discovered that the "optimal" gate structure is highly dependent on the nature of the NLP task.
- Text Classification (IMDB): The model frequently rendered the output gates constant. Since classification typically relies on the hidden state at the final time step, the step-by-step gating of outputs becomes redundant.
- Language Modeling (PTB): Output gates remained essential. Interestingly, the model often created neurons with only non-constant output gates to handle short-term dependencies, effectively simplifying complex LSTM units into vanilla recurrent units for rapid updates.
- Memory Duration: Gradient analysis showed that neurons with constant gates tend to focus on short-term memory, while neurons with all gates active are capable of maintaining information over 100+ steps.
Key Results
The proposed "Weights + Gates + Neurons" (W+G+N) approach yielded significant improvements in model efficiency:
- Extreme Compression: On the IMDB sentiment analysis task, the Bayesian framework compressed the model by a factor of 19,747x. The network was reduced from 128 neurons and 512 gates to just 4 neurons and 6 gates with negligible accuracy loss.
- Superior Neuron Reduction: In nearly all experiments, incorporating gate-level sparsity allowed the model to identify and prune more unnecessary neurons than standard weight-and-neuron pruning methods.
- State-of-the-Art Performance: On the Word PTB (large) language modeling task, the method achieved 3.22x compression, outperforming the previous state-of-the-art "ISS" pruning method (2.97x) while maintaining comparable perplexity.
Limitations and Conclusion
While highly effective for word-level tasks and classification, the method showed less impact on character-level language modeling, where the inherent complexity seems to require the full flexibility of the gating mechanism. Furthermore, while theoretical sparsity is high, realizing actual inference speedups requires specialized hardware or software kernels capable of exploiting constant gates.
In conclusion, structured gate sparsification provides a powerful tool for both compressing recurrent models and interpreting the functional roles of different neural components across diverse NLP tasks.
Summary updated