Papers
Topics
Authors
Recent
Search
2000 character limit reached

Hidden Markov Model Explanation | Definition

Updated 4 November 2026
  • Hidden Markov Models (HMMs) are probabilistic models used to analyze sequential data, featuring an unobserved state sequence that evolves as a Markov chain and generates observations through state-dependent distributions.
  • HMMs are widely applied in speech recognition, natural language processing, gesture recognition, and financial analysis due to their ability to model temporal dependencies and hidden processes.
  • Key components of an HMM include the initial-state distribution (Ï€), transition matrix (A), and emission model (B), which together parameterize the model. These components allow for operations like likelihood evaluation, decoding, and parameter learning, making HMMs versatile in various applications.

A hidden Markov model (HMM) is a probabilistic model for sequential data in which an unobserved state sequence evolves as a Markov chain and generates observed variables through state-conditioned distributions. For a finite model with hidden states Qt∈{1,…,N}Q_t\in\{1,\ldots,N\} and observations Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}, the parameterization is conventionally λ=(π,A,B)\lambda=(\pi,A,B), comprising an initial-state distribution π\pi, a transition matrix AA, and an emission model BB. The defining assumptions are that the current hidden state depends only on the preceding hidden state and that the current observation depends only on the current hidden state. HMMs support likelihood evaluation, latent-state decoding, filtering, smoothing, and parameter learning, and have been applied to speech recognition, natural language processing, gesture recognition, gene sequencing, physical measurement, medical monitoring, financial regime detection, cybersecurity, coding, and distributed state estimation (DelRose et al., 2011, Critch, 2012, Fritz et al., 2024).

1. Probabilistic structure and assumptions

Let Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T) denote the hidden sequence and O=(O1,…,OT)O=(O_1,\ldots,O_T) the observed sequence. The initial-state probabilities are

πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.

The hidden-state transition probabilities are

aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),

with

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}0

for every Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}1. The emission probabilities for a discrete alphabet are

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}2

with

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}3

The standard HMM assumptions are

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}4

and

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}5

Thus, conditional on the current hidden state, the current observation is independent of other observations and hidden states. The resulting joint probability is

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}6

The observable likelihood is obtained by summing over all hidden paths:

Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}7

This marginalization is nonlinear in the model parameters because the hidden sequence is unobserved. In a time-homogeneous HMM, Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}8 and Ot∈{V1,…,VM}O_t\in\{V_1,\ldots,V_M\}9 do not depend on λ=(π,A,B)\lambda=(\pi,A,B)0; the initial distribution need not be an equilibrium distribution. In the categorical formulation, the hidden states form a Markov chain and observation kernels attach to the current hidden state. The same factorization can be expressed in Markov categories, where stochastic kernels, conditionals, copying, marginalization, and conditional independence provide an abstract representation applicable to discrete probability, Gaussian probability, measure-theoretic probability, and possibilistic nondeterminism (Fritz et al., 2024).

The three classical HMM problems are:

  1. Evaluation: compute λ=(π,A,B)\lambda=(\pi,A,B)1.
  2. Decoding: determine the most probable hidden-state sequence.
  3. Learning: estimate λ=(π,A,B)\lambda=(\pi,A,B)2 to maximize the observation likelihood.

The Markov assumptions are modeling assumptions rather than universal properties of sequential data. Several extensions relax them by introducing observation history, higher-order state dependence, time-varying transition laws, structured multivariate latent processes, or recurrent covariate-dependent persistence.

2. Inference and decoding

The forward variable

λ=(π,A,B)\lambda=(\pi,A,B)3

is initialized by

λ=(π,A,B)\lambda=(\pi,A,B)4

and recursively updated by

λ=(π,A,B)\lambda=(\pi,A,B)5

The likelihood is

λ=(π,A,B)\lambda=(\pi,A,B)6

The forward algorithm avoids explicit enumeration of the λ=(π,A,B)\lambda=(\pi,A,B)7 possible hidden paths and requires λ=(π,A,B)\lambda=(\pi,A,B)8 time for a dense discrete HMM. The backward variable is

λ=(π,A,B)\lambda=(\pi,A,B)9

with

Ï€\pi0

and

Ï€\pi1

Forward and backward variables yield the smoothed state posterior

Ï€\pi2

They also yield the pairwise transition posterior

Ï€\pi3

with numerator

Ï€\pi4

