# Difference between revisions of "stat946w18/Unsupervised Machine Translation Using Monolingual Corpora Only"

(→Decoder) |
|||

Line 4: | Line 4: | ||

Neural machine translation systems must be trained on large corpora consisting of pairs of pre-translated sentences. This paper proposes an unsupervised neural machine translation system, which can be trained without using any such parallel data. | Neural machine translation systems must be trained on large corpora consisting of pairs of pre-translated sentences. This paper proposes an unsupervised neural machine translation system, which can be trained without using any such parallel data. | ||

− | == Overview of translation system == | + | ==Overview of Standard Neural Machine Translation== |

+ | Let <math display="inline">S</math> denote the set of words in the source language, and let <math display="inline">T</math> denote the set of words in the target language. Let <math display="inline">\mathcal{Z}_S \subtset \mathbb{R}^{n_S}</math> and <math display="inline">\mathcal{Z}_T \subset \mathjbb{R}^{n_T}</math> denote the word vectors corresponding to the words of the source and target language respectively. | ||

+ | |||

+ | A standard neural machine translation system (Sutskever, 2014) consists of an two RNNs, an encoder <math display="inline">E</math> and a decoder <math display="inline">D</math>. The encoder reads the sequence of word vectors corresponding to the sentence in the source language to be translated <math display="inline">(z^s_0,\ldots, z^s_m)</math>and outputs a code vector <math display="inline"> c </math>. In more detail, if <math display="inline"> \mathcal{Z}^s \subset \mathbb{R}^{n_s} </math> is the set of source language word vectors, and <math display="inline"> H= \mathbb{R}^{n_h} </math> is the Euclidian space in which encoder's hidden states lie, and if <math display="inline"> f: \mathcal{Z}^s \times H \to H </math> is the neural network that enacts one step of the encoder RNN, then we have | ||

+ | |||

+ | \begin{align} | ||

+ | h_0=f(z^s_0,0)\\ | ||

+ | \end{align} | ||

+ | |||

+ | |||

+ | The decoder accepts <math display="inline">c</math> as input in its first step, and then | ||

+ | |||

+ | == Overview of unsupervised translation system == | ||

The unsupervised translation system has four components: | The unsupervised translation system has four components: | ||

Line 53: | Line 65: | ||

#Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, Hervé Jégou. "Word Translation without Parallel Data". arXiv:1710.04087, (2017) | #Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, Hervé Jégou. "Word Translation without Parallel Data". arXiv:1710.04087, (2017) | ||

# Tomas Mikolov, Quoc V Le, and Ilya Sutskever. "Exploiting similarities among languages for machine translation." arXiv preprint arXiv:1309.4168. (2013). | # Tomas Mikolov, Quoc V Le, and Ilya Sutskever. "Exploiting similarities among languages for machine translation." arXiv preprint arXiv:1309.4168. (2013). | ||

+ | # Sutskever, Ilya, Oriol Vinyals, and Quoc V. Le. "Sequence to sequence learning with neural networks." Advances in neural information processing systems. 2014. |

## Revision as of 19:16, 18 February 2018

## Contents

## Introduction

Neural machine translation systems must be trained on large corpora consisting of pairs of pre-translated sentences. This paper proposes an unsupervised neural machine translation system, which can be trained without using any such parallel data.

## Overview of Standard Neural Machine Translation

Let [math]S[/math] denote the set of words in the source language, and let [math]T[/math] denote the set of words in the target language. Let [math]\mathcal{Z}_S \subtset \mathbb{R}^{n_S}[/math] and [math]\mathcal{Z}_T \subset \mathjbb{R}^{n_T}[/math] denote the word vectors corresponding to the words of the source and target language respectively.

A standard neural machine translation system (Sutskever, 2014) consists of an two RNNs, an encoder [math]E[/math] and a decoder [math]D[/math]. The encoder reads the sequence of word vectors corresponding to the sentence in the source language to be translated [math](z^s_0,\ldots, z^s_m)[/math]and outputs a code vector [math] c [/math]. In more detail, if [math] \mathcal{Z}^s \subset \mathbb{R}^{n_s} [/math] is the set of source language word vectors, and [math] H= \mathbb{R}^{n_h} [/math] is the Euclidian space in which encoder's hidden states lie, and if [math] f: \mathcal{Z}^s \times H \to H [/math] is the neural network that enacts one step of the encoder RNN, then we have

