Machine Translation
W266: Natural Language Processing
The plan...
Back in the old days...
Classical MT
Vauquois Triangle
(Vauquois, 1968)
MT is *really* hard
MT is *really* hard
MT is *really* hard
Which one seems best?
Statistical MT
End goal: evaluate P(hello | bonjour)
The Noisy Channel Model
For Machine Translation, translate f → e
P(e) : source (language model)
P(f|e) : channel (translation model)
“...one naturally wonders if the problem of translation could conceivably be treated as a problem in cryptography. When I look at an article in Russian, I say: ‘This is really written in English, but it has been coded in some strange symbols. I will now proceed to decode.’ ”
IBM Alignment Models
Generative process e → f with P(f | e)
Latent variable model for P(f | e)
Use Bayes’ rule to compute P(e | f)
Decode using beam search over P(f | e) P(e)
p(a | e)
t(f | e)
P(f | a, e)
P(a | e)
P(e)
Generation
(never used)
IBM Alignment Models: Inference
Generative process e → f with P(f | e)
Latent variable model for P(f | e)
Use Bayes’ rule to compute P(e | f)
Decode using beam search over P(f | e) P(e)
P(f | a, e)
P(a | e)
P(e)
f
P(a | f, e)
P(e | f)
Generation
(never used)
Inference
p(a | e)
t(f | e)
What is P(f | e) ?
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
NULL
m = 3
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
m = 3
the
blue
house
NULL
a1 = 1
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
m = 3
the
blue
house
NULL
a1 = 1
a2 = 3
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
m = 3
the
blue
house
NULL
a1 = 1
a2 = 3
a3 = 2
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
la
NULL
m = 3
t(la | the)
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
la
maison
NULL
m = 3
t(maison | house)
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
la
maison
bleue
NULL
m = 3
t(bleue | blue)
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
la
maison
bleue
NULL
IBM Model 1
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
the
blue
house
la
maison
bleue
NULL
IBM Model 1: Inference
Noisy-channel translation f → e
Model: generative process e → f with P(f | e)
Use Bayes’ rule to compute P(e | f)
Decode using beam search over P(f | e) P(e)
?
?
?
la
maison
bleue
NULL
Training Model 1
IBM Alignment Models: Training
Generative process e → f with P(f | e)
Latent variable model for P(f | e)
Observe (f, e). Need to infer parameters!
But, ai unobserved: use EM
P(f | a, e)
P(a | e)
P(e)
f
P(a | f, e)
e
Generation
(never used)
Training
p(a | e)
t(f | e)
IBM Model 1: Training
Observe (f, e). Need to infer parameters!
But, ai unobserved: use EM
f
P(a | f, e)
e
Training
p(a | e)
t(f | e)
IBM Model 1: Training
Observe (f, e). Need to infer parameters!
But, ai unobserved: use EM
f
P(a | f, e)
e
Training
p(a | e)
t(f | e)
IBM Model 1: Training
Observe (f, e). Need to infer parameters!
But, ai unobserved: use EM
t(wf | we) = count(wf, we) / count(we)
f
P(a | f, e)
e
Training
p(a | e)
t(f | e)
Better models?
Model 1 Limitations
Bag-of-words model! (yuck)
Alignments all independent
No many-to-one alignments, or many-to-many
Word-factored - problems?
Model 1 vs. Model 2
Model 1: “bag of words”
Generative process e → f with P(f | e)
Model 2: distortion probabilities
Generative process e → f with P(f | e)
HMM Model
HMM: sequence model over alignments
Generative process e → f with P(f | e)
Model 2: distortion probabilities
Generative process e → f with P(f | e)
Phrase-Based MT
Problem: words are not independent!
Idea: translate in larger chunks - phrase units
Phrase-Based MT
Generate phrases by heuristics or ML
Koehn (2009) Statistical Machine Translation
Evaluation Metrics: BLEU
BLEU motivation
Why is an automated eval important for machine translation?
What makes automated evaluation hard?
What makes us think that evaluation is possible?
BLEU motivation
Why is an automated eval important for machine translation?
What makes automated evaluation hard?
What makes us think that evaluation is possible?
Evaluation seems possible!
BLEU: http://aclweb.org/anthology/P/P02/P02-1040.pdf (IBM, 2002)
BLEU formulation
Idea #1: Precision
How many of the words in the candidate translation occur in a reference?
BLEU formulation
Idea #1: Precision
How many of the words in the candidate translation occur in a reference?
Problem:
Candidate: the the the
Reference: the cow jumped over the moon
Precision?
BLEU formulation
Idea #2: Max credit
How many of the words in the candidate translation occur in a reference?
(Cap numerator of precision by # of times word seen in reference.)
Better:
Candidate: the the the the the the
Reference: the cow jumped over the moon
Precision?
BLEU formulation
Idea #3: Unigrams are too small of a unit
How many of the words in the candidate translation occur in a reference?
(Cap numerator of precision by # of times word seen in reference.)
(<= 4-grams)
Smaller n-grams stop correlating with monolingual judgements on fluency.
BLEU formulation
Idea #4: Brevity Penalty
How many of the words in the candidate translation occur in a reference?
(Cap numerator of precision by # of times word seen in reference.)
(<= 4-grams)
(Trivial translations are likely bad)
Penalty = e^(min(0, 1 - ref_len / mt_len))
BLEU formulation
Extensions:
How long to optimize for?
Evaluation seems possible!
BLEU: http://aclweb.org/anthology/P/P02/P02-1040.pdf (IBM, 2002)
The Future: Neural MT
Or maybe the present?
Google’s GNMT system serves 16 language pairs: https://translate.google.com/
End-to-End Sequence-to-Sequence models:
la
maison
bleue
</s>
<s>
the
blue
the
blue
house
house
</s>
Attention Models
Problem: fixed-length vector representation
Idea: allow model to look back at input sequence during decoding
Image by Chris Olah and Shan Carter
Attention Models: Example
Attention Demo
-> go here
Convolutional Neural Networks
https://developer.apple.com/library/content/documentation/Performance/Conceptual/vImage/ConvolutionOperations/ConvolutionOperations.html
ByteNet: Convolution over characters
Neural Machine Translation in Linear* Time, Kalchbrenner et al, March 2017
ByteNet: Language Model
ByteNet: Translation Model
Word Alignments: Cross-Lingual Parsing
Cross-Lingual Parsing
Neural MT doesn’t need explicit alignment model.
But: alignments useful for domain transfer!
Input: English parser
Input: parallel sentences (f, e)
Output: parsed foreign sentences
Source: “Bootstrapping Parsers via Syntactic Projection across Parallel Texts” (Hwa et al. 2005)
Cross-Lingual Parsing
(almost) Equivalent to matrix multiplication:
If interested in typed edges, can treat E as 3rd-rank tensor
Normalize columns of Et, then DMST to decode
Source: Multilingual Projection for Parsing Truly Low-Resource Languages (Agic, et al. 2016)