For online inference, the filtering distribution is updated through prediction and correction. The prediction propagates the previous posterior through π\pi5; the correction multiplies the predicted state probabilities by the observation likelihood and normalizes. This is the discrete form of the Bayes filter. In the categorical framework, the same construction specializes to the Kalman filter in Gaussian probability and to nondeterministic state propagation in possibilistic models (Fritz et al., 2024).

The Viterbi algorithm replaces summation over paths with maximization. Its dynamic-programming variable is

Ï€\pi6

The recursion is

Ï€\pi7

and the maximizing predecessor is stored as

Ï€\pi8

Backtracking from

Ï€\pi9

produces the most probable complete state path. Maximizing each state independently is not equivalent to maximizing the entire path; predecessor backpointers are required.

For long sequences, scaling or log-space computation is required to prevent underflow. Forward-backward inference also supplies the sufficient statistics used by Baum–Welch and by many extensions, including time-varying, neural-emission, and structured multivariate HMMs.

3. Parameter learning and identifiability

Baum–Welch is an Expectation–Maximization procedure. The E-step computes AA0 and AA1 using forward-backward inference. The M-step updates

AA2

AA3

and, for discrete observations,

AA4

Under the standard Baum–Welch argument,

AA5

This monotonicity does not imply global optimality. The likelihood is generally non-convex, and EM can converge to a local maximum or stationary point depending on initialization, state number, parameter constraints, and data quality.

Finite HMMs also exhibit parameter non-identifiability. Hidden-state labels can be permuted without changing the observable distribution. For binary HMMs with binary hidden and visible variables, there are five free stochastic parameters: one in the initial distribution, two in the transition matrix, and two in the emission matrix. The observable model has dimension five, and generic ambiguity is principally hidden-state label swapping (Critch, 2012).

Algebraic statistics distinguishes the stochastic model from its algebraic closure. The model consists of distributions generated by valid nonnegative stochastic parameters; the associated variety is the Zariski or projective closure over complex parameters. Polynomial invariants characterize the variety but do not by themselves enforce nonnegativity or stochasticity. In the binary two-hidden-state case, a birational reparameterization AA6 provides rationally identifiable observable combinations, while the original parameters remain generically identifiable only up to hidden-label swapping. Exceptional lower-dimensional strata include an IID model when the hidden state has no effect on observations, an independent-but-not-identically-distributed submodel when hidden states do not influence one another, and an equilibrium submodel when the hidden chain is at equilibrium.

For four observed binary variables, the BHMM ideal is minimally generated by 21 homogeneous quadrics and 29 homogeneous cubics. These invariants extend to longer sequences by applying them to consecutive four-variable windows. A semialgebraic membership test must combine algebraic equalities, nonnegative observed probabilities, stochastic parameter reconstruction, and explicit treatment of exceptional parameter loci (Critch, 2012).

4. Extensions of the basic dependence structure

Several extensions retain dynamic programming while changing the conditional-independence structure.

Observation-history models

The Evidence Feed Forward HMM adds a state-dependent observation-linkage factor AA7, approximately

AA8

Its parameterization is AA9, with

BB0

The local factorization becomes

BB1

The forward recursion is

BB2

The leading inference complexity remains BB3, but storage increases by BB4. The model is intended for cases in which local observation patterns, such as directional changes in motion, contain information not captured by state-wise emission probabilities (DelRose et al., 2011).

The Markov Observation Model makes the observation sequence itself Markov conditional on the new hidden state:

BB5

The pair BB6 is jointly Markov, and the initial distribution is a joint distribution BB7 rather than a distribution over the hidden state alone. The forward recursion becomes

BB8

The standard HMM is recovered when BB9. The corresponding EM algorithm estimates hidden transitions, observation transitions, and the initial joint distribution; filtering and Viterbi decoding retain the preceding observation as part of the recursion (Kouritzin, 2022).

Higher-order models

A second-order HMM replaces

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)0

with

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)1

The transition parameter is

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)2

The dynamic-programming state must retain the previous pair:

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)3

Inference therefore increases from Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)4 to Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)5. The second-order belief HMM replaces probabilities with basic belief assignments, allowing mass on subsets of the hidden-state frame to represent imprecision, ignorance, and conflicting evidence. It uses belief-function combination, commonality representations, and pignistic transformation, but the proposed second-order belief model has no completed empirical evaluation and leaves conflict normalization and full parameter learning incompletely specified (Park et al., 2015).

Multivariate and graphical HMMs

Multiple Hidden Markov Models use a multivariate latent Markov chain and multiple observed categorical processes. An unrestricted multivariate latent state is equivalent to an ordinary HMM whose state space is the Cartesian product of the latent state spaces, but structured graphical restrictions provide parsimonious interpretations of dynamic dependence, contemporaneous association, common latent effects, and series-specific effects.

