[Paper Review] Increasing the Interpretability of Recurrent Neural Networks Using Hidden Markov Models
This paper proposes a hybrid model combining recurrent neural networks (RNNs) with hidden Markov models (HMMs) to enhance interpretability without sacrificing performance. By training an HMM on LSTM hidden states and integrating HMM state distributions into the LSTM output, the model learns complementary features—such as punctuation, spaces, and comment symbols—enabling clearer interpretation of RNN behavior while achieving improved predictive likelihood over standalone models.
As deep neural networks continue to revolutionize various application domains, there is increasing interest in making these powerful models more understandable and interpretable, and narrowing down the causes of good and bad predictions. We focus on recurrent neural networks (RNNs), state of the art models in speech recognition and translation. Our approach to increasing interpretability is by combining an RNN with a hidden Markov model (HMM), a simpler and more transparent model. We explore various combinations of RNNs and HMMs: an HMM trained on LSTM states; a hybrid model where an HMM is trained first, then a small LSTM is given HMM state distributions and trained to fill in gaps in the HMM's performance; and a jointly trained hybrid model. We find that the LSTM and HMM learn complementary information about the features in the text.
Motivation & Objective
- To improve interpretability of recurrent neural networks (RNNs) in sequential data tasks, especially in high-stakes domains like healthcare where model transparency is critical.
- To address the 'black box' nature of RNNs by combining them with the inherently interpretable structure of hidden Markov models (HMMs).
- To explore whether HMMs and LSTMs can learn complementary features in sequential data, such as punctuation, spaces, and comment markers.
- To develop and evaluate hybrid architectures that jointly or sequentially combine HMMs and LSTMs for better performance and interpretability.
- To provide visual and quantitative evidence that the hybrid model captures meaningful, human-interpretable patterns in text data.
Proposed method
- Train a 2-layer LSTM on character-level sequential data (Shakespeare, Linux kernel, Penn Treebank) with no dropout and gradient clipping at L2 norm threshold 5.
- Use forward filtering backward sampling (FFBS) to sample HMM hidden states, with transition parameters updated via Multinomial-Dirichlet posterior and emission parameters via Normal-Inverse-Wishart posterior for continuous HMMs.
- Train a continuous emission HMM on LSTM hidden states to model high-level state dynamics, and a discrete emission HMM directly on raw data for comparison.
- Integrate HMM state distributions into the output layer of the LSTM, allowing the LSTM to use HMM predictions to fill in gaps and improve robustness.
- Train a hybrid model where the HMM is trained first, then a small LSTM is fine-tuned using HMM state distributions as input features.
- Train a jointly optimized hybrid model where both HMM and LSTM components are trained end-to-end with shared supervision.
Experimental results
Research questions
- RQ1Can an HMM trained on LSTM hidden states provide a more interpretable representation of sequential patterns in text?
- RQ2Do HMMs and LSTMs learn complementary features in sequential data, such as punctuation, spaces, and comment markers?
- RQ3Does integrating HMM state distributions into the LSTM output improve predictive performance compared to standalone models?
- RQ4Can the hybrid architecture achieve better predictive likelihood with fewer parameters than a large standalone LSTM?
- RQ5To what extent can visualizations of HMM and LSTM states reveal interpretable, human-understandable patterns in the data?
Key findings
- The hybrid HMM-LSTM model achieved a validation predictive log-likelihood of -1.97 on the Penn Treebank with 20 LSTM dimensions and 10 HMM states, outperforming a standalone LSTM with the same size.
- On the Linux kernel dataset, the joint hybrid model with 20 LSTM and 10 HMM states achieved a validation log-likelihood of -1.90, surpassing the standalone LSTM’s -1.88.
- Visualizations showed that HMMs effectively captured features like comment symbols and indentation spaces, while LSTMs identified punctuation and vowel patterns, indicating complementary learning.
- The hybrid model with 5 LSTM dimensions and 10 HMM states achieved a validation log-likelihood of -2.30 on Shakespeare, outperforming a standalone LSTM with 5 dimensions (-2.41).
- The joint hybrid model on the Penn Treebank with 20 LSTM and 10 HMM states achieved a validation log-likelihood of -1.71, the best among all models tested.
- Decision trees trained on individual LSTM hidden state dimensions revealed that specific dimensions tracked comment characters and punctuation, confirming interpretable feature learning.
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.