Unsupervised Machine Translation Alexis Conneau 3 rd year

  • Slides: 56
Download presentation
Unsupervised Machine Translation Alexis Conneau 3 rd year Ph. D student Facebook AI Research,

Unsupervised Machine Translation Alexis Conneau 3 rd year Ph. D student Facebook AI Research, Université Le Mans Joint work with Guillaume Lample, Marc'Aurelio Ranzato, Ludovic Denoyer, Hervé Jégou

Motivation • Neural machine translation works well for language pairs with a lot of

Motivation • Neural machine translation works well for language pairs with a lot of parallel data (English-French, English-German, etc. ) • Performance drops when parallel data is scarce • Vietnamese, Norwegian, Basque, Ukrainian, Serbian • The creation of parallel data is difficult, and costly 2

Motivation • Neural machine translation works well for language pairs with a lot of

Motivation • Neural machine translation works well for language pairs with a lot of parallel data (English-French, English-German, etc. ) • Performance drops when parallel data is scarce • Vietnamese, Norwegian, Basque, Ukrainian, Serbian • The creation of parallel data is difficult, and costly • Most language pairs use English as a pivot • However, monolingual data is much easier to find 3

Questions • Can we use monolingual data to improve a MT system? • Can

Questions • Can we use monolingual data to improve a MT system? • Can we reduce the amount of supervision? 4

Questions • Can we use monolingual data to improve a MT system? • Can

Questions • Can we use monolingual data to improve a MT system? • Can we reduce the amount of supervision? • Can we even learn WITHOUT ANY supervision? 5

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) 6

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) 6

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Small parallel

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Small parallel dataset • Huge monolingual corpus in the target language English // French (mono) 7

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Small parallel

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Small parallel dataset • Huge monolingual corpus in the target language • Train a (target → source) model Mt 2 s English // French (mono) 8

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • • Small

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • • Small parallel dataset Huge monolingual corpus in the target language Train a (target → source) model Mt 2 s Use Mt 2 s to translate the target monolingual corpus English // French // English (noisy) French (mono) 9

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • • •

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • • • Small parallel dataset Huge monolingual corpus in the target language Train a (target → source) model Mt 2 s Use Mt 2 s to translate the target monolingual corpus Use the two parallel datasets to train Ms 2 t English // French // English (noisy) French (mono) 10

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning (He et al. , 2016) • (source → target → source) Mt 2 s (Ms 2 t (xs)) = xs • (target → source → target ) Ms 2 t (Mt 2 s (xt)) = xt 11

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning (He et al. , 2016) • Pivot-based • Related language pairs (Firat et al. , 2016; Johnson et al. , 2016) • Images (Nakayama & Nishida (2017), Lee et al. (2017)) 12

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning

Prior work • Semi-supervised • Back-translation (Sennrich et al. , 2015) • Dual learning (He et al. , 2016) • Pivot-based • Related language pairs (Firat et al. , 2016; Johnson et al. , 2016) • Images (Nakayama & Nishida (2017), Lee et al. (2017)) • Fully unsupervised • Ravi & Knight, 2011 13

Our approach • Start with unsupervised word translation • Easier task to start with

Our approach • Start with unsupervised word translation • Easier task to start with • Already insights of why it could work • Can be used as a first step towards unsupervised sentence translation 14

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al.

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al. , 2013)

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al.

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al. , 2013) • Start from two pre-trained monolingual spaces (word 2 vec) • • • Totally unsupervised Widely used Strong systems for monolingual embeddings Semantically and syntactically relevant Not task-specific, useful across domains

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al.

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al. , 2013) • Start from two pre-trained monolingual spaces (word 2 vec) • Project the source space onto the target space using a small dictionary + =

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al.

Weakly-supervised word translation • Exploiting similarities among languages for machine translation (Mikolov et al. , 2013) • Start from two pre-trained monolingual spaces (word 2 vec) • Project the source space onto the target space using a small dictionary + = • Feed-forward network does not improve over linear mapping (Mikolov et al. , 2013) • Orthogonal projection works best Xing et al. (2015), Smith et al. (2017)

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) 19

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) 19

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) • Orthogonal projection

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) • Orthogonal projection – Xing et al. (2015), Smith et al. (2017) – Procrustes 20

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) • Orthogonal projection

