Statistical Machine Translation Foundations › The Log-Linear Model

Michael BrenndoerferNovember 26, 20263 min read
Language AI HandbookAll chapters
Part 27 of 67Machine Translation and Speech Translation
Chapter 190Statistical Machine Translation Foundations › The Log-Linear Model
Reading section 6 of 12 · The Log-Linear Model · 3 minSection 6 of 12 · 3 min

Section 6 of 12 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Och and Ney (2002) combined translation scores, language-model scores and other features in a log-linear model. Here we return to the decoding notation from the opening. The input f\mathbf{f} is fixed, and e\mathbf{e} ranges over possible translations.

pλ(e∣f)=exp⁡(∑m=1Mλmhm(e,f))∑e′exp⁡(∑m=1Mλmhm(e′,f)),p_{\boldsymbol{\lambda}}(\mathbf{e} \mid \mathbf{f}) = \frac{\exp\left(\sum_{m=1}^{M} \lambda_m h_m(\mathbf{e}, \mathbf{f})\right)}{\sum_{\mathbf{e}'} \exp\left(\sum_{m=1}^{M} \lambda_m h_m(\mathbf{e}', \mathbf{f})\right)},

where:

  • e\mathbf{e} is a candidate translation.
  • f\mathbf{f} is the fixed input sentence.
  • hm(e,f)h_m(\mathbf{e}, \mathbf{f}): the mm-th feature function, scoring the pair (e,f)(\mathbf{e}, \mathbf{f})
  • λm\lambda_m: the tunable weight of feature mm
  • MM: the number of features
  • The denominator sums the exponential scores over candidate translations e′\mathbf{e}' for the same input f\mathbf{f}.

For a fixed input the denominator is shared by all candidates. Exponentiation preserves their ordering, so finding the most probable candidate amounts to maximizing its weighted feature sum.

e^=arg⁡max⁡e∑m=1Mλmhm(e,f).\hat{\mathbf{e}} = \arg\max_{\mathbf{e}} \sum_{m=1}^{M} \lambda_m h_m(\mathbf{e}, \mathbf{f}).

Setting h1=log⁡P(f∣e)h_1 = \log P(\mathbf{f}\mid\mathbf{e}), h2=log⁡P(e)h_2 = \log P(\mathbf{e}) and λ1=λ2=1\lambda_1 = \lambda_2 = 1 recovers the noisy-channel ranking. Summing the score exponentials over the full target support then gives P(f)P(\mathbf{f}) by the law of total probability. A decoder needs only the weighted score to rank translations.

The Feature Set

A typical phrase-based system uses these features:

  • Direct phrase translation score sums log⁡p(eˉ∣fˉ)\log p(\bar e \mid \bar f) over phrase pairs.
  • Inverse phrase translation score sums log⁡p(fˉ∣eˉ)\log p(\bar f \mid \bar e) over phrase pairs.
  • Direct lexical weighting sums log⁡lex(eˉ∣fˉ)\log \text{lex}(\bar e \mid \bar f) over phrase pairs.
  • Inverse lexical weighting sums log⁡lex(fˉ∣eˉ)\log \text{lex}(\bar f \mid \bar e) over phrase pairs.
  • Language model score: ∑klog⁡P(ek∣ek−n+1k−1)\sum_k \log P(e_k \mid e_{k-n+1}^{k-1}), possibly several LMs for different corpora.
  • Distortion: a penalty on reordering, usually the sum of jump distances −∑∣i(k)−iend(k−1)−1∣-\sum |i^{(k)} - i^{(k-1)}_{\text{end}} - 1|.
  • Word penalty applies a tuned coefficient to the number of output words.
  • Phrase count applies a tuned coefficient to the number of phrase pairs used.

Comparing two segmentations involves different numbers of phrase-score terms. A negative phrase-count coefficient favors fewer phrases when the other feature totals tie. A positive coefficient favors more phrases under the same condition.

Weight Tuning: MERT and Friends

Och and Ney estimated the weights λ\boldsymbol{\lambda} of a conditional log-linear translation model by maximizing the likelihood of reference translations. Minimum error rate training (MERT) instead chooses weights to minimize an automatic translation error measure on held-out data, such as 1−BLEU1-\text{BLEU} when BLEU is expressed on the unit scale. Och and Ney (2002), equation 11, Och (2003), sections 2–3.

The algorithm exploits a property of the log-linear form: if you fix everything except λm\lambda_m, each candidate translation's score is a linear function of λm\lambda_m. The best-scoring candidate therefore changes only at finitely many breakpoints, and the error as a function of λm\lambda_m is piecewise constant. In one dimension you can enumerate all breakpoints exactly; MERT does this, alternating between coordinate directions until convergence. Concretely, for a candidate pool of NN translations, the score of candidate ii is aiλm+bia_i \lambda_m + b_i, so any two candidates cross at most once, giving at most N2N^2 breakpoints. Sort them, evaluate the metric on each interval, keep the best, and repeat for the next coordinate.

MERT Is Non-Convex, Unstable, and Easy to Overfit

Coordinate descent on a piecewise-constant, non-convex objective has no global optimality guarantee. Results can depend on initialization, tuning examples, and the candidates retained. Pairwise ranking optimization is an alternative described by Hopkins and May (2011). When tuning to a corpus-level metric, measure performance on a separate test set.

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!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy