Statistical Machine Translation Foundations › Word Alignment
Language AI HandbookAll chapters A parallel corpus gives you sentence pairs with the word links unobserved. The IBM equations below use for the sentence the alignment model conditions on and for the sentence it generates. In the noisy-channel scoring direction above, is the candidate translation and is the observed input. In the English–Zeta fixture below, the forward aligner conditions on the English input and generates Zeta. The same alignment equations work in either direction.
An IBM alignment maps each generated position to a conditioning position. If , then token generates token . The indices are:
- assigns one conditioning position to each generated position.
- is the conditioning position assigned to generated position .
- ranges from to , with denoting NULL.
- is the conditioning token at position .
- is the generated token at position .
The conditioning sentence gets an extra position for generated tokens without an aligned conditioning word. This covers some articles, particles, morphological differences, and insertions caused by stylistic or tokenization differences.
Token correspondence across the two sentences can be many-to-many. A directional IBM model assigns each generated position to one conditioning position, which may be NULL. Combining two directional models can recover a richer set of links.
Each generated token has one parent in a directional IBM model. The worked pipeline combines predictions from two directions to allow several links at a token. The symmetrization step below shows how.
The IBM models use latent alignments to estimate lexical probabilities from sentence-level bitext. In a phrase-based pipeline, the resulting links determine which spans are eligible for phrase extraction. A misplaced link can block an otherwise eligible phrase pair.
IBM Model 1
Model 1 makes the most brutal simplification possible: it ignores word order entirely and assumes every alignment is equally likely.
The generative story is:
- Condition on a generated length . To assign probabilities across lengths, specify a separate distribution for .
- For each generated position , choose a conditioning position uniformly.
- Generate from with probability .
The variables are:
- is the generated sentence length.
- indexes generated tokens from to .
- is the conditioning position assigned to generated position .
- is the number of conditioning tokens excluding NULL.
- is the lexical probability of emitting given .
Because the alignment is uniform over the possible functions, summing over alignments gives
where:
- : the normalized probability of the generated length, held fixed while fitting lexical parameters
- : the number of possible alignments, since each generated position independently selects one of conditioning positions (including NULL)
- : the lexical probability that conditioning token emits generated token
- : the extra conditioning position that can emit insertions
At fixed generated length , the prior gives each of the alignments probability . Conditional on an alignment, the generated tokens contribute . Multiplying gives . Sum over alignments and multiply by the normalized length probability to obtain the marginal above. For their Model 1 fit, Brown et al. used the same positive factor for every generated length and conditioning sentence. A positive constant over unbounded lengths gives an unnormalized score. Over a set of allowed lengths, a constant of gives a uniform length distribution. Brown et al. (1993), §4.1
Each lexical factor depends only on the link at one generated position. The sum over the possible alignments therefore becomes a product of per-position sums. With , direct enumeration visits alignments, exponential in . Model 1 evaluates the per-position sums in . The HMM below has dependent links and uses a recurrence to sum its paths.
The exponential growth in the number of alignments is the reason the factoring property matters. The figure makes the scale of the enumeration problem visible.
PythonIn [3]Expand
import numpy as np
from book_plot_style import PALETTE
sentence_lengths = np.arange(1, 11)
source_lengths = [4, 9, 19]
alignment_counts = np.array(
[
[(length + 1) ** n for n in sentence_lengths]
for length in source_lengths
],
dtype=float,
)
series_labels = [f"source length {length}" for length in source_lengths]
series_colors = [PALETTE["primary"], PALETTE["amber"], PALETTE["muted"]]
series = list(zip(series_labels, alignment_counts, series_colors))VisualizationOut [4]Expand