Weakly-supervised word translation • Linear projection – Mikolov et al. (2013) • Orthogonal projection – Xing et al. (2015), Smith et al. (2017) – Procrustes • Given a source word s, define the translation as: (nearest neighbor according to the cosine distance) 21

Unsupervised word translation • Can we find the mapping W in an unsupervised way?

Unsupervised word translation • Can we find the mapping W in an unsupervised way? + =

Adversarial training • If WX and Y are perfectly aligned, these spaces should be

Adversarial training • If WX and Y are perfectly aligned, these spaces should be undistinguishable 23

Adversarial training • If WX and Y are perfectly aligned, these spaces should be

Adversarial training • If WX and Y are perfectly aligned, these spaces should be undistinguishable • Train a discriminator D to discriminate elements from WX and Y Discriminator training 24

Adversarial training • If WX and Y are perfectly aligned, these spaces should be

Adversarial training • If WX and Y are perfectly aligned, these spaces should be undistinguishable • Train a discriminator D to discriminate elements from WX and Y • Train W to unable the discriminator from making accurate predictions Discriminator training Mapping training 25

Orthogonality constraint • Isometric mapping • Preserve dot-product • Preserve monolingual quality embeddings •

Orthogonality constraint • Isometric mapping • Preserve dot-product • Preserve monolingual quality embeddings • Training more robust (no mapping collapse) • After each training update, project the mapping to the orthogonal manifold: Cisse et al. (ICML 2017) 26

Results on word translation – Adversarial 27

Results on word translation – Adversarial 27

Results on word translation – Adversarial Procrustes Adversarial 90 80 70 77. 4 77.

Results on word translation – Adversarial Procrustes Adversarial 90 80 70 77. 4 77. 3 69. 8 71. 3 74. 9 76. 1 70. 4 61. 9 58. 2 60 47 50 41. 5 40 40. 6 30. 2 29. 1 30 18. 5 20 22. 3 10 en-es es-en en-fr fr-en en-ru ru-en en-zh zh-en Word translation retrieval – P@1 – Adversarial 1. 5 k source queries, 200 k target keys (vocabulary of 200 k words for all languages) 28

Unsupervised word translation – Summary • Given independent monolingual datasets in a source and

Unsupervised word translation – Summary • Given independent monolingual datasets in a source and a target language: • We can create high-quality cross-lingual dictionaries • We can create high-quality cross-lingual embeddings 29

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences?

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences? 30

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences?

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences? • Number of points grows exponentially with sentence length 31

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences?

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences? • Number of points grows exponentially with sentence length • No similar embedding structures across languages 32

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences?

Unsupervised sentence translation • Could we apply the same unsupervised training procedure to sentences? • Number of points grows exponentially with sentence length • No similar embedding structures across languages • Direct application does not work (even in a supervised setting) 33

Proposed architecture – Denoising Auto-Encoding Source encoder Source decoder • Train a source →

Proposed architecture – Denoising Auto-Encoding Source encoder Source decoder • Train a source → source denoising autoencoder (DAE) 34

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a source → source denoising autoencoder (DAE) • Critical to add noise to avoid trivial reconstructions 35

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a source → source denoising autoencoder (DAE) • Critical to add noise to avoid trivial reconstructions • Two sources of noise • Word dropout: each word is removed with a probability p (usually 0. 1) Ref: Arizona was the first to introduce such a requirement. Arizona was the first to such a requirement. Arizona was first to introduce such a requirement. 36

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder • Train a source → source denoising autoencoder (DAE) • Critical to add noise to avoid trivial reconstructions • Two sources of noise • Word dropout: each word is removed with a probability p (usually 0. 1) • Word shuffle: word order is (slightly) shuffled inside sentences Ref: Arizona was the first to introduce such a requirement. Arizona the first was to introduce a requirement such. Arizona was the to introduce first such requirement a. 37

Proposed architecture – Denoising Auto-Encoding C Source encoder Source decoder C Target encoder Target

Proposed architecture – Denoising Auto-Encoding C Source encoder Source decoder C Target encoder Target decoder noise • Train a source → source denoising autoencoder (DAE) • Train a target → target denoising autoencoder (DAE) 38

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise Target encoder Target decoder • Train a source → source denoising autoencoder (DAE) • Train a target → target denoising autoencoder (DAE) • Make source and target latent states indistinguishable using adversarial training 39

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise Target encoder Target decoder • Train a source → source denoising autoencoder (DAE) • Train a target → target denoising autoencoder (DAE) • Make source and target latent states indistinguishable using adversarial training • We want decoders to operate in the same space → share parameters between encoders 40

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise Target encoder Target decoder • Works on simple / small datasets, with short sentences or small vocabulary 41

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise Target encoder Target decoder • Works on simple / small datasets, with short sentences or small vocabulary • Problem: at test time we want (source → target) or (target → source) 42

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise

Proposed architecture – Denoising Auto-Encoding C noise Source encoder Source decoder Discriminator C noise Target encoder Target decoder • Works on simple / small datasets, with short sentences or small vocabulary • Problem: at test time we want (source → target) or (target → source) • Cross-Domain training: train the model to perform actual translations • We do not have parallel data → generate artificial translations for training 43

Proposed architecture – Cross-Domain Training M model at previous iter Source encoder Target decoder

Proposed architecture – Cross-Domain Training M model at previous iter Source encoder Target decoder • Train on pairs generated using a stale version of the model 44

Proposed architecture – Cross-Domain Training M model at previous iter Target decoder Source encoder

Proposed architecture – Cross-Domain Training M model at previous iter Target decoder Source encoder • Train on pairs generated using a stale version of the model • Start with word-by-word translation une photo d’ une rue bondée en ville. (sentence from monolingual corpus) a photo of a street crowded in a city. (word-by-word translation) a view of a crowded city street. (gold translation) 45

Proposed architecture – Cross-Domain Training M Source encoder Target decoder M Target encoder Source

Proposed architecture – Cross-Domain Training M Source encoder Target decoder M Target encoder Source decoder model at previous iter • Train on pairs generated using a stale version of the model • Start with word-by-word translation • Symmetric training 46

Recap • Denoising autoencoding to learn good sentence representations 47

Recap • Denoising autoencoding to learn good sentence representations 47

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent features across the two domains • Adversarial training • Parameter sharing 48

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent features across the two domains • Adversarial training • Parameter sharing • Cross-lingual training to learn to translate • Trick: use stale version of the model to produce a noisy source • Use a word-by-word translation model to initialize the algorithm 49

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent

Recap • Denoising autoencoding to learn good sentence representations • Match distributions of latent features across the two domains • Adversarial training • Parameter sharing • Cross-lingual training to learn to translate • Trick: use stale version of the model to produce a noisy source • Use a word-by-word translation model to initialize the algorithm • Pretrain word embeddings with aligned embeddings 50

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle à un homme. Iteration 0 Iteration 1 Iteration 2 Iteration 3 Reference a woman with pink hair dressed in black talks to a man. 51

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle à un homme. Iteration 0 a woman at hair roses dressed in black speaks to a man. Iteration 1 Iteration 2 Iteration 3 Reference a woman with pink hair dressed in black talks to a man. 52

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle à un homme. Iteration 0 a woman at hair roses dressed in black speaks to a man. Iteration 1 a woman at glasses dressed in black talking to a man. Iteration 2 Iteration 3 Reference a woman with pink hair dressed in black talks to a man. 53

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle à un homme. Iteration 0 a woman at hair roses dressed in black speaks to a man. Iteration 1 a woman at glasses dressed in black talking to a man. Iteration 2 a woman at pink hair dressed in black speaks to a man. Iteration 3 Reference a woman with pink hair dressed in black talks to a man. 54

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle

Examples of unsupervised translations Source une femme aux cheveux roses habillée en noir parle à un homme. Iteration 0 a woman at hair roses dressed in black speaks to a man. Iteration 1 a woman at glasses dressed in black talking to a man. Iteration 2 a woman at pink hair dressed in black speaks to a man. Iteration 3 a woman with pink hair dressed in black is talking to a man. Reference a woman with pink hair dressed in black talks to a man. c: length of the candidate translation r: average length of a reference over the corpus p_n: number_shared_ngrams(candidate, reference) / length(candidates) 55

Thank you Word translation without parallel data Alexis Conneau *, Guillaume Lample *, Marc'Aurelio

Thank you Word translation without parallel data Alexis Conneau *, Guillaume Lample *, Marc'Aurelio Ranzato, Ludovic Denoyer, Hervé Jégou (ICLR 2018) Code: https: //github. com/facebookresearch/MUSE Unsupervised Machine Translation Using Monolingual Corpora Only Guillaume Lample, Alexis Conneau, Ludovic Denoyer, Marc'Aurelio Ranzato (ICLR 2018) 56