Algorithm Search⌘K

Modelcore

Log-linear translation model

Also called Och-Ney log-linear model.

Score a translation by a weighted sum of feature functions, such as language and phrase model log-probabilities and penalties.

The log-linear translation model scores a candidate translation ee of a source sentence ff by a weighted sum ∑qλqhq(e,f)\sum_q \lambda_q h_q(e, f) of feature functions, and outputs the candidate with the highest score. The features are usually log-probabilities of sub-models, such as an n-gram language model and phrase translation tables in both directions, together with counts such as the number of words and phrases. Read as a probability, p(e∣f)∝exp⁡∑qλqhq(e,f)p(e \mid f) \propto \exp \sum_q \lambda_q h_q(e, f) is a conditional maximum entropy model, the same form as softmax regression over the candidate translations. The noisy channel model is the special case with two features and both weights equal to 1.

The machine

Direction and notation. Translation runs from the source f=f1…fmf = f_1 \ldots f_m to the target e=e1…ele = e_1 \ldots e_l. Logs are natural.

Features. A feature function hq(e,d,f)h_q(e, d, f), q=1,…,Qq = 1, \ldots, Q, maps a source sentence, a target sentence and a hidden derivation dd (for example the segmentation into phrases and their order) to a real number. Typical features are ln⁡pLM(e)\ln p_{\mathrm{LM}}(e), the sum of the log phrase translation probabilities ln⁡ϕ(fˉ∣eˉ)\ln \phi(\bar f \mid \bar e) and ln⁡ϕ(eˉ∣fˉ)\ln \phi(\bar e \mid \bar f), the lexical weights, a distortion cost, the word count ll and the phrase count. Any function can be a feature; it need not be a probability.

The model. With weights λ=(λ1,…,λQ)\lambda = (\lambda_1, \ldots, \lambda_Q),

pλ(e,d∣f)=exp⁡∑q=1Qλqhq(e,d,f)∑e′,d′exp⁡∑q=1Qλqhq(e′,d′,f),p_\lambda(e, d \mid f) = \frac{\exp \sum_{q=1}^{Q} \lambda_q h_q(e, d, f)}{\sum_{e', d'} \exp \sum_{q=1}^{Q} \lambda_q h_q(e', d', f)},

and the decision rule, with the usual max over derivations, is

e^=e(arg⁡max⁡e,d∑q=1Qλqhq(e,d,f)).\hat e = e\Big(\arg\max_{e, d} \sum_{q=1}^{Q} \lambda_q h_q(e, d, f)\Big).

The normalizer is the same for all candidates of one source sentence, so the decoder never computes it.

Training. The sub-models behind the features are trained first, each on its own data: the language model on target text, the phrase tables on a word-aligned parallel corpus. Then only the QQ weights, usually between 5 and 20 of them, are tuned on a small held-out set of sentence pairs. Och and Ney (2002) maximized the conditional likelihood of the reference translations on nn-best lists, as in maximum entropy training. Och (2003) tuned the weights for the translation metric itself with minimum error rate training, which became the usual method.

Example. For f = das haus ist klein, take three candidates with the features h1=ln⁡pLM(e)h_1 = \ln p_{\mathrm{LM}}(e), h2=ln⁡p(f∣e)h_2 = \ln p(f \mid e) and h3=lh_3 = l:

candidate h1h_1 h2h_2 h3h_3 score with λ=(1,1,0)\lambda = (1, 1, 0) score with λ=(1,1,0.5)\lambda = (1, 1, 0.5)
the house is small −4.0-4.0 −2.0-2.0 4 −6.0-6.0 −4.0-4.0
the house is little −5.0-5.0 −1.5-1.5 4 −6.5-6.5 −4.5-4.5
the house −2.0-2.0 −3.5-3.5 2 −5.5-5.5 −4.5-4.5

