Statistical Machine Translation Foundations › Decoding
Language AI HandbookAll chapters Unrestricted phrase-based decoding is NP-hard. Knight (1999) proved hardness for word-based models, and Chang and Collins (2017) discuss the phrase-based setting and a dynamic program with a fixed distortion limit. A decoder can constrain the search by limiting the jump to the next input span.
Beam Search over Coverage Vectors
The standard algorithm is a variant of stack decoding. A state consists of:
- A coverage vector: a bitmask over source positions, recording which source words have been translated.
- The last source position covered, needed to score distortion.
- The last few target words produced, needed to score the language model incrementally.
- Accumulated feature values and a backpointer to the predecessor state.
A bitmask of the consumed positions in the input. The decoder rejects any new phrase span that overlaps a set bit. Future distortion and fluency scores also depend on the source end position and the target language model state.
For each hypothesis, choose an uncovered input position and try each allowed contiguous span starting there. Append a candidate target phrase, update the coverage mask, and add its feature scores. For a bigram language model, the first word of the new phrase is scored from the previous target word. Later words in the phrase are scored from their predecessors within that phrase.
Stack decoding groups hypotheses by how many input words they cover. Separately, exact recombination for a first-best search can retain only the best-scoring prefix when the hypotheses agree in every field that determines their legal continuations and future scores. In the basic phrase model below, those fields are the coverage mask, the last input phrase end, and the target language model context. A bigram model needs the previous target word. Each stack can then be pruned using either of these strategies. Moses manual, sections 6.2.3–6.2.4.
- Histogram pruning: keep only the top hypotheses per stack.
- Threshold pruning: discard hypotheses whose score is worse than the best in the stack by more than a fixed margin.
A beam can rank partial hypotheses using their accumulated score plus an estimate for the uncovered spans. The standard phrase-based heuristic precomputes estimates by dynamic programming, approximates the missing target context, and omits distortion in the estimate. Those approximations give no guarantee of an upper bound on the best remaining log score. For exact A* search, an admissible heuristic would have to supply that upper bound, or equivalently a lower bound on the remaining negative-log cost. Koehn, Och, and Marcu (2003), section 2.2, Moses manual, sections 6.2.4–6.2.5.
The decoder ranks completed hypotheses after adding the language model's end-of-sentence log score. A bigram model conditions it on the final target word.
Reordering Limits and Pruning
A hard distortion limit bounds the jump to the next input span and can rule out some reorderings. A conventional coverage-bitmask decoder still tracks which input positions are open. A fixed jump limit alone can leave exponentially many reachable masks for that representation. Chang and Collins (2017), section 5.2.
Pre-reordering permutes the source sentence before translation. Syntactic translation models, such as Galley et al. (2004), use tree structure to inform translation rules. A hard distance limit and a syntax-based rule offer different ways to constrain reorderings.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!