This paper provides a roadmap for scaling up some of the most flexible tools in the Bayesian time series toolkit. By adapting Stochastic Variational Inference (SVI) to Hidden Markov Models (HMMs) and Hidden semi-Markov Models (HSMMs)—including their nonparametric (HDP) variants—the authors enable these models to scale to massive datasets for the first time.
The Challenge: Scaling Bayesian Time Series
Bayesian time series models like the HMM are excellent for capturing latent structures in data, but they traditionally struggle with "Big Data." Standard inference techniques, such as Markov Chain Monte Carlo (MCMC) or batch Variational Inference, require a full pass over the entire dataset for every single update. This is a dealbreaker for massive datasets.
While Stochastic Variational Inference (SVI)—which uses small "minibatches" of data to update global parameters—has revolutionized fields like topic modeling, its application to time series was previously unexplored. Time series present a unique challenge: unlike independent documents in a topic model, time series data points are sequentially dependent. Furthermore, Hidden semi-Markov Models (HSMMs), which allow for more realistic modeling of how long a system stays in a particular state, have a computational complexity that scales quadratically ($O(T^2)$) with the length of the sequence, making them even harder to scale than standard HMMs.
Methodology: SVI and HMM Embedding
The authors bridge this gap by deriving SVI algorithms for four core models: the Bayesian HMM, the HSMM, and their nonparametric counterparts (HDP-HMM and HDP-HSMM). Key technical contributions include:
- Natural Gradient Updates: They derive the natural gradients for the mean-field variational objective in these models, allowing for efficient stochastic updates of global parameters (like transition matrices and emission distributions).
- Direct Assignment Truncation: To handle the "infinite" states of the Hierarchical Dirichlet Process (HDP) versions, they use a truncation method that limits the number of active states while allowing the model to search for the optimal complexity.
- HMM Embedding for HSMMs: This is the paper's "secret sauce." General HSMM inference is slow ($O(T^2)$). However, the authors show that if you use a Negative Binomial distribution to model state durations, you can "embed" the HSMM into a structured HMM. Because a Negative Binomial is essentially a sum of geometric distributions, one HSMM state can be represented as a sequence of $r$ HMM sub-states. This trick drops the complexity to $O(T)$, making HSMMs as computationally efficient as standard HMMs.
- Sample-based Updates: For cases where the Negative Binomial parameters themselves need to be learned, the authors propose an approximate update based on sampling state sequences, which avoids the expensive exact variational update.
Experimental Setup
The authors evaluated their methods using synthetic datasets designed to simulate complex time series behavior:
- HDP-HMM Test: 100 observation sequences of length 3,000, generated from a 10-state HMM with 2D Gaussian emissions.
- HDP-HSMM Test: 30 sequences of length 2,000 with Poisson-distributed durations.
- Negative Binomial HSMM Test: 55 sequences of length 3,000, used to compare the "exact" vs. "approximate" SVI updates.
Key Insights
- SVI works for dependencies: The paper proves that the "local/global" variable split required for SVI can be maintained even in sequential models, provided the minibatch is a full (or sufficiently long) sub-sequence.
- The Negative Binomial "Sweet Spot": The authors identified the Negative Binomial as a uniquely powerful distribution for durations. It is flexible enough to model non-memoryless processes (unlike the HMM's geometric distribution) but structured enough to allow for the HMM embedding trick.
- Sampling can beat "Exact" Math: In their experiments, the approximate sampling-based update for HSMM durations actually led to higher predictive likelihood than the exact variational update. This suggests that the stochasticity of sampling helps the model escape local optima that trap the exact gradient-based approach.
Results
- Speedup: SVI reached high predictive likelihood in the time it took the batch algorithm to complete just a single iteration. Essentially, SVI can "fit" the model after seeing only a small fraction of the data required by batch methods.
- Scalability: The HMM embedding successfully turned the quadratic bottleneck of HSMMs into a linear one, allowing the model to handle sequences that were previously computationally prohibitive.
- Performance: In all tests (HDP-HMM, HDP-HSMM, and NB-HSMM), SVI achieved comparable or superior predictive performance to batch methods while being significantly faster.
Limitations and Future Directions
- Synthetic Focus: The evaluation is primarily on synthetic data. While the authors list many potential domains (biophysics, NLP, energy monitoring), the paper doesn't showcase a large-scale real-world application.
- Truncation Sensitivity: The "direct assignment" truncation for HDP models is a choice; other truncation methods might offer different trade-offs in terms of speed and accuracy.
- Fixed $r$ vs. Learned $r$: While they provide a way to learn the Negative Binomial parameter $r$, the HMM embedding is most efficient when $r$ is fixed. Learning $r$ on the fly adds complexity that may still be a hurdle for the most extreme "Big Data" scenarios.
Summary updated