\begin{align} h_0=f(z^s_0,0)\\ \end{align}

```
The decoder accepts [math]c[/math] as input in its first step, and then
```

## Overview of unsupervised translation system

The unsupervised translation system has four components:

- An unsupervised word-vector alignment system
- An encoder
- A decoder
- A discriminator

## Word vector alignment

Methods like word2vec and GLOVE generate vectors in Euclidian space whose geometry corresponds to the semantics of the words they represent. For example, if f maps English words to vectors, then we have

[math]f(\text{king}) -f(\text{man}) +f(\text{woman}) \approx f(\text{queen}) [/math]

Mikolov (2013), observed that this correspondence between semantics and geometry is invariant across languages. For example, if g maps French words to their corresponding vectors, then

[math]g(\text{roi}) -g(\text{homme}) +g(\text{femme}) \approx g(\text{reine}) [/math]

It follows that if A maps English word vectors to the word vectors of their French translations, we should expect A to be linear.

Mikolov and many subsequent authors used this observation to devise methods for expanding small bilingual dictionaries. The main idea is that using given a small amount of parallel data, we can solve for the linear transformation A by least squares. We can then use this learned linear transformation to translate arbitrary words, assuming we have the corresponding word vectors. See my CS698 project for details (link). Essentially these schemes can be though of as methods for aligning the point cloud of source-language word-vectors with the point cloud of target language word-vectors. This work culminated recently with the paper of Conneau et al. (2017), which uses a GAN to align the word vectors of a source and target language using only considerations of point cloud geometry, and without relying on any bilingual dictionary. The present paper uses this unsupervised cross-lingual word-vector alignment scheme for two purposes: a) to initialize the unsupervised translation scheme; and b) to embed the word vectors of the two languages in the same space, so that at the same encoder and decoder can be applied to both languages.

## Encoder

The encoder accepts as input the sequence of word vectors corresponding to the sentence of words to be translated. Although the lookup table matching words to word vectors differs between languages, the encoder itself is identical: the same encoder is used to process a sequence of word vectors from the target language and from the source language. This is possible because in the previous step, the word vectors of the two languages were aligned, so that word vectors correspond to words with similar meanings are nearby in Euclidian space, regardless of their language.

The encoder consists of two LSTMs. One reads the sentence in the forward direction, while the other reads it in the reverse direction. At each word, each LSTM produces an output vector. These two output vectors are concatenated. Thus the output of the encoder is a sequence of state vectors [math]z=(z_1,\ldots, z_m)[/math]. one for each word in the input sentence.

## Decoder

The decoder accepts as input the vector [math]z[/math] produced by the encoder, as well as a language-specific start-of-sentence symbol, and produces a sequence of words terminated by a stop symbol. The decoder is a standard LSTM, except that it uses an attention mechanism, which I describe in the next section.

## Attention Mechanisms

Bahdanau et al. (2014) introduced the attention mechanism

## Overview of objective

The objective function is the sum of three terms:

- The de-noising auto-encoder loss
- The translation loss
- The adversarial loss

## References

- Bahdanau, Dzmitry, Kyunghyun Cho, and Yoshua Bengio. "Neural machine translation by jointly learning to align and translate." arXiv preprint arXiv:1409.0473 (2014).
- Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, Hervé Jégou. "Word Translation without Parallel Data". arXiv:1710.04087, (2017)
- Tomas Mikolov, Quoc V Le, and Ilya Sutskever. "Exploiting similarities among languages for machine translation." arXiv preprint arXiv:1309.4168. (2013).
- Sutskever, Ilya, Oriol Vinyals, and Quoc V. Le. "Sequence to sequence learning with neural networks." Advances in neural information processing systems. 2014.