What is a Hidden Markov Model, and what are its three fundamental problems?
Answer
A Hidden Markov Model is a doubly stochastic generative model for sequential data: a hidden state sequence evolves as a first-order Markov chain (each state depends only on the previous one), and each state emits an observable symbol according to a state-specific distribution. The model is defined by three quantities: the initial state distribution, the transition matrix between states, and the emission distributions. The three fundamental problems are evaluation (what is the probability of an observation sequence), decoding (what is the most likely state sequence given the observations), and learning (how to estimate the parameters from data). In production, DNN-HMM hybrids remain common for on-device keyword spotting, where the DNN estimates emission probabilities and the HMM’s Viterbi decoder integrates across frames, while profile HMMs (Pfam, HMMER) remain the standard for protein family classification across sequenced genomes.
(1) Evaluation (Forward Algorithm): given model parameters and an observation sequence, compute the total probability efficiently via dynamic programming in O(TN^2) instead of summing over all N^T possible state paths.
(2) Decoding (Viterbi Algorithm): find the single most likely state sequence via dynamic programming with backpointers, also O(TN^2); on-device keyword spotters use Viterbi to combine per-frame DNN scores into a detection decision.
(3) Learning (Baum-Welch / EM): estimate transition and emission parameters from unlabeled observation sequences using the forward-backward algorithm, an instance of EM that iterates between computing expected state occupancies (E-step) and updating parameters (M-step); profile HMM databases like Pfam build models from seed alignments and HMMER scores new sequences against them for genome annotation.

Figure 1: HMM architecture: hidden states form a first-order Markov chain (transitions depend only on the previous state), and each state emits an observation from its own distribution; only observations are visible, states are hidden.
In production, HMMs persist where their probabilistic sequence structure and low computational cost outweigh the accuracy advantage of end-to-end neural models. On-device voice triggers run DNN-HMM hybrids on low-power processors because the HMM’s Viterbi decoder integrates frame-level DNN scores into a keyword hypothesis with minimal power. GMM-derived i-vectors are still fed to DNN-HMM acoustic models as speaker-adaptation features, yielding 5-7% relative WER improvement. In bioinformatics, profile HMMs remain dominant: Pfam 38 (2025) uses HMMER for protein family classification across all sequenced genomes, and the HAVAC FPGA accelerator (2024) speeds up HMMER’s ungapped-Viterbi (SSV) filter stage by as much as 60x. In finance, HMMs are actively used for market regime detection, often hybridized with reinforcement learning for portfolio management.

Figure 2: The three fundamental HMM problems: evaluation (forward algorithm sums over all paths), decoding (Viterbi keeps the single best path via backpointers), and learning (Baum-Welch iterates E-step expected counts with M-step parameter updates).
Mathematical Formulation:
Where:
is the forward variable: the joint probability of emitting
and landing in state
at time
; the evaluation problem sums
over all final states.
is the Viterbi variable: the highest probability of any single path ending in state
at time
; backpointers
record the argmax to reconstruct the best path.
is the posterior state occupancy, formed from the forward variable and the backward variable
, the probability of emitting the remaining observations
given state
at time
.
is the transition probability from state
to state
and
the emission probability of
in state
. Baum-Welch updates
and
using
and the pairwise posterior
.
| Problem | Algorithm | Complexity | Production Use |
|---|---|---|---|
| Evaluation | Forward algorithm | O(TN^2) | Scoring sequences against Pfam profile HMMs |
| Decoding | Viterbi algorithm | O(TN^2) | On-device keyword spotting (DNN-HMM) |
| Learning | Baum-Welch (EM) | O(TN^2) per iteration | Training Pfam profile HMMs from seed alignments |
Leave a Reply