Abstract
In this work we explore a straightforward variational Bayes scheme for Recurrent Neural Networks. Firstly, we show that a simple adaptation of truncated backpropagation through time can yield good quality uncertainty estimates and superior regularisation at only a small extra computational cost during training, also reducing the amount of parameters by 80%. Secondly, we demonstrate how a novel kind of posterior approximation yields further improvements to the performance of Bayesian RNNs. We incorporate local gradient information into the approximate posterior to sharpen it around the current batch statistics. We show how this technique is not exclusive to recurrent neural networks and can be applied more widely to train Bayesian neural networks. We also empirically demonstrate how Bayesian RNNs are superior to traditional RNNs on a language modelling benchmark and an image captioning task, as well as showing how each of these methods improve our model over a variety of other schemes for training them. We also introduce a new benchmark for studying uncertainty for language models so future methods can be easily compared.
Introduction
Deep learning models, particularly Recurrent Neural Networks (RNNs), are prone to overfitting and often produce overconfident predictions. Standard RNNs utilize point estimates for weights, lacking a mechanism to express uncertainty. In safety-critical domains like healthcare or autonomous driving, calibrated uncertainty is essential. While heuristics like dropout provide some regularization, they lack a principled probabilistic foundation. This paper introduces a scalable framework for Variational Bayes in RNNs, achieving better regularization, model compression, and uncertainty estimation.
Methodology
The proposed framework rests on two main innovations:
Bayes by Backprop (BBB) for RNNs
Instead of fixed weights, the model learns the parameters (mean $\mu$ and variance $\sigma$) of a Gaussian distribution for each weight. Weights are sampled from these distributions during the forward pass. To maintain consistency in sequential modeling, weights are sampled once per minibatch and held constant across the unrolled time steps.
Posterior Sharpening
To address the high variance often associated with variational inference, the authors introduce "posterior sharpening." This technique uses the gradient of the loss with respect to the weights to locally shift the mean of the distribution for the current batch. This acts as a per-parameter adaptation to batch-specific statistics, enhancing training stability and convergence speed.
Experiments and Datasets
The approach was evaluated on:
- Penn Treebank (PTB): A standard word-level language modeling benchmark.
- MSCOCO: An image captioning task generating descriptions for CNN-processed images.
- Reversed PTB: A new benchmark designed to test uncertainty calibration by evaluating models on reversed word sequences, which are out-of-distribution for standard English models.
Discussion and Insights
A key finding is the massive redundancy in RNN parameters. By using the learned signal-to-noise ratio ($|\mu|/\sigma$) as a pruning metric, the authors demonstrated that up to 80% of weights can be removed with negligible impact on performance.
Furthermore, the Bayesian RNN exhibited superior calibration. In the Reversed PTB task, it showed significantly higher entropy than dropout-based models, indicating that the Bayesian model correctly identifies its own uncertainty when faced with unfamiliar data distributions.
Results
On the Penn Treebank benchmark, the Bayesian RNN (BRNN) with posterior sharpening achieved a test perplexity of 74.8, outperforming standard LSTMs and previous variational approaches.
In image captioning, the model improved the CIDER score from 89.8 to 96.0. While training is slower due to weight sampling and gradient computation (0.4x speed of standard RNN with sharpening), the gains in accuracy and robustness offer a compelling trade-off.
Conclusion
Bayesian RNNs provide a robust alternative to standard recurrent architectures, offering principled uncertainty and significant compression. Future work may explore more complex, non-linear posterior sharpening transformations to further refine these probabilistic approximations.
Summary updated