encyclopegia.org

Viterbi algorithm

The Viterbi algorithm is a dynamic programming algorithm that finds the most likely sequence of hidden events that would explain a sequence of observed events. The result of the algorithm is often called the Viterbi path. It is most commonly used with hidden Markov models (HMMs). For example, if a doctor observes a patient's symptoms over several days (the observed events), the Viterbi algorithm could determine the most probable sequence of underlying health conditions (the hidden events) that caused those symptoms. The algorithm has found universal application in decoding the convolutional codes used in both CDMA and GSM digital cellular, dial-up modems, satellite, deep-space communications, and 802.11 wireless LANs. It is also commonly used in speech recognition, speech synthesis, diarization, keyword spotting, computational linguistics, and bioinformatics. For instance, in speech-to-text (speech recognition), the acoustic signal is the observed sequence, and a string of text is the "hidden cause" of that signal. The Viterbi algorithm finds the most likely string of text given the acoustic signal.

The Viterbi algorithm is a dynamic programming algorithm that finds the most likely sequence of hidden events that would explain a sequence of observed events. The result of the algorithm is often called the Viterbi path. It is most commonly used with hidden Markov models (HMMs). For example, if a doctor observes a patient's symptoms over several days (the observed events), the Viterbi algorithm could determine the most probable sequence of underlying health conditions (the hidden events) that caused those symptoms. The algorithm has found universal application in decoding the convolutional codes used in both CDMA and GSM digital cellular, dial-up modems, satellite, deep-space communications, and 802.11 wireless LANs. It is also commonly used in speech recognition, speech synthesis, diarization, keyword spotting, computational linguistics, and bioinformatics. For instance, in speech-to-text (speech recognition), the acoustic signal is the observed sequence, and a string of text is the "hidden cause" of that signal. The Viterbi algorithm finds the most likely string of text given the acoustic signal. P_{t,s} = \begin{cases} \pi_s \cdot b_{s,o_t} & \text{if } t=0, \\ \max_{r \in S} \left(P_{t-1,r} \cdot a_{r,s} \cdot b_{s,o_t} \right) & \text{if } t>0. \end{cases} The formula for Q_{t,s} is identical for t>0 , except that \max is replaced with \arg\max , and Q_{0,s} = 0 . The Viterbi path can be found by selecting the maximum of P at the final timestep, and following Q in reverse. prob[0][s] = init[s] * emit[s][obs[0 for t = 1 to T - 1 inclusive do // t = 0 has been dealt with already for each state s in states do for each state r in states do new_prob ← prob[t - 1][r] * trans[r][s] * emit[s][obs[t if new_prob > prob[t][s] then prob[t][s] ← new_prob prev[t][s] ← r path ← empty array of length T path[T - 1] ← the state s with maximum prob[T - 1][s] for t = T - 2 to 0 inclusive do path[t] ← prev[t + 1][path[t + 1 return path end The time complexity of the algorithm is O(T\times\left|{S}\right|^2) . If it is known which state transitions have non-zero probability, an improved bound can be found by iterating over only those r which link to s in the inner loop. Then using amortized analysis one can show that the complexity is O(T\times(\left|{S}\right| + \left|{E}\right|)) , where E is the number of edges in the graph, i.e. the number of non-zero entries in the transition matrix. init = {"Healthy": 0.6, "Fever": 0.4} trans = { "Healthy": {"Healthy": 0.7, "Fever": 0.3}, "Fever": {"Healthy": 0.4, "Fever": 0.6}, } emit = { "Healthy": {"normal": 0.5, "cold": 0.4, "dizzy": 0.1}, "Fever": {"normal": 0.1, "cold": 0.3, "dizzy": 0.6}, } In this code, init represents the doctor's belief about how likely the patient is to be healthy initially. Note that the particular probability distribution used here is not the equilibrium one, which would be {'Healthy': 0.57, 'Fever': 0.43} according to the transition probabilities. The transition probabilities trans represent the change of health condition in the underlying Markov chain. In this example, a patient who is healthy today has only a 30% chance of having a fever tomorrow. The emission probabilities emit represent how likely each possible observation (normal, cold, or dizzy) is, given the underlying condition (healthy or fever). A patient who is healthy has a 50% chance of feeling normal; one who has a fever has a 60% chance of feeling dizzy. A particular patient visits three days in a row, and reports feeling normal on the first day, cold on the second day, and dizzy on the third day. Firstly, the probabilities of being healthy or having a fever on the first day are calculated. The probability that a patient will be healthy on the first day and report feeling normal is 0.6 \times 0.5 = 0.3 . Similarly, the probability that a patient will have a fever on the first day and report feeling normal is 0.4 \times 0.1 = 0.04 . The probabilities for each of the following days can be calculated from the previous day directly. For example, the highest chance of being healthy on the second day and reporting to be cold, following reporting being normal on the first day, is the maximum of 0.3 \times 0.7 \times 0.4 = 0.084 and 0.04 \times 0.4 \times 0.4 = 0.0064 . This suggests it is more likely that the patient was healthy for both of those days, rather than having a fever and recovering. The rest of the probabilities are summarised in the following table: From the table, it can be seen that the patient most likely had a fever on the third day. Furthermore, there exists a sequence of states ending on "fever", of which the probability of producing the given observations is 0.01512. This sequence is precisely (healthy, healthy, fever), which can be found be tracing back which states were used when calculating the maxima (which happens to be the best guess from each day but will not always be). In other words, given the observed activities, the patient was most likely to have been healthy on the first day and on the second day (despite feeling cold that day), and only to have contracted a fever on the third day. The operation of Viterbi's algorithm can be visualized by means of a trellis diagram. The Viterbi path is essentially the shortest path through this trellis.