Linked MHMMs allow latent blocks to depend on their own past and associate observed blocks with corresponding latent blocks. Coupled MHMMs make latent blocks conditionally independent given the complete previous latent vector. Graphical independencies translate into linear zero restrictions on marginal log-linear interactions, allowing tests of noncausality, contemporaneous independence, local independence, invariant association, and additive latent effects (Colombi et al., 2013).

5. Nonstationary, recurrent, and nonparametric HMMs

A standard HMM assumes stationary transition and emission parameters. Several models relax this restriction.

An activity-driven HMM supplies known exogenous activity functions Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)6 and Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)7 that modulate transitions and emissions:

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)8

Q=(Q1,…,QT)Q=(Q_1,\ldots,Q_T)9

and

O=(O1,…,OT)O=(O_1,\ldots,O_T)0

with a residual probability for the no-emission symbol. Forward-backward inference remains standard after replacing O=(O1,…,OT)O=(O_1,\ldots,O_T)1 and O=(O1,…,OT)O=(O_1,\ldots,O_T)2 by O=(O1,…,OT)O=(O_1,\ldots,O_T)3 and O=(O1,…,OT)O=(O_1,\ldots,O_T)4. The EM M-step changes because the intensities occur in both off-diagonal and residual terms; state-specific scalar monotone equations are solved numerically. The model becomes an ordinary stationary HMM when O=(O1,…,OT)O=(O_1,\ldots,O_T)5 and O=(O1,…,OT)O=(O_1,\ldots,O_T)6 (Meyer et al., 2015).

The HMRNN embeds a conventional HMM into a recurrent neural network. Its recurrent computation exactly implements

O=(O1,…,OT)O=(O_1,\ldots,O_T)7

so the unaugmented HMRNN has the same likelihood and parameter interpretations as the corresponding HMM. Covariate-dependent neural modules can instead produce individualized initial distributions or modify transitions and emissions. The model can be trained by gradient descent rather than EM, permitting joint optimization of HMM quantities, patient covariates, and auxiliary predictive objectives (Baucum et al., 2020).

The recurrent sticky HDP-HMM combines Bayesian nonparametric state discovery with observation-dependent persistence. Its non-self transition distribution is drawn from an HDP, while the persistence probability is

O=(O1,…,OT)O=(O_1,\ldots,O_T)8

The transition distribution is

O=(O1,…,OT)O=(O_1,\ldots,O_T)9

Pólya–Gamma augmentation provides conditionally Gaussian updates for the logistic persistence parameters. Weak-limit Gibbs sampling uses forward-backward state-sequence updates with complexity πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.0 for πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.1 approximating states. This model extends the disentangled sticky HDP-HMM, which independently controls transition-row similarity, mean self-persistence, and heterogeneity of persistence across states (Zhou et al., 2020, Słupiński et al., 2024).

The πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.2-HMM specializes the transition matrix to equal exit probabilities:

πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.3

The filtering prediction becomes

πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.4

The scalar πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.5 controls the trade-off between retaining historical evidence and adapting to state changes. Small πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.6 yields greater stationary-environment accuracy but slower adaptation; larger πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.7 accelerates adaptation while producing a nonzero steady-state error floor. This model is standard HMM filtering under a restricted equal-exit transition structure rather than a general replacement for an arbitrary transition matrix (Sui et al., 2 Apr 2025).

6. Neural, algebraic, distributed, and application-specific HMMs

GenHMM replaces conventional state emissions with mixtures of normalizing-flow generators:

πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.8

Each generator is an invertible neural flow with exact density evaluation through the change-of-variables formula. The HMM forward-backward structure is unchanged; the additional latent generator index is handled through local responsibilities. EM updates the initial distribution, transition matrix, and generator-mixture weights in closed form, while flow parameters are optimized by stochastic gradient steps. The model preserves exact likelihood computation and was evaluated for phoneme classification on TIMIT, where it outperformed conventional GMM-HMM baselines in the reported experiments (Liu et al., 2019).

For language modeling, the very large neural HMM uses blocked emissions, neural parameterization, and state dropout. With πi=P(Q1=i),∑i=1Nπi=1.\pi_i=P(Q_1=i),\qquad \sum_{i=1}^{N}\pi_i=1.9 latent states divided into blocks of size aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),0, only the aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),1 states associated with the observed word can emit that word, reducing exact serial inference from aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),2 to aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),3. Neural embeddings and MLPs generate transition and emission scores rather than storing unconstrained parameter tables. On Penn Treebank and WikiText-2, the reported model improved over earlier HMM and n-gram systems but remained behind LSTM and AWD-LSTM baselines (Chiu et al., 2020).

Distributed HMM filtering places local observations at network agents. Each agent propagates its belief through the transition matrix, performs a local Bayesian update, and combines neighboring beliefs through a logarithmic opinion pool. Under strong connectivity, bounded log-likelihoods, positive initialization, and geometric ergodicity, the asymptotic discrepancy from centralized filtering is bounded in expected KL divergence. The bound depends on transition mixing, graph mixing, network size, and the observation-scaling parameter (Kayaalp et al., 2021).

HMMs have also been adapted to domain-specific systems:

  • Predictive maintenance: cool-down time is treated as a noisy observation of stable and degraded operating modes; filtering yields the posterior probability of degradation after each start-up (Baysse et al., 2012).
  • Human activity and visual intent: state-dependent observation linkages represent local motion patterns in visual action sequences (DelRose et al., 2011).
  • Financial regime detection: discretized or Gaussian emissions represent latent momentum states, while IOHMMs incorporate volatility and intraday seasonality as predictors of transitions (Christensen et al., 2020, Catello et al., 2023).
  • Cybersecurity: hidden states represent stages of an attack, observations represent user-visible or log-derived events, and Viterbi decoding reconstructs the most likely attack path (Dass et al., 2021).
  • LDPC decoding: a four-state HMM is constructed from pairs of encoded bits, with parity constraints incorporated into emission probabilities; iterative forward-backward smoothing produces soft bit information (Olivier et al., 26 Sep 2025).
  • Disease progression: latent health states generate noisy diagnostic categories, while recurrent neural modules incorporate patient covariates and auxiliary clinical predictions (Baucum et al., 2020).

These applications demonstrate that the HMM formalism can serve as a latent-state model, a filtering algorithm, a structured neural computation, a graph-based message-passing device, or a domain-specific representation of temporal constraints. The validity of each interpretation depends on whether the chosen state space, transition structure, emission model, and observation process adequately represent the application.

7. Limitations, model selection, and continuing developments

The principal limitation of a conventional HMM is the restrictive conditional-independence structure. It cannot directly represent dependence such as aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),4, higher-order state dependence, arbitrary duration distributions, or observation processes with serial dependence. Extensions such as observation-linkage HMMs, Markov Observation Models, second-order HMMs, autoregressive emissions, activity-driven transitions, and recurrent sticky HDP-HMMs address different forms of this limitation.

A second limitation is parameter growth and estimation. Adding observation-linkage matrices introduces aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),5 parameters; second-order transitions introduce aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),6 transition parameters; belief-function models can require representations over aij=P(Qt+1=j∣Qt=i),a_{ij}=P(Q_{t+1}=j\mid Q_t=i),7 subsets; and nonparametric models require MCMC or truncation choices. Sparse data can produce zero or poorly estimated probabilities, while flexible emissions and large state spaces increase overfitting risk.

A third limitation is optimization. Baum–Welch guarantees likelihood non-decrease under its standard conditions but not global optimality. Neural, Bayesian, and structured extensions inherit local optima, label symmetries, sensitivity to initialization, and possible posterior multimodality. Bayesian nonparametric methods replace fixed state-number selection with hyperparameter and inference choices, such as weak-limit truncation or beam sampling. Model selection may use likelihood, penalized likelihood, cross-validation, marginal likelihood, AIC, predictive negative log-likelihood, or application-specific metrics.

A fourth limitation concerns interpretation. Hidden states are latent explanatory constructs, not necessarily physically observable entities. Observation-linkage terms do not imply physical causality between observations, and latent-state labels are arbitrary up to permutation. Algebraic invariants describe distributional constraints but do not alone establish valid stochastic membership. In application-specific systems, manually constructed transition and emission probabilities may encode expert knowledge rather than empirical frequencies.

Despite these limitations, HMMs remain important because their latent-state semantics, dynamic-programming inference, filtering and smoothing recursions, and EM learning procedures are mathematically explicit. Contemporary work combines these properties with algebraic geometry, graphical restrictions, neural generative emissions, large-state parameter sharing, Bayesian nonparametrics, recurrent covariate dependence, distributed inference, and categorical probability. The resulting research direction is not a single replacement for the classical HMM, but a family of extensions that preserve its central separation between latent dynamics and observations while relaxing the assumptions most restrictive for particular sequential-data problems.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Hidden Markov Model.