The paper “Neural Machine Translation By Jointly Learning To Align And Translate” introduced in 2015 is one of the most famous deep learning paper related natural language process which is cited more than 2,000 times. This article is a quick summary of the paper.
Introduction & Background
Machine Translation (MT)
- Traditional MT (i.e. Moses)
Machine translation is a sub-field of computational linguistics that investigates the use of software to translate text or speech from one language to another. - Wikipedia
- Neural MT
- Train a large neural network, read a sentence and output a correct translation (i.e. RNN encoder-decoder model).
- In probabilistic perspective, translation is equivalent to find a target sentence that maximizes the conditional probability of given a source sentence (i.e. ).
- In neural MT, we fit a parameterized model to maximize the conditional probability of sentence pairs using a parallel training corpus.
- Once the conditional distribution is learned by a translation model, given a source sentence a corresponding translation can be generated by searching for the sentence that maximizes the conditional probability.
RNN Encoder - Decoder
- RNN Encoder - Decoder model is previous work of the author on the paper “Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation” in 2014.
- RNN Encoder - Decoder model is usually known as a sequence-to-sequence (seq2seq) model and it has advantage to understand the sentence correctly since the whole context of the sentence should be considered through context vector that is encoded from input sentence.
- Reads the input sentences, a sequence of vectors , into a vector .
- Used LSTM model.
- Predict the next word given the context vector .
- Defines a probability over the translation by decomposing the joint probability into the ordered conditional probabilities.
- Each conditional probability is modeled by the function , which is nonlinear, potentially multi-layered, outputs the probability of when is a hidden state of the RNN.
- Used LSTM model.
- Problem of RNN Encoder - Decoder model
- Potential issue is that the network needs to be able to compress all the necessary information of the source sentence into a fixed-length vector. It is difficult for the neural network to process a long sentences, especially those that are longer than the sentences in the training corpus.
- Decoder uses only one context vector to generate output words in all of the RNN steps. However, each output world has to be influenced by different input words respectively.
Learning to Align and Translate
Encoder: Bidirectional RNN for Annotating Sequences
- Use bidirectional RNN for annotating sequences which consists of forward and backward RNN.
- This summarize not only the preceding words but also the following words
- Backward RNN
- Reads the input sequence in reverse order
- Hidden states:
- Forward RNN
- Reads the input sequence in proper order
- Hidden states:
- is the new variable-length representation instead of fixed-length .
- Annotation for each word :
- contains together with its context .
Decoder: General Description
- Define each conditional probability:
- is an RNN hidden state for time :
- Context is computed as a weighted sum of :
- Alignment model parameterizes it as a feedforward neural network which is jointly trained with all the other components of the system.
Experiment and Result
- Evaluate the proposed approach on the task of English-to-French translation
- Use ACL WMT’14 dataset: bilingual, parallel corpora
- Europarl (61M words), News commentary (5.5M), UN (421M), Two crawled corpora of 90M and 272.5M words, total 850M words
- Reduce the size of the combined corpus to have 348M
- Concatenate news-test-2012 and news-test-2013 to make a validation set, and evaluate the models on the test set (news-test-2014)
- Train two types of models
- RNN Encoder-Decoder (refer as RNNencdec): Baseline, 1000 hidden units
- RNNsearch: Proposed model, 1000 hidden units
- To train the models,
- Use a multiplayer network with a single maxout hidden layer
- Use a mini-batch stochastic gradient descent (SGD)
- Use a beam search to find a translation that approximately maximizes the conditional probability
- The translation performance measured in BLEU score
- RNNsearch outperforms the RNNencdec for all the cases
- RNNsearch is as high as that of the conventional phrase-based translation system (Moses)
- The performance of RNNencdec dramatically drops as the length of the sentences increases
- Both RNNsearch-30 and RNNsearch-50 are more robust to the length of the sentences
- Especially, RNNsearch-50 shows no performance deterioration even with sentences of length 50 or more
- Four sample alignments found by RNNsearch-50 between the source sentence (English) and the generated translation (French)
- Each pixel shows the weight of the annotation of the -th source word for the -th target word, in grayscale (0:black, 1:white)
- (a): an arbitrary sentence, (b-d): three randomly selected samples among the sentences without any unknown words and of length between 10 and 20 words from the test set
- Source sentence from the test set:
An admitting privilege is the right of a doctor to admit a patient to a hospital or a medical centre to carry out a diagnosis or a procedure, based on his status as a health care worker at a hospital.
- The RNNencdec-50 translated this sentence into:
Un privil`ege d’admission est le droit d’un m´edecin de reconnaˆıtre un patient `al’hˆopital ou un centre m´edical d’un diagnostic ou de prendre un diagnostic enfonction de son ´etat de sant´e.
- It correctly translated the the source sentence until [a medical center], but it deviated afterward
- The RNNsearch-50 generated the following correct translation:
Un privil`ege d’admission est le droit d’un m´edecin d’admettre un patient `a unhˆopital ou un centre m´edical pour effectuer un diagnostic ou une proc´edure, selonson statut de travailleur des soins de sant´e `a l’hˆopital.
- It preserve the whole meaning of the input sentence without omitting any details
- This is because the RNNsearch does not require encoding a long sentence into a fixed-length vector, but only accurately encoding the parts of the input sentence that surround a particular word.
- The conventional approach (encoder-decoder) issues
- Encodes a whole input sentence into a fixed-length vector
- it cannot translate long sentences
- Propose a novel approach by extending the basic encoder-decoder
- No fixed size representation
- Plausible alignment