References

  1. Speaker Diarization: A Review of Recent Research · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Speaker Diarization: A Review of Recent Research." Xavier Anguera et al. 2026-11-18. http://www1.icsi.berkeley.edu/~vinyals/Files/taslp2011a.pdf. Accessed 24 November 2026.

    Chicago "Speaker Diarization: A Review of Recent Research." Xavier Anguera et al. 2026-11-18. http://www1.icsi.berkeley.edu/~vinyals/Files/taslp2011a.pdf.

    APA Xavier Anguera et al. (2026). Speaker Diarization: A Review of Recent Research. Retrieved November 24, 2026, from http://www1.icsi.berkeley.edu/~vinyals/Files/taslp2011a.pdf

  2. A fast maximum-likelihood decoder for convolutional codes (PDF) . Vehicular Technology Conference . December 2002. pp. 371– 375. doi : 10.1109/VETECF.2002.1040367 . Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "A fast maximum-likelihood decoder for convolutional codes (PDF) . Vehicular Technology Conference . December 2002. pp. 371– 375. doi : 10.1109/VETECF.2002.1040367 . Wikipedia revision 1375500441, retrieved 2026-11-19." A fast maximum-likelihood decoder for convolutional codes (PDF). 2026-11-18. http://people.csail.mit.edu/jonfeld/pubs/lazyviterbi.pdf. Accessed 24 November 2026.

    Chicago "A fast maximum-likelihood decoder for convolutional codes (PDF) . Vehicular Technology Conference . December 2002. pp. 371– 375. doi : 10.1109/VETECF.2002.1040367 . Wikipedia revision 1375500441, retrieved 2026-11-19." A fast maximum-likelihood decoder for convolutional codes (PDF). 2026-11-18. http://people.csail.mit.edu/jonfeld/pubs/lazyviterbi.pdf.

    APA A fast maximum-likelihood decoder for convolutional codes (PDF). (2026). A fast maximum-likelihood decoder for convolutional codes (PDF) . Vehicular Technology Conference . December 2002. pp. 371– 375. doi : 10.1109/VETECF.2002.1040367 . Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from http://people.csail.mit.edu/jonfeld/pubs/lazyviterbi.pdf

  3. 29 Apr 2005, G. David Forney Jr: The Viterbi Algorithm: A Personal History Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "29 Apr 2005, G. David Forney Jr: The Viterbi Algorithm: A Personal History Wikipedia revision 1375500441, retrieved 2026-11-19." Apr 2005, G. 2026-11-18. https://arxiv.org/abs/cs/0504020v2. Accessed 24 November 2026.

    Chicago "29 Apr 2005, G. David Forney Jr: The Viterbi Algorithm: A Personal History Wikipedia revision 1375500441, retrieved 2026-11-19." Apr 2005, G. 2026-11-18. https://arxiv.org/abs/cs/0504020v2.

    APA Apr 2005, G. (2026). 29 Apr 2005, G. David Forney Jr: The Viterbi Algorithm: A Personal History Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from https://arxiv.org/abs/cs/0504020v2

  4. Schmid, Helmut (2004). Efficient parsing of highly ambiguous context-free grammars with bit vectors (PDF) . Proc. 20th Int'l Conf. on Computational Linguistics (COLING). doi : 10.3115/1220355.1220379 . Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Schmid, Helmut (2004). Efficient parsing of highly ambiguous context-free grammars with bit vectors (PDF) . Proc. 20th Int'l Conf. on Computational Linguistics (COLING). doi : 10.3115/1220355.1220379 . Wikipedia revision 1375500441, retrieved 2026-11-19." Schmid, Helmut (2004). 2026-11-18. http://www.aclweb.org/anthology/C/C04/C04-1024.pdf. Accessed 24 November 2026.

    Chicago "Schmid, Helmut (2004). Efficient parsing of highly ambiguous context-free grammars with bit vectors (PDF) . Proc. 20th Int'l Conf. on Computational Linguistics (COLING). doi : 10.3115/1220355.1220379 . Wikipedia revision 1375500441, retrieved 2026-11-19." Schmid, Helmut (2004). 2026-11-18. http://www.aclweb.org/anthology/C/C04/C04-1024.pdf.

    APA Schmid, Helmut (2004). (2026). Schmid, Helmut (2004). Efficient parsing of highly ambiguous context-free grammars with bit vectors (PDF) . Proc. 20th Int'l Conf. on Computational Linguistics (COLING). doi : 10.3115/1220355.1220379 . Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from http://www.aclweb.org/anthology/C/C04/C04-1024.pdf

  5. Klein, Dan; Manning, Christopher D. (2003). A* parsing: fast exact Viterbi parse selection (PDF) . Proc. 2003 Conf. of the North American Chapter of the Association for Computational Linguistics on Human Language Technology (NAACL). pp. 40– 47. doi : 10.3115/1073445.1073461 . Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Klein, Dan; Manning, Christopher D. (2003). A* parsing: fast exact Viterbi parse selection (PDF) . Proc. 2003 Conf. of the North American Chapter of the Association for Computational Linguistics on Human Language Technology (NAACL). pp. 40– 47. doi : 10.3115/1073445.1073461 . Wikipedia revision 1375500441, retrieved 2026-11-19." Klein, Dan; Manning, Christopher D. 2026-11-18. http://ilpubs.stanford.edu:8090/532/1/2002-16.pdf. Accessed 24 November 2026.

    Chicago "Klein, Dan; Manning, Christopher D. (2003). A* parsing: fast exact Viterbi parse selection (PDF) . Proc. 2003 Conf. of the North American Chapter of the Association for Computational Linguistics on Human Language Technology (NAACL). pp. 40– 47. doi : 10.3115/1073445.1073461 . Wikipedia revision 1375500441, retrieved 2026-11-19." Klein, Dan; Manning, Christopher D. 2026-11-18. http://ilpubs.stanford.edu:8090/532/1/2002-16.pdf.

    APA Klein, Dan; Manning, Christopher D. (2026). Klein, Dan; Manning, Christopher D. (2003). A* parsing: fast exact Viterbi parse selection (PDF) . Proc. 2003 Conf. of the North American Chapter of the Association for Computational Linguistics on Human Language Technology (NAACL). pp. 40– 47. doi : 10.3115/1073445.1073461 . Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from http://ilpubs.stanford.edu:8090/532/1/2002-16.pdf

  6. AUGUSTUS: Ab initio prediction of alternative transcripts · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "AUGUSTUS: Ab initio prediction of alternative transcripts." Stanke, M. 2026-11-18. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1538822. Accessed 24 November 2026.

    Chicago "AUGUSTUS: Ab initio prediction of alternative transcripts." Stanke, M. 2026-11-18. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1538822.

    APA Stanke, M. (2026). AUGUSTUS: Ab initio prediction of alternative transcripts. Retrieved November 24, 2026, from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1538822

  7. Maximum Likelihood Track Formation with the Viterbi Algorithm · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Maximum Likelihood Track Formation with the Viterbi Algorithm." Quach, T. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier). Accessed 24 November 2026.

    Chicago "Maximum Likelihood Track Formation with the Viterbi Algorithm." Quach, T. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier).

    APA Quach, T. (2026). Maximum Likelihood Track Formation with the Viterbi Algorithm. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Doi_(identifier)

  8. Xing E, slide 11. Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Xing E, slide 11. Wikipedia revision 1375500441, retrieved 2026-11-19." Xing E, slide 11. 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1375500441. Accessed 24 November 2026.

    Chicago "Xing E, slide 11. Wikipedia revision 1375500441, retrieved 2026-11-19." Xing E, slide 11. 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1375500441.

    APA Xing E, slide 11. (2026). Xing E, slide 11. Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375500441

  9. Iterative Viterbi Decoding, Trellis Shaping, and Multilevel Structure for High-Rate Parity-Concatenated TCM · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "Iterative Viterbi Decoding, Trellis Shaping, and Multilevel Structure for High-Rate Parity-Concatenated TCM." Qi Wang; Lei Wei; Rodney A. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier). Accessed 24 November 2026.

    Chicago "Iterative Viterbi Decoding, Trellis Shaping, and Multilevel Structure for High-Rate Parity-Concatenated TCM." Qi Wang; Lei Wei; Rodney A. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier).

    APA Qi Wang; Lei Wei; Rodney A. (2026). Iterative Viterbi Decoding, Trellis Shaping, and Multilevel Structure for High-Rate Parity-Concatenated TCM. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Doi_(identifier)

  10. a b Daniel Jurafsky; James H. Martin. Speech and Language Processing . Pearson Education International. p. 246. Wikipedia revision 1375500441, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1375500441
    Cite this reference

    MLA "a b Daniel Jurafsky; James H. Martin. Speech and Language Processing . Pearson Education International. p. 246. Wikipedia revision 1375500441, retrieved 2026-11-19." a b Daniel Jurafsky; James H. 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1375500441. Accessed 24 November 2026.

    Chicago "a b Daniel Jurafsky; James H. Martin. Speech and Language Processing . Pearson Education International. p. 246. Wikipedia revision 1375500441, retrieved 2026-11-19." a b Daniel Jurafsky; James H. 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1375500441.

    APA a b Daniel Jurafsky; James H. (2026). a b Daniel Jurafsky; James H. Martin. Speech and Language Processing . Pearson Education International. p. 246. Wikipedia revision 1375500441, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375500441

Cite this article

MLA

"Viterbi algorithm." encyclopegia.org, 2026, https://encyclopegia.org/wiki/viterbi-algorithm. Accessed 24 November 2026.

Chicago

"Viterbi algorithm." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/viterbi-algorithm.

APA

encyclopegia.org. (2026). Viterbi algorithm. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/viterbi-algorithm

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Johns Hopkins Hospital

enwiki · references available

Canada goose

enwiki · references available

Hanbali school

enwiki · references available

Population genetics

enwiki · references available

Codon usage bias

enwiki · references available

Mimid

enwiki · references available

Syriac Orthodox Church

enwiki · references available

United Mine Workers of America

enwiki · references available

California State University, San Bernardino

enwiki · references available

Nayarit

enwiki · references available

Querétaro

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1375500441 · 0.5 · snapshot enwiki-001375500441

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.