[Paper Review] Bayesian Sparsification of Recurrent Neural Networks
This paper introduces Bayesian sparsification of recurrent neural networks (RNNs) using Sparse Variational Dropout (Sparse VD), adapted to RNNs via insights from Binary Variational Dropout (Gal & Ghahramani, 2016b). It achieves up to 99.5% sparsity on sentiment analysis and 87.6% on character-level language modeling with minimal accuracy drop, enabling efficient, regularized, and compressed RNNs for deployment on resource-limited devices.
Recurrent neural networks show state-of-the-art results in many text analysis tasks but often require a lot of memory to store their weights. Recently proposed Sparse Variational Dropout eliminates the majority of the weights in a feed-forward neural network without significant loss of quality. We apply this technique to sparsify recurrent neural networks. To account for recurrent specifics we also rely on Binary Variational Dropout for RNN. We report 99.5% sparsity level on sentiment analysis task without a quality drop and up to 87% sparsity level on language modeling task with slight loss of accuracy.
Motivation & Objective
- To address the high memory and computational cost of large RNNs in sequential tasks like NLP and speech recognition.
- To apply principled, automatic sparsification via Sparse Variational Dropout to RNNs, overcoming limitations of heuristic pruning and manual hyperparameter tuning.
- To maintain model performance while achieving high sparsity levels through Bayesian regularization and variational inference.
- To adapt the Sparse VD framework to recurrent architectures by incorporating Bayesian dropout principles for RNNs (Gal & Ghahramani, 2016b).
- To enable efficient deployment of RNNs on mobile and edge devices through model compression without significant accuracy degradation.
Proposed method
- Adapts Sparse Variational Dropout (Sparse VD) to RNNs by modeling weight matrices as random variables with fully factorized normal posteriors: $ q(w_{ij}|m_{ij},\alpha_{ij}) = \mathcal{N}(m_{ij}, \alpha_{ij}m^{2}_{ij}) $.
- Uses additive reparameterization: $ w_{ij} = m_{ij} + \epsilon_{ij}, \epsilon_{ij} \sim \mathcal{N}(0, \sigma^{2}_{ij}) $, with $ \alpha_{ij} = \sigma^{2}_{ij}/m^{2}_{ij} $, to reduce gradient variance.
- Applies the local reparameterization trick to apply noise to preactivations instead of weights, improving training efficiency and gradient stability.
- Employs a log-uniform prior on weight magnitudes: $ p(|w_{ij}|) \propto 1/|w_{ij}| $, enabling automatic sparsity learning during training.
- Integrates Bayesian dropout for RNNs (Gal & Ghahramani, 2016b) to properly handle recurrent connections, avoiding vanishing gradients and memory loss.
- Optimizes the variational lower bound $ \mathcal{L} $ w.r.t. $ \{M, \log\sigma\} $, with KL divergence approximated via a differentiable analytic form: $ k(\alpha) \approx 0.64\sigma(1.87 + 1.49\log\alpha) - 0.5\log(1 + \alpha^{-1}) + C $.
Experimental results
Research questions
- RQ1Can Sparse Variational Dropout be effectively extended to recurrent neural networks while preserving model performance?
- RQ2What level of sparsity can be achieved in RNNs using Bayesian sparsification without significant accuracy degradation?
- RQ3How does combining Sparse VD with Bayesian dropout for RNNs improve generalization and model compression?
- RQ4Does the proposed method outperform heuristic pruning or standard dropout in terms of sparsity and accuracy trade-offs on sequential tasks?
- RQ5Can the method be applied to both recurrent and embedding layers to further compress large RNN models?
Key findings
- The method achieved 99.5% sparsity on the IMDB sentiment analysis task with no significant drop in accuracy, demonstrating high compression efficiency.
- On the character-level language modeling task, the model reached up to 87.6% sparsity across weight matrices ($W^x$, $W^h$, $W^y$) with only a slight increase in bits-per-character (from 1.499 to 1.506 on validation).
- Models initialized with VBD for the hidden-to-hidden weight matrix ($W^h$) achieved better performance than random initialization, showing the benefit of structured initialization.
- The model trained with Sparse VD showed a temporary drop in accuracy during early epochs due to increasing sparsity, but recovered and maintained performance.
- The combination of Sparse VD with Bayesian dropout for RNNs enabled automatic, principled sparsification without manual hyperparameter tuning, reducing overfitting and improving generalization.
- The approach enables deployment of large RNNs on memory-constrained devices by drastically reducing model size while maintaining competitive performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.