Abstract
Hidden Markov Models (HMMs) were once a cornerstone of natural language processing but fell out of favor due to scaling limitations. This paper introduces the Very Large HMM (VL-HMM), which utilizes neural parameterization, blocked emissions, and state dropout to scale to over 65,000 hidden states. We demonstrate that VL-HMMs significantly outperform traditional HMMs and n-gram models on standard language modeling benchmarks, narrowing the gap between classic latent-variable models and modern neural architectures.
Introduction
In the "pre-deep learning" era, Hidden Markov Models (HMMs) were a staple for sequence modeling. However, they struggled to scale for language modeling tasks. The primary bottleneck is computational: the complexity of exact inference in an HMM is $O(T|Z|^2)$, where $T$ is the sequence length and $|Z|$ is the number of hidden states. To capture the complexity of natural language, a large number of states is required, but the quadratic cost makes training and inference with tens of thousands of states impossible. This work, presented at EMNLP 2020, aims to close that gap by making massive HMMs computationally feasible.
Methods
The authors introduce three key techniques to enable scaling:
1. Blocked Emissions
To break the $O(|Z|^2)$ bottleneck, the state space is partitioned. Using Brown clustering, words are grouped into $M$ clusters. The model is then constrained so that each group of states can only emit words from a specific cluster. This turns the massive emission matrix into a block-diagonal structure.
During inference, the model only needs to consider transitions between the $k$ states active at time $t$ and the $k$ states active at $t+1$, reducing complexity to $O(Tk^2)$.
2. Neural Parameterization
Instead of storing transition and emission probabilities in giant, sparse tables (scalar parameterization), a small Multi-Layer Perceptron (MLP) generates these probabilities from state and word embeddings. This allows for massive state spaces with a relatively small, fixed number of trainable parameters and encourages the model to learn shared representations across states.
3. State Dropout
A novel form of dropout is proposed that removes entire hidden states from a training batch. This prevents the model from over-relying on a few "power states" and provides a significant computational speedup (up to 4x) during training.
Experimental Results
The models were evaluated on two standard language modeling benchmarks: Penn Treebank (PTB) and WikiText-2.
Scaling and Performance
A key finding is that HMM performance improves consistently as the number of states increases, showing no signs of plateauing even at $2^{16}$ (65,536) states.
On the Penn Treebank, the VL-HMM ($|Z|=2^{15}$) achieved a perplexity of 116.0. This is a massive improvement over previous state-of-the-art HMMs (which sat around 284.6) and even beats a standard feedforward neural network baseline (152.0).
Key Insights
- Neural > Scalar: Even when a scalar HMM and a neural HMM have the same number of states, the neural version generalizes much better. The neural parameterization acts as a form of regularization, preventing the model from simply memorizing the training data.
- Parallelizability: Unlike RNNs, which are inherently sequential, HMMs have an associative structure that allows for parallel inference via prefix-sum algorithms. This makes them potentially more hardware-friendly for certain applications.
- Efficiency: By using blocked emissions and state dropout, the authors were able to train models with 32,768 states on a single consumer GPU (RTX 2080) with reasonable training times.
Limitations and Future Work
While the VL-HMM significantly improves upon previous HMM and n-gram methods, it still trails behind optimized LSTMs (e.g., AWD-LSTM hits ~57.3 on PTB). The current "Blocked Emissions" rely on heuristic Brown clustering; learning this sparsity structure dynamically during training could yield even better results. Future work may also explore applying scaled HMMs to tasks where discrete latent variables offer better interpretability than the continuous hidden states of standard neural networks.
Summary updated