Weighted automata and hidden Markov models
An unweighted automaton records whether a path exists. But what if some paths should count more than others? A weighted finite state automaton (WFSA) associates a weight with each transition and combines those weights along and across paths (Mohri 1997; Mohri et al. 2002).
Path and string weights
Let \(w(e)\) be the weight of transition \(e\). We use \(\otimes\) to combine the transitions on a path and \(\oplus\) to combine alternative paths. If \(\pi=e_1\ldots e_n\) runs from \(q_0\) to \(q_n\), with initial weight \(\lambda(q_0)\) and final weight \(\rho(q_n)\), then
\[w(\pi)=\lambda(q_0)\otimes w(e_1)\otimes\cdots\otimes w(e_n)\otimes\rho(q_n).\]
An unweighted initial or final state has the multiplicative-identity weight, so those factors may be omitted in the simpler presentation.
The weight assigned to a string \(x\) is the sum of the weights of all successful paths labeled \(x\):
\[w(x)=\bigoplus_{\pi\,:\,\operatorname{label}(\pi)=x}w(\pi).\]
The set that supplies the weights together with \(\oplus\), \(\otimes\), and their identity elements is a semiring. This abstraction lets the same automaton algorithms operate over probabilities, log probabilities, or costs (Mohri et al. 2002). Two semirings will be useful here:
- In the probability semiring, \(\oplus=+\) and \(\otimes=\times\). The weight of a string is the total probability of all of its paths.
- In the tropical semiring, \(\oplus=\min\) and \(\otimes=+\). The weight of a string is the cost of its least-cost path.
The forward algorithm computes the first quantity (Rabiner 1989). The Viterbi algorithm computes the best-path version, which corresponds to replacing a sum over paths with the tropical-semiring best-path calculation (Mohri et al. 2002).
Two paths labeled \(x\) have probabilities \(.2\) and \(.3\). What probability does the WFSA assign to \(x\)? What would Viterbi return?
The forward calculation assigns \(.2+.3=.5\) to \(x\). Viterbi returns the more probable path and its probability, \(.3\).
Weighted transducers
A weighted FST assigns a weight to each input-output pair, and composition combines rule systems using the operations of the chosen semiring (Mohri 1997; Mohri et al. 2002). In a phonological grammar, we can interpret unequal weights as preferences among surface realizations or underlying analyses without excluding the alternatives.
Weighted automata thus connect two earlier parts of the course. The finite state machinery supplies the paths, and the probability model supplies a measure over them. Determinization, minimization, and weight pushing can make these machines smaller or faster, though weighted determinization is not guaranteed to terminate for every transducer (Mohri 1997; Mohri et al. 2002). We will use that connection when HMMs assign morpheme-boundary labels in the section on structured prediction.