With the noisy channel weights (1,1,0)(1, 1, 0) the short candidate "the house" wins, because the language model gives a higher probability to fewer words. A word bonus λ3=0.5\lambda_3 = 0.5 corrects this, and "the house is small" wins. As probabilities over these three candidates, the second weights give e−4.0/(e−4.0+2e−4.5)=0.452e^{-4.0} / (e^{-4.0} + 2 e^{-4.5}) = 0.452 for the winner and 0.2740.274 for each of the others. With λ=(0.3,1,0.5)\lambda = (0.3, 1, 0.5) the language model counts less, and "the house is little" wins with the score −1.0-1.0 against −1.2-1.2.

What it counts

The model counts a score per candidate and derivation, and it costs QQ multiplications and additions on top of the feature values. When every feature is a sum of local parts, for example one part per phrase or per target word, the score is also a sum of local parts, and a decoder can add it up step by step as it builds the derivation. This is what stack decoding and chart decoding need. A feature that looks at the whole sentence at once can only be used to rescore an nn-best list or a lattice.

Training the weights counts in passes over the held-out set. Each pass decodes every sentence to get an nn-best list, which is the expensive part; the weight update on fixed nn-best lists is cheap in comparison.

Relation to other models

  • Noisy channel model. With h1=ln⁡p(e)h_1 = \ln p(e), h2=ln⁡p(f∣e)h_2 = \ln p(f \mid e) and λ1=λ2=1\lambda_1 = \lambda_2 = 1, the decision rule is arg⁡max⁡ep(e) p(f∣e)\arg\max_e p(e) \, p(f \mid e), the noisy channel rule. The log-linear model frees the weights, which allows p(e∣f)p(e \mid f) in place of, or next to, p(f∣e)p(f \mid e), and allows features that are not probabilities.
  • Softmax regression. Over a fixed candidate list, pλ(e∣f)p_\lambda(e \mid f) is softmax regression in which each class, here each candidate, has its own feature vector and all classes share one weight vector. With two candidates it is logistic regression on the difference of their feature vectors.
  • Phrase-based and hierarchical models. The phrase-based model and Hiero are log-linear models with particular features and derivations.
  • Structured perceptron. The structured perceptron and its relatives (MIRA, pairwise ranking) train the same weights with other loss functions and scale to many thousands of sparse features, where MERT does not.
  • Minimum risk training. Minimum risk training uses the probabilities of the model to minimize the expected loss, and it is used to train neural models as well.

Known results in the model

  • The normalizer cancels (theorem). The arg⁡max⁡\arg\max of pλ(e,d∣f)p_\lambda(e, d \mid f) over candidates equals the arg⁡max⁡\arg\max of the linear score, since exp⁡\exp is increasing and the normalizer does not depend on the candidate.
  • Scale does not matter (theorem). Multiplying all weights by the same positive number does not change the output. So weight tuning can fix the scale, for example ∑q∣λq∣=1\sum_q |\lambda_q| = 1, and MERT searches only over directions.
  • Noisy channel inside the family (theorem). Every noisy channel model is a log-linear model with two features and unit weights, so the best log-linear model on the training data is at least as good as the noisy channel model under the same criterion.
  • Convex training on n-best lists (theorem). On fixed nn-best lists, the conditional log-likelihood of the reference candidates is concave in λ\lambda, as for every maximum entropy model, so its maximum can be found by any convex method. The error count of MERT is not concave, and only local optima are guaranteed.
  • Better than the channel (measurement). Och and Ney (2002) reported lower error rates than the noisy channel baseline on their test data, from the direct translation probability, from extra features, and from discriminative training of the weights.
  • Training for the metric (measurement). Och (2003) found that weights tuned for the evaluation metric gave better scores on that metric than weights tuned for likelihood.

References

  1. Franz Josef Och and Hermann Ney, Discriminative training and maximum entropy models for statistical machine translation, ACL 2002, pages 295 to 302, the direct maximum entropy model of the translation, the noisy channel model as a special case, and the training of the weights on n-best lists
  2. Och 2003, the log-linear decision rule and the training of its weights for the error measure instead of the likelihood
  3. Berger, Della Pietra and Della Pietra 1996, the exponential form of the conditional maximum entropy model and its training
  4. Philipp Koehn, Statistical Machine Translation, Cambridge University Press, 2010, Chapter 9 (discriminative training)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/DK58JF/text.yaml