Hidden Markov Models › The Two HMM Assumptions

Michael BrenndoerferUpdated May 7, 20255 min read
Language AI HandbookAll chapters
Part 6 of 67Sequence Labeling
Chapter 40Hidden Markov Models › The Two HMM Assumptions
Reading section 3 of 13 · The Two HMM Assumptions · 5 minSection 3 of 13 · 5 min

Book contents

Section 3 of 13 · 5 min read

Hidden Markov Models › The Two HMM AssumptionsOne section · Sections in this chapter3 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

HMMs make two key independence assumptions that simplify computation. These assumptions trade off modeling power for tractability. Without them, exact inference over sequences would require considering every possible combination of hidden states, which grows exponentially with sequence length. With them, dynamic programming algorithms like Viterbi can find exact solutions in polynomial time. Understanding these assumptions deeply will help you know when HMMs are appropriate and when you need a more expressive model.

The Markov Assumption

The first assumption is the Markov property: the probability of transitioning to a state depends only on the current state, not on the full history.

P(st ∣ s1,s2,…,st−1)=P(st ∣ st−1)P(s_t \,|\, s_1, s_2, \ldots, s_{t-1}) = P(s_t \,|\, s_{t-1})

where:

  • sts_t: the state at position tt (what we want to predict)
  • s1,s2,…,st−1s_1, s_2, \ldots, s_{t-1}: the full history of previous states
  • st−1s_{t-1}: only the immediately preceding state

The equation states that knowing the entire history provides no additional information beyond knowing just the previous state. For POS tagging, this means the probability of a tag depends only on the previous tag, not on tags from earlier in the sentence. If the previous tag is DT (determiner), the probability of NN (noun) is the same regardless of what came before the determiner.

This is a strong assumption. Consider "the old old man" versus "the very old man." After seeing "old" once, the probability of another adjective might differ from seeing "old" for the first time. A first-order HMM cannot capture this distinction. Higher-order HMMs condition on the previous two or three tags rather than just one, which helps. A second-order HMM replaces P(st∣st−1)P(s_t \mid s_{t-1}) with P(st∣st−2,st−1)P(s_t \mid s_{t-2}, s_{t-1}), giving the model memory of the last two tags. The downside is that the transition table grows quadratically with tag set size: for ∣S∣|S| tags, a first-order model has ∣S∣2|S|^2 transition parameters, while a second-order model has ∣S∣3|S|^3. For a 40-tag set like Penn Treebank, that difference is 1,600 versus 64,000 parameters, requiring substantially more training data for reliable estimates.

The Output Independence Assumption

The second assumption is output independence: the probability of an observation depends only on the current state, not on other observations or states.

P(ot ∣ s1,…,sn,o1,…,ot−1,ot+1,…,on)=P(ot ∣ st)P(o_t \,|\, s_1, \ldots, s_n, o_1, \ldots, o_{t-1}, o_{t+1}, \ldots, o_n) = P(o_t \,|\, s_t)

where:

  • oto_t: the observation at position tt (the word we see)
  • s1,…,sns_1, \ldots, s_n: all hidden states in the sequence
  • o1,…,ot−1,ot+1,…,ono_1, \ldots, o_{t-1}, o_{t+1}, \ldots, o_n: all other observations (past and future words)
  • sts_t: only the current hidden state

The equation states that the probability of emitting a particular word depends solely on the current tag, not on any surrounding context. For POS tagging, this means the word "bank" has the same emission probability from the NN state regardless of surrounding words. The model cannot use the context "river bank" to increase the probability of the noun interpretation, nor can it use "bank account" to do the same. All disambiguation must happen indirectly through transition probabilities.

This is perhaps the most consequential limitation of HMMs for NLP. In natural language, the meaning and function of a word are heavily influenced by its neighbors. The word "light" is more likely an adjective after "a" and before "lunch" than after "switch" and before "on." A model that ignores this surrounding evidence will make systematic errors on ambiguous words. Conditional Random Fields, which you will study in a later chapter, address exactly this limitation by allowing the model to condition on arbitrary features of the surrounding context when making labeling decisions.

In[5]:
Code
# Demonstrating the Markov assumption
# P(NN | DT) is the same regardless of history

# History 1: Started with DT
history_1 = ["DT"]
# History 2: Started with VB, then DT
history_2 = ["VB", "DT"]

# Under Markov assumption, both give same P(NN | DT)
prob_nn_given_dt = A["DT"]["NN"]
Out[6]:
Console
The Markov Assumption in Action
----------------------------------------
History 1: ['DT']
History 2: ['VB', 'DT']

P(next=NN | current=DT) = 0.8

Both histories give the same probability because
HMM only conditions on the immediately previous state.

These assumptions enable efficient algorithms for inference and learning. The Viterbi algorithm (covered in the next chapter) finds the most likely state sequence in O(n⋅∣S∣2)O(n \cdot |S|^2) time, where nn is the sequence length and ∣S∣|S| is the number of states. Without these assumptions, exact inference would require exponential time. The Markov assumption is what allows the Viterbi algorithm to break the global optimization into independent subproblems: once you know the best way to reach state ii at position tt, you do not need to remember how you got there to compute the best way to reach any state at position t+1t+1. That "forgetfulness" is not a bug; it is the computational feature that makes the algorithm feasible.