The lexical table has one entry per pair of conditioning and generated word types. Two 50,000-word vocabularies give 2.5 billion entries before adding a NULL row. Each normalized row has one fewer independent parameter than entries. In unsmoothed Model 1, a word pair absent from all cross-sentence co-occurrences receives zero expected count. For rows with positive total count, those absent pairs get zero probability in the M-step.
When the model assigns positive probability to the observed sentence pair, the common length factor cancels from the alignment posterior and leaves the best alignment unchanged. With the factor held fixed, its logarithm adds a constant to the lexical objective and leaves the EM updates unchanged.
Learning Alignment with EM
We never observe , so we use expectation maximization. The derivation follows the standard latent-variable recipe, and it is worth walking through because the update has an unusually clean form.
If we knew the alignments, we could count links for each lexical pair and normalize each conditioning row. If we knew the lexical probabilities, Model 1 would let us find a most probable alignment by picking a highest-scoring conditioning position for each generated token. EM uses the current posterior to allocate fractional counts, then re-estimates the lexical probabilities.
The E-step evaluates . For Model 1 this posterior factors over generated positions. Positive probability for the observed pair under the current parameters ensures every denominator below is positive. For each position , the posterior probability that its parent is position is
where:
- : the latent conditioning position that generated position
- : a candidate conditioning position from through , including NULL
- : the current lexical probability of emitting from
- : the sum over all conditioning positions
Let be the corpus of sentence pairs, counted with multiplicity, and let denote the expected complete-data log-likelihood:
Since is a sum of terms plus fixed terms, the M-step can operate on expected counts. For one sentence pair, sum the posterior contributions for all matching tokens and positions:
The masses for one generated occurrence sum to one across conditioning positions. The count aggregates occurrences by word type. If a generated word occurs twice or a conditioning word occupies two positions, each occurrence contributes separately.
where:
- : expected number of links from type to type for this sentence pair
- : the current lexical probability of emitting type from type
- : each contribution uses the tokens at the selected positions
- : the sum at this generated position includes NULL at
The M-step sums these expected counts over the corpus and normalizes each row with positive total count:
The E-step costs per sentence pair because the posterior factors over generated positions. The IBM training sequence used simpler models to initialize richer ones.
Two properties matter for interpreting results:
- Exact EM never decreases the observed-data likelihood. A uniform positive initialization allows observed co-occurrences to accumulate positive counts.
- The posterior is normalized over conditioning positions for each generated occurrence. Two positions with identical conditioning tokens receive equal posterior mass for that occurrence.
EM maximizes a lower bound given by the expected complete-data log-likelihood plus the entropy of the current alignment posterior. The bound touches the observed log-likelihood at the current parameters. In Model 1 the observed log-likelihood is, up to fixed terms, a sum of logs of positive affine functions of the lexical probabilities. It is concave over the row simplices, so any local maximum on that feasible set is global, although multiple maximizers can exist. This property of Model 1 does not apply to every model trained with EM.
If the conditioning sentence contains two copies of “the,” their contributions to each generated article's posterior are equal. Other positions, including NULL, compete through their lexical probabilities. Model 1 cannot choose between those two copies from position alone.
Adding Word Order: IBM Model 2
Model 1 gives the same alignment prior to every conditioning position. Model 2 can learn, for example, that a generated token at position 3 tends to align near the start in a given length pair.
Model 2 replaces the uniform prior with , the probability of choosing conditioning position for generated position :
The sum still factors over generated positions. Expected counts for accumulate separately for each generated position and length pair, then normalize over conditioning positions. A table fitted for one length pair does not directly supply a row for another. Sharing parameters, as in the diagonal prior used by fast_align, can reduce this dependence on individual length pairs.
Train an English-conditioned model and a French-conditioned model separately to estimate two sets of positional probabilities. When their Viterbi predictions are converted to a common pair of axes, they can disagree.
An absolute-position table can learn that position 20 frequently aligns to position 22 and that position 3 frequently aligns to position 5. Its rows fit those tendencies separately. The HMM below shares a displacement score across positions and conditions on the previous link.
HMM Alignment
To condition each link on the preceding one, use a first-order Markov chain. Vogel, Ney, and Tillmann (1996) proposed this alignment model. The simplified joint below conditions on the generated length .
One way to parameterize the transition is to assign a nonnegative score to a displacement and normalize over the available destinations:
The jump score depends on displacement. The normalized transition probability can still vary with absolute position because some destinations are unavailable near the ends of the source sentence.
As in the hidden Markov models in Part VI: Sequence Labeling, forward-backward computes alignment posteriors and Viterbi recovers a highest-scoring alignment. In this simplified recurrence, the generated positions are time steps and the conditioning positions are states, counting NULL. There is also a start distribution for the first link. Scanning all ordered state pairs at each step costs , compared with complete alignment paths. Lexical probabilities supply the emission scores.
HMM alignment learns jumps from one alignment position to the next. fast_align uses a different prior, a log-linear reparameterization of IBM Model 2 that favors the diagonal while choosing each generated position's link independently. Dyer, Chahuneau, and Smith (2013), sections 2–3.
Fertility, Distortion, and IBM Models 3–5
In Models 1 and 2 and the HMM formulation above, each generated position chooses one conditioning position. Several generated positions can choose the same one. The number of generated positions that choose a conditioning token is its fertility.
A concrete example makes the gap obvious. Translating English "the" into a language without articles, or translating a compound German noun into an English multiword phrase, requires dropping or expanding a single source word into zero or several target words. Models 1 and 2 can technically represent these outcomes, since a source word may be selected zero or many times, but they have no parameter that says "this word usually expands into two target words." The count is emergent noise rather than modeled structure.
Model 3 represents fertility explicitly. The joint weight of a sentence and alignment is the following term of Brown et al.'s marginalization. The formula applies to alignments with . Brown et al. (1993), section 4.4, equations 31–32.
The terms distinguish ordinary fertility from the NULL insertion process.
- is the conditioning sentence and denotes NULL.
- is the generated sentence. The alignment index specifies which conditioning token generated .
- counts the generated words linked to . The non-NULL count is .
- is the fertility distribution for a non-NULL conditioning token.
- is the probability that an ordinary generated word triggers an additional NULL word. The complementary probability is .
- supplies the lexical probability for every generated word, including those linked to NULL.
- supplies the placement probability for a word linked to a non-NULL conditioning position.
For each ordinary token, the factor counts the interchangeable orderings of its generated words before placement.
- The leading binomial term gives the probability of drawing exactly NULL words from opportunities.
- The placement process fills the remaining slots with NULL words in uniformly random order.
- The NULL placement probability cancels the orderings of those words. This leaves no NULL factor in the ordinary fertility or distortion products.
For example, if two ordinary words are generated and , the probability of one NULL insertion is . The binomial term accounts for either ordinary word triggering the insertion.
Fertility counts the words emitted by a conditioning token. Fertility zero drops that token. Distortion assigns scores to placements. Model 3 can assign mass to colliding ordinary placements, so its distribution is deficient when restricted to valid output strings.
Fertility couples the alignment decisions, so Model 3 loses the factoring shortcut used by Models 1 and 2. Brown and colleagues approximate the E-step by summing over move and swap neighborhoods around several candidate alignments. They find these candidates with local search, including searches that hold one alignment link fixed. Model 4 adds relative placement, and Model 5 tracks vacant positions to avoid assigning probability mass to overlapping placements. Och and Ney's Model 6 combines the Model 4 and HMM alignment distributions log-linearly, bringing together their complementary notions of positional locality. Brown et al. (1993), §4.4, Equation 44, Och and Ney (2003), section 2.3.1.
The standalone GIZA++ defaults run five iterations each of Model 1, the HMM, Model 3, and Model 4. Model 2 is configurable and defaults to zero iterations in that release. The Moses training wrapper sets three iterations each for Models 3 and 4 by default and accepts overrides. In both cases, stages can initialize from simpler models to refine the alignments. GIZA++ defaults, Moses training wrapper.
Alignment Heuristics in Practice
A directional IBM model assigns one conditioning parent to each generated position. One conditioning word can still generate several words in that direction. Whether a single direction can encode a link set depends on which side needs multiple parents. Suppose we annotate the two-token idiom “clam up” and its gloss “fall silent” as a unit, linking each word to both words on the other side. In that annotation, either direction would need two parents for a generated position.
The standard remedy is to train two models, one in each direction, and combine their output:
- Intersection : keeps only links present in both directions. Relative to union, it cannot increase gold-link recall.
- Union : keeps links from either direction. The precision of the additional links depends on what each aligner got right.
- Grow-diag-final-and: start from the intersection and consider neighbors in the union. In the growing phase, add a link if at least one endpoint is unaligned. In the final passes, test both endpoints and accept a link when both are still unaligned.
The Moses training script defaults to grow-diag-final, with grow-diag-final-and as an option. The final stage of the former can add a link with one endpoint still free. The worked example uses one final pass with the stricter AND rule.
The “diag” step permits diagonal neighbors of links already in the working alignment. A final pass can find isolated links that the growth phase cannot reach. Its endpoint test uses the alignment as it stands when each link is considered.
Alignment Error Rate (AER) uses both sure and possible human-annotated links. Links in the sure set determine the recall term, and links in the possible set, which includes the sure set, count toward the precision term. Och and Ney (2003) evaluated alignment predictions against annotated Hansards sentences. Results depend on the language pair, domain, and annotation protocol.
Our collaborative experiment below makes the symmetrization tradeoff visible: on a synthetic corpus with exact gold alignments, intersection, union, and grow-diag-final-and land at different F1 values, and none of them is universally best.
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!