Alignment by Agreement - Stanford Computer Science
Transcription
Alignment by Agreement - Stanford Computer Science
Alignment by Agreement Percy Liang, Ben Taskar, Dan Klein UC Berkeley Computer Science Division Unsupervised word alignment Goal: learn to map sentence pairs to alignments the railroad term is “ demand loading ” le terme ferroviaire est “ chargement sur demande ” 2 Unsupervised word alignment Goal: learn to map sentence pairs to alignments the railroad term is “ demand loading ” le terme ferroviaire est “ chargement sur demande ” 2 Unsupervised word alignment Goal: learn to map sentence pairs to alignments the railroad term is “ demand loading ” le terme ferroviaire est “ chargement sur demande ” Approach: jointly train two models to encourage agreement 2 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” le 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” le 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” le terme 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” p(aj | aj−; θd) le terme j Distortion θd p( p( p( ) = 0.6 ) = 0.2 ) = 0.1 ··· 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” p(aj | aj−; θd) le terme ferroviaire p(fj | eaj ; θt) j Distortion θd p( p( p( ) = 0.6 ) = 0.2 ) = 0.1 ··· Translation θt p( the → le ) = 0.53 p( the → la ) = 0.24 p( railroad → ferroviaire ) = 0.19 p( NULL → le ) = 0.12 ··· 3 HMM model [Ney, Vogel ’96] Generative model: p(a, e, f ; θ) p(e) the railroad term is “ demand loading ” p(aj | aj−; θd) le terme ferroviaire est “ chargement sur demande ” p(fj | eaj ; θt) j Distortion θd p( p( p( ) = 0.6 ) = 0.2 ) = 0.1 ··· Translation θt p( the → le ) = 0.53 p( the → la ) = 0.24 p( railroad → ferroviaire ) = 0.19 p( NULL → le ) = 0.12 ··· 3 EM training Maximize p(e, f ; θ) 4 EM training Maximize p(e, f ; θ) Parameters: θ Expectation over alignments: q q E-step: M-step: q(a | e, f ) := p(a | e, f ; θ) θ := argmaxθ Eq log p(a, e, f | θ) (forward-backward) (normalizing counts) θ 4 EM training Maximize p(e, f ; θ) Parameters: θ Expectation over alignments: q q E-step: M-step: q(a | e, f ) := p(a | e, f ; θ) θ := argmaxθ Eq log p(a, e, f | θ) (forward-backward) (normalizing counts) θ e, f a 4 Output of one HMM model We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 5 Output of one HMM model We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 5 Output of one HMM model • A problem: – Rare words garbage-collect alignments [Moore ’05] We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 5 Output of one HMM model • A problem: – Rare words garbage-collect alignments [Moore ’05] • One solution: – More complex models We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 5 Two complementary models One model is broken . . . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . qef E M θef e, f aef 6 Two complementary models But second model is not broken in the same way. qef E qfe M M θef E θfe e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe 6 Two complementary models qef E Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . qfe M M θef E θfe e, f aef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe a 6 Two complementary models Intersection kills many bad alignment edges. E M qfe M θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . E θfe We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe a 6 Two complementary models Precision improves . . . 84.2 E M qfe M θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . E θfe afe We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9 97.0 a 6 Two complementary models Precision improves . . . Recall suffers . . . 84.2/92.0 E M qfe M θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . E θfe afe We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9/91.1 97.0/86.9 a 6 Two complementary models Precision improves . . . Recall suffers . . . AER improves. 84.2/92.0/13.0 E M qfe M θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . E θfe afe We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9/91.1/11.5 97.0/86.9 a /7.6 6 Two complementary models Can we extend the agreement idea? qef E qfe M M θef E θfe e, f aef afe a 6 Two complementary models Key: intersect alignments at training time qef · qfe qef M M qfe E E θef θfe e, f aef afe a 6 Two complementary models qef M M Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . qfe E E θef θfe e, f aef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . Fractional alignments qef · qfe afe a 6 Two complementary models Soft intersection: multiply fractional alignment qef · qfe M M E θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . qfe E θfe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe a 6 Two complementary models Soft intersection: multiply fractional alignment qef · qfe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . θfe We deemed it inadvisable to attend the meeting and so informed COJO . θef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . q (ai,j | e, f ) := p (ai,j | e, f ; θef) p (ai,j | e, f ; θfe) qef qfe M M E E Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe a 6 Two complementary models Models that are trained to agree predict better. qef · qfe M M E θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . qfe E θfe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . afe a 6 Two complementary models Models that are trained to agree predict better. qef · qfe 84.2 89.9 M M E θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 97.0 a qfe E θfe afe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9 92.2 96.5 6 Two complementary models Models that are trained to agree predict better. qef · qfe 84.2/92.0 89.9/93.6 M M E θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 97.0/86.9 a qfe E θfe afe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9/91.1 92.2/93.5 96.5/91.4 6 Two complementary models Models that are trained to agree predict better. qef · qfe 84.2/92.0/13.0 89.9/93.6/ 8.7 M M E θef e, f aef Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 97.0/86.9 a /7.6 qfe E θfe afe Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . We deemed it inadvisable to attend the meeting and so informed COJO . qef We deemed it inadvisable to attend the meeting and so informed COJO . We deemed it inadvisable to attend the meeting and so informed COJO . Nous ne avons pas cru bon de assister à la réunion et en avons informé le COJO en conséquence . 86.9/91.1/11.5 92.2/93.5/ 7.3 96.5/91.4/5.7 6 Initialization Jointly-trained models less sensitive to initialization Initialization Uniform Indep. HMMs AER>50 7 Initialization Jointly-trained models less sensitive to initialization Initialization Uniform Model 1 Indep. HMMs AER>50 6.6 7 Initialization Jointly-trained models less sensitive to initialization Initialization Uniform Model 1 Indep. HMMs AER>50 6.6 Joint HMMs 5.7 5.2 7 Initialization Jointly-trained models less sensitive to initialization Initialization Uniform Model 1 Indep. HMMs AER>50 6.6 Joint HMMs 5.7 5.2 • Two models have somewhat disjoint capacities for producing bad alignments • Agreement biases parameters away from troublesome areas 7 Agreement provides staged training E-step: q (ai,j | e, f ) := p (ai,j | e, f ; θef) p (ai,j | e, f ; θfe) 8 Agreement provides staged training E-step: q (ai,j | e, f ) := p (ai,j | e, f ; θef) p (ai,j | e, f ; θfe) M-step: X θt(to → de) ∝ q (ai,j | e, f ) ei =to,fj =de • Magnitude of fractional q = influence in M-step 8 Agreement provides staged training E-step: q (ai,j | e, f ) := p (ai,j | e, f ; θef) p (ai,j | e, f ; θfe) M-step: X θt(to → de) ∝ q (ai,j | e, f ) ei =to,fj =de • Magnitude of fractional q = influence in M-step • Downweight hard cases where two models disagree • As models get better, harder examples contribute 8 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) 9 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) Independent training z }| { max log p1(x; θ1) + log p2(x; θ2) θ1 ,θ2 9 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) • Joint training objective: Independent training z }| { max log p1(x; θ1) + log p2(x; θ2) θ1 ,θ2 X + log p1(z | x; θ1)p2(z | x; θ2) z | {z agreement } 9 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) • Joint training objective: Independent training z }| { max log p1(x; θ1) + log p2(x; θ2) θ1 ,θ2 X + log p1(z | x; θ1)p2(z | x; θ2) z | {z agreement } E-step: q(z | x) ∝ p1(z | x; θ1)p2(z | x; θ2) 9 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) • Joint training objective: Independent training z }| { max log p1(x; θ1) + log p2(x; θ2) θ1 ,θ2 X + log p1(z | x; θ1)p2(z | x; θ2) z | {z agreement } E-step: q(z | x) ∝ p1(z | x; θ1)p2(z | x; θ2) Useful in grammar induction [Klein, Manning ’04] 9 General unsupervised approach • Input x = (e, f ), output z = a • Two complementary models p1(x, z; θ1), p2(x, z; θ2) • Joint training objective: Independent training z }| { max log p1(x; θ1) + log p2(x; θ2) θ1 ,θ2 X + log p1(z | x; θ1)p2(z | x; θ2) z | {z agreement } E-step: q(z | x) ∝ p1(z | x; θ1)p2(z | x; θ2) Useful in grammar induction [Klein, Manning ’04] Related work: co-training [Blum, Mitchell ’98] CoBoost [Collins, Singer ’99] 9 Final results AER Hansards (1.1M training sentences, 347 test sentences) HMM (indep) HMM (joint) 11 10 9 8 7 6 5 4 3 2 1 E→F F→E Intersected Model Joint training improves both directional and intersected models 10 Final results 18 Indep. Joint 16 14 AER 12 10 4.9 8 6 4 2 Model 1 Model 2 HMM Model 4 Model Significant error reduction for various models 29% reduction in AER over model 4 11 Conclusion • Simple and efficient procedure → 4.9% AER 12 Conclusion • Simple and efficient procedure → 4.9% AER • Suggests a general approach for unsupervised learning 12 Conclusion • Simple and efficient procedure → 4.9% AER • Suggests a general approach for unsupervised learning • Achieves insignificantly better BLEU score 12 Conclusion • Simple and efficient procedure → 4.9% AER • Suggests a general approach for unsupervised learning • Achieves insignificantly better BLEU score • Provides features for discriminative methods 12