Context-Dependent Word Representation for Neural Machine Translation

Context-Dependent Word Representation for Neural Machine Translation

Heeyoul Choi
Samsung Electronics
University of Montreal &Kyunghyun Cho
New York University
 &Yoshua Bengio
University of Montreal
CIFAR Senior Fellow

We first observe a potential weakness of continuous vector representations of symbols in neural machine translation. That is, the continuous vector representation, or a word embedding vector, of a symbol encodes multiple dimensions of similarity, equivalent to encoding more than one meaning of the word. This has the consequence that the encoder and decoder recurrent networks in neural machine translation need to spend substantial amount of their capacity in disambiguating source and target words based on the context which is defined by a source sentence. Based on this observation, in this paper we propose to contextualize the word embedding vectors using a nonlinear bag-of-words representation of the source sentence. Additionally, we propose to represent special tokens (such as numbers, proper nouns and acronyms) with typed symbols to facilitate translating those words that are not well-suited to be translated via continuous vectors. The experiments on En-Fr and En-De reveal that the proposed approaches of contextualization and symbolization improves the translation quality of neural machine translation systems significantly.


Context-Dependent Word Representation for Neural Machine Translation

  Heeyoul Choi Samsung Electronics University of Montreal Kyunghyun Cho New York University Yoshua Bengio University of Montreal CIFAR Senior Fellow

1 Introduction

Neural machine translation is a recently proposed paradigm in machine translation, which is often entirely built as a single neural network Kalchbrenner and Blunsom (2013); Sutskever et al. (2014); Bahdanau et al. (2015). The neural machine translation system, which often consists of an encoder and decoder, projects and manipulates a source sequence of discrete linguistic symbols (source sentence) in a continuous vector space, and decodes a target sequence of symbols (target sentence or translation.) This is contrary to the conventional machine translation systems, such as phrase-based statistical machine translation Koehn et al. (2003), which work directly at the discrete symbol level.

In more detail, the first step of any neural machine translation system is to convert each atomic symbol into a corresponding continuous vector, which is often called as a word embedding. This step is done for each source word independently of the other words and results in a source sequence of word embeddings. The encoder network, which is often implemented as a recurrent neural network, encodes this source sentence either into a single context vector Sutskever et al. (2014); Cho et al. (2014b) or into a sequence of context vectors Kalchbrenner and Blunsom (2013); Bahdanau et al. (2015).

The decoder network, again a recurrent neural network, generates a translation word-by-word while being conditioned on the context representation of the source sentence. At each step of generation in the decoder, the internal hidden state of the decoder is updated first. The dot product between this hidden state and the output word embedding vector of each word in the target vocabulary is computed and normalized across all the target words, resulting in a probability distribution over the target vocabulary. A target word is selected based on this distribution, and the whole process is recursively repeated until the end-of-sequence symbol is generated.

Among different variants of neural machine translation, the attention-based approach Bahdanau et al. (2015) has recently become de facto standard. It has been found to perform comparably to or better than the existing phrase-based statistical systems in many language pairs including En-Fr Jean et al. (2015a), En-De Jean et al. (2015a, b); Luong et al. (2015a), En-Cs Jean et al. (2015b), and En-Zh Shen et al. (2015). Much of these recent improvements have been made by tackling, e.g., the attention mechanism (which is central to the attention-based neural translation system) and the computational issues arising from having a large target vocabulary.

Unlike these recent works, we focus on source- and target-side word embedding vectors in this paper. More specifically, we first notice that the transformation from and to high-dimensional word embedding vectors is done for each word largely independent of each other. We conjecture that only a few axes in this high-dimensional space are relevant given a source sentence and that we can remove much of the ambiguity in the choice of words by restricting, or turning off, most of the irrelevant dimensions. We propose to achieve this automated way to turn off some dimensions of word embeddings by contextualizing a word embedding vector.

In addition to the proposed contextualization of both source and target word embedding vectors, we propose to extend the unknown token replacement technique proposed in Luong et al. (2015b) to multiple token types. This extension, to which we refer as symbolization, introduces multiple meta-tokens such as the number token and the proper name token in addition to the unknown-word token. This symbolization effectively remaps rare tokens into more frequent meta-tokens and thereby results in improved translation quality.

We extensively evaluate the proposed contextualization and symbolization on two language pairs–En-Fr and En-De– with the attention-based neural machine translation model. The experiments reveal that the contextualization and symbolization each improves the translation quality by 2 BLEU scores, and together by 4 BLEU points on En-Fr. On En-De, they result in 1–2 BLEU score improvements each, and together 2.5 BLEU score increase.

2 Background: Neural Machine Translation

In this section, we give a brief overview of neural machine translation. More specifically, we describe the attention-based neural machine translation Bahdanau et al. (2015) which will be used in the experiments later. However, we note that the proposed contextualization and symbolization techniques are generally applicable to any other type of neural machine translation systems such as the sequence-to-sequence model Sutskever et al. (2014).

The attention-based neural machine translation system computes a conditional distribution over translations given a source sentence :

This is done by a neural network that consists of an encoder, a decoder and the attention mechanism.

The encoder is often implemented as a bidirectional recurrent neural network that reads the source sentence word-by-word. Before being read by the encoder, each source word is projected onto a continuous vector space:


where is a one-hot vector defined as


is a source word embedding matrix, where and are the word embedding dimension and the vocabulary size, respectively.

The resulting sequence of word embedding vectors is then read by the bidirectional encoder recurrent network which consists of forward and reverse recurrent networks. The forward recurrent network reads the sequence in the left-to-right order:

while the reverse network reads it right-to-left:

where the initial hidden states and are initialized as all-zero vectors. The hidden states from the forward and reverse recurrent networks are concatenated at each time step to form an annotation vector : This concatenation results in a context that is a tuple of annotation vectors: The recurrent activation functions and are in most cases either long short-term memory units (LSTM, Hochreiter and Schmidhuber (1997)) or gated recurrent units (GRU, Cho et al. (2014a).)

The decoder consists of two sub-components–a recurrent network and the attention mechanism. The recurrent network in the decoder is a unidirectional language model, which computes the conditional distribution over the next target word given all the previous target words and the source sentence:

The decoder recurrent network maintains an internal hidden state . At each time step , it first uses the attention mechanism to select, or weight, the annotation vectors in the context tuple . The attention mechanism, which is a feedforward neural network, takes as input both the previous decoder hidden state, and one of the annotation vectors, and returns a relevant score :

These relevance scores are normalized to be positive and sum to 1:111 For more variants of the attention mechanism, we refer the readers to Luong et al. (2015a).


We use the normalized scores to compute the weighted sum of the annotation vectors

which will be used by the decoder recurrent network to update its own hidden state by

Similarly to the encoder, is implemented as either an LSTM or GRU. is a target-side word embedding vector computed by


similarly to Eq. (1).

The probability of each word in the target vocabulary is computed by

where is the -th row vector of the target word embedding matrix.

The neural machine translation model is usually trained to maximize the log-probability of the correct translation given a source sentence using a large training parallel corpus. This is done by stochastic gradient descent, where the gradient of the log-likelihood is efficiently computed by the backpropagation algorithm.

3 Contextualized Word Embedding Vectors

3.1 Word Embedding Vectors

One-hot representation of a word in Eq. (2) is unique in the sense that each and every word in a vocabulary is equally distant from every other word. This implies that the words lose all the information relative to the other words, when represented as a one-hot vector. The meaning of a word, relative to those of the other words in the vocabulary, is thus learned through the associated word embedding vector (Eqs. (1)–(4)) during training. In other words, training brings similar words close to each other in the word embedding space and dissimilar words far away from each other.

This phenomenon of similarity learning via word embedding vectors has been observed in many different natural language processing tasks done with neural networks. Already in 1991, Miikkulainen and Dyer Miikkulainen and Dyer (1991) noticed that training a neural network with one-hot vectors as its input learns the word embedding vectors that “code properties of the input elements that are most crucial to the task.” Based on this observation Bengio et al. Bengio et al. (2003) proposed to build a neural network based language model and found that it generalizes better to unseen or rare -grams: the word embedding vectors capture similarities between words and the neural network can learn a smooth mapping that automatically generalizes by producing similar outputs for semantically similar input sequences. The interest in word embedding vectors, or distributed representation of words, was fueled by the earlier observations that these unsupervised word embedding vectors can be used to improve supervised natural language tasks greatly Collobert et al. (2011); Turian et al. (2010).

3.2 Multiple Dimensions of Similarity

An important characteristic of the high-dimensional word embedding vectors is that it encodes multiple dimensions of similarities. This is necessary in order for a neural network to cope with polysemy. We can qualitatively check this phenomenon of multiple dimensions of similarities by inspecting a local chart of the manifold on which the word embedding vectors reside.

For any word under inspection, we find the nearest neighbours in the word embedding matrix. The word embedding vectors now characterize a local chart centered at , and we use principal component analysis (PCA) to find the corresponding lower-dimensional Euclidean space. In this Euclidean space, we can inspect the nearest neighbours along each coordinate.222 The code for this analysis is available publicly at In Table 1, we show two such examples using the word embedding vectors trained as a part of the continuous-bag-of-word (CBoW) network Mikolov et al. (2013).333 We used the word embedding vectors provided as a part of Hill et al. (2015). These examples clearly show that each word embedding vector encodes more than one notions of similarities. A similar behaviour can only be observed with multi-map t-SNE Van der Maaten and Hinton (2012).

Word Axis Nearest Neighbours
notebook 1 diary notebooks (notebook) sketchbook jottings
2 palmtop notebooks (notebook) ipaq laptop
power 1 powers authority (power) powerbase sovereignity
2 powers electrohydraulic microwatts hydel (power)
Table 1: The placements of the word embedding vectors along the principals axes in the local charts of “notebook” and “power”. In the case of “notebook”, it is clear that the first axis corresponds to different types of books for writing a note, while the second axis corresponds to portable computing devices. In the case of “power”, the first axis corresponds to political or social authority, while the second axis to physical energy.

3.3 Contextualized Word Embeddings

The fact that each word embedding vector represents multiple dimensions of similarity implies that a subsequent part of a neural network needs to disambiguate the word based on the context in which the word was used. In the case of neural machine translation, we should consider source and target word embedding vectors separately. The encoder, which is implemented as a bidirectional recurrent network, can disambiguate it by using all the other words in a source sentence. On the other hand, the decoder can exploit both the previous words in a target sentence as well as all the source words.

Already pointed out in 1949 by Weaver Weaver (1949), much of ambiguity in word meaning can be resolved by considering surrounding words. The consequence of this in neural machine translation is that the recurrent network, either in the encoder or decoder, needs to remember all the previous words until the word in question in order to decide its meaning disambiguously. In other words, the encoder and decoder must sacrifice their capacity in disambiguating the words. This is undesirable, as what we truly want the encoder and decoder to do is to capture the higher-level compositional structures of a sentence that are necessary for translation.

In order to address this issue and to reduce the burden from the recurrent networks in a neural machine translation system, we propose to contextualize the word embedding vectors before being fed to the recurrent networks as shown in Fig. 1. This contextualization disambiguates the word’s meaning by masking out some dimensions of the word embedding vectors based on the context.

(a) (b)
Figure 1: Graphical illustrations of the neural machine translation system (a) without and (b) with the proposed contextualization.

Let us describe in detail the proposed contextualization. First, we define the context as a representation of the unordered set of all source words and compute it as the average of the nonlinearly transformed source word embedding vectors, i.e.,


where is a feedforward neural network parametrized by .

Then, we compute a context mask from for each word embedding vector before it is fed into an input or output recurrent network. This is simply done by

where is an element-wise multiplication and is an element-wise sigmoid function and transforms the context to a binary-like mask, with and (weight matrices), and (bias vectors) being additional parameters.

Recall that we introduced earlier in Sec. 3.2 a complicated procedure based on estimating a local chart on a manifold using PCA. Compared to that procedure, our proposal for contextualization may seem simple and perhaps insufficient. This is however not a serious issue due to two reasons. First, the context mask is extracted via a highly nonlinear function in Eq. (5) which can learn to effectively project axes from the Euclidean space, corresponding to a local chart, back to the coordinates on the manifold. Second, as both the word embedding vectors are learned together, we expect the dimensions of the word embedding vector to disentangle multiple dimensions of similarity automatically to maximize the use of the proposed contextualization routine. Although both of these are not easily verifiable, we show later in the experiment that the proposed contextualization indeed improves the translation quality.

4 Symbolization

4.1 Proper Nouns, Digits and Rare Words

The use of continuous vectors as an intermediate representation of source and target sentences in neural machine translation greatly improves generalization of machine translation by avoiding the issue of data sparsity (see, e.g., Sec. 5.2.1 in Cho (2015).) This, however, brings in some unnecessary complications as well. One such complication is in handling proper nouns, digits and rare words.

First, the rare words, which often occur up to a handful of times in a whole training corpus, are problematic, because their word embedding vectors cannot be well estimated during training. It is hence a usual practice to map all those rare words whose frequencies are under a predefined threshold to a single token representing an unknown word. This approach has been used without much problem in language modeling, where the objective is to score a given sentence. However, it is unacceptable for a machine translation system to generate these unknown symbols when generating a translation.

The second issue is with digits. Clearly the meaning of any digit is not defined by its context, and there is a clear, single meaning associated with each digit, that is the number denoted by it. The conversion to and from a continuous vector space of a digit may therefore introduce unnecessary noise, resulting in an incorrect translation.

Proper nouns often exhibit both of the above problems. They are often rare, except for the proper nouns of a famous person, organization, object or location. Furthermore, the transformation between a proper noun and a high-dimensional continuous vector likely introduces noise that is absolutely not necessary, as the meaning of such a proper noun is fixed to a single entity.

These issues and their underlying causes suggest that it would be beneficial to treat these three cases separately from all the other words. This is precisely what we propose to do, and we will describe it in more detail below.

4.2 Previous Approaches

In most of these special cases, a source word is directly copied to a target sentence either as it is or after a simple transformation via dictionary lookup. This property suggests a simple algorithm that can be run outside neural machine translation. Assuming that there exists an alignment between a rare source word and a word or placeholder in the target sentence, we can look up the rare word in a pre-built dictionary and replace the target-side placeholder with the queried word which can be the source word itself or its appropriate translation or transliteration.

Based on this observation, Jean et al. Jean et al. (2015a) earlier proposed a number of heuristics for handling rare words with the attention-based neural machine translation. In their approach, the attention weights from Eq. (3) are used to determine the source word aligned to each of the unknown tokens in the generated translation, i.e., . The source word determined by this mechanism is translated word-wise by looking up a pre-built dictionary, and the corresponding unknown token in the translation is replaced with the result of the look-up.

Simultaneously, Luong et al. Luong et al. (2015b) proposed another mechanism that does not require the attention mechanism. They used an external alignment mechanism, such as IBM Model 2 Brown et al. (1993), to find the alignment between the source and target words in the training corpus. This alignment is used to assign multiple, numbered unknown tokens for rare words so that the correspondences between these tokens in the source and target sides are maintained. For instance, the first unknown token in the source side and its corresponding target word will be replaced with , regardless of the target word’s position in the translation. During test time, given a source sentence and a generated translation, each of the unknown tokens in the translation will be replaced by querying the corresponding source-side word in a pre-built dictionary.

Both of these approaches have been highly effective in improving the translation quality. For instance, Jean et al. Jean et al. (2015a) reported +3 and +2.5 BLEU improvement with the simple replacement technique based on the attention mechanism on En-Fr and En-De, respectively. Similarly, Luong et al. Luong et al. (2015b) reported +1.6–+2.8 BLEU improvement on En-Fr with their approach based on the positional unknown tokens .

4.3 Symbolization of Proper Nouns, Digits and Rare Words

In this paper, we extend the approach by Luong et al. Luong et al. (2015b), which is based on the positional unknown tokens, to include multiple positional special tokens. Instead of a single special token , we propose to use three special tokens:

  1. : Digit

  2. : Proper noun

  3. : Acronym

See Table 2 for examples of symbolization.


The basic idea is to replace any consecutive digits (without blank spaces in-between) appearing both in the source and target sentences with the special symbol , where denotes its order in the source sentence. In order to better address the cases of a number followed immediately by its unit, we separate the unit or any non-digit characters from consecutive digits (e.g., ‘137Kg’ ‘137’, ‘Kg’.) Also, we normalize the variations in writing a long digit such as decimal marks (‘,’ vs. ‘.’) and digit grouping deliminators (‘,’ vs. ‘.’ vs. ‘ ’,) when matching digits in the source and target sides.

Proper Noun

In many of the European languages, which we mainly consider in this paper, capitalization is used to indicate that a word is a proper noun. Therefore, we replace a maximal consecutive phrase of more than one capitalized words appearing on both the source and target side, with the special symbol . Similarly to , denotes its order in the source sentence. We consider a phrase, as many proper nouns are often proper phrases (e.g., ‘New York’.) When spotting these proper noun phrases, we do not consider non-capitalized functional words such as ‘of’ in order to properly handle noun phrases in the form of ‘X of Y’ (e.g., ‘World of Warcraft’.)


Most of the acronyms can be handled similarly to proper nouns, except that there are cases where acronyms of a single entity differ across languages. For instance, the acronym of ‘International Monetary Fund’ is ‘IMF’ in English but ‘FMI’ in French. We notice that it is rare to have more than one such cases in a single sentence pair. We first replace all the matching acronym pairs. If there is only one all-capital word left in each of the source and target sentences, we consider them a match and replace it with .

Rule Dictionary

We construct a mapping rule for each matching pair that was replaced by one of the special symbols. This rule dictionary is used during test to replace the generated special symbols in a translation. Although it is certainly possible to incorporate external rules into this dictionary, we do not test it to avoid including any external resource when evaluating the proposed symbolization technique.

Note that this approach of symbolization has been used to a certain extent in more conventional statistical machine translation and language modelling. For more discussion, we refer the reader to Sec. 7.4 of Koehn (2010). This approach however has not been adopted widely in neural machine translation yet.

En The World of Warcraft and Warcraft III American regional finals were held at the House of Blues on June 2nd and 3rd in San Diego , California .
Fr Les finales régionales de Warcraft III et de World of Warcraft pour l' Amérique du Nord se sont déroulées au House of Blues , les 2 et 3 juin derniers à San Diego .
En The and American regional finals were held at the on June ^^nd and ^^rd in , California .
Fr Les finales régionales de et de pour l' Amérique du Nord se sont déroulées au , les et juin derniers à .
Table 2: Examples of symbolization applied to En-Fr sentence pairs. ^^ is a special indicator that the words immediately before and after be merged without a blank space after de-symbolization.

5 Experimental Settings

5.1 Tasks and Corpora

We evaluate the neural machine translation systems with and without the proposed methods on two tasks of English-to-French (En-Fr) and English-to-German (En-De) translation. We use all the parallel corpora made publicly available via WMT’14.444 The En-Fr corpora are cleaned following the procedure in Cho et al. (2014b), and after tokenization, has approximately 250M words (English side.) The En-De corpora are prepared following the procedure in Jean et al. (2015a), resulting in approximately 100M words (English side.)

We use newstest-2014 and newstest-2013 as the development sets and newsdiscusstest2015 and newstest2015 as the test sets for En-Fr and En-De, respectively.

5.2 Vocabulary Preparation

Both of the corpora go through a minimal set of preprocessing. First, we tokenize them using the script provided as a part of Moses.555 As a comparison, we evaluate a setting where byte pair encoding (BPE) is used, as a replacement of the proposed symbolization, to extract sub-word symbols Sennrich et al. (2015b). This has been found to be an effective and efficient approach to handling the issue of a large target vocabulary Sennrich et al. (2015a); Firat et al. (2016); Chung et al. (2016) and is known to be able to transliterate rare, proper nouns up to a certain extent Sennrich et al. (2015b). In all the cases, we use up to top-30k most frequent symbols (either tokenized words or BPE-based sub-words.)

The proposed symbolization is applied right after the initial tokenization. In the case of using BPE, the BPE segmentation is done on the symbolized corpus, and in the test time, the BPE de-segmentation is followed by the de-symbolization.

En-Fr English French
Symbolization Before After Before After
Unique words 1.77M 0.44M 1.73M 0.49M
Total words 294M 258M 336M 297M
Coverage (%) 96.1 99.1 96.1 98.9
En-De English German
Symbolization Before After Before After
Unique words 709K 411K 1,553K 1,035K
Total words 117M 102M 110M 95.5M
Coverage (%) 97.7 98.6 93.3 95.3
Table 3: Corpora Statistics

Aside the BPE segmentation, we noticed that the number of unique tokens on each corpus greatly decreases after the proposed symbolization is applied. This improves the coverage by the 30k-word-large vocabulary as much as 3 percentage points. See Table 3 for detailed statistics.

5.3 Training

We use the very same attention-based neural translation model from Bahdanau et al. (2015). The only change we make is to use long short-term memory units (LSTM) instead of gated recurrent units (GRU). Further, instead of Adadelta Zeiler (2012), we use Adam Kingma and Ba (2014) for adaptive learning rate adjustment with gradient clipping (threshold at .) As the proposed contextualization and symbolization do not alter the internals of the neural machine translation model, we use this model and training configuration for all the experiments.

We remove any sentence pair if more than 10% and 30% of all the words are out-of-vocabulary after the symbolization for En-Fr and En-De, respectively. Also, we only use sentence pairs of which both sentences are only up to 50 symbols long. We early-stop any training when the BLEU score on a development set does not improve any more.

5.4 Evaluation

A simple forward beamsearch is used to approximately find the most likely translation given a source sentence from a trained model. We set the width of the beam to 12 following Bahdanau et al. (2015). The generated translations are scored against the reference translations using ‘multi-bleu.perl’ script from Moses.666 This evaluation is done on tokenized sentences.

6 Result and Analysis

6.1 Quantitative Analysis

In Table 4, we present the translation qualities, measured by BLEU on the test sets, of all the trained models on both En-Fr and En-De. The most noticeable observation is that both of the proposed methods–contextualization and symbolization– improve the translation quality over the baseline model which is a vanilla attention-based neural translation system (+Context and +Symbol.) Furthermore, the proposed contextualization and symbolization are complementary to each other, and the most improvement is made when both of them are used together (Baseline+Context+Symbol.)

As expected, the proposed symbolization has a similar effect as the BPE segmentation does (Baseline+Symbol vs. Baseline+BPE) on both of the language pairs. We observe that the proposed contextualization, which was found to be complementary to the symbolization, improves the translation quality even when the BPE-base subword symbols were used.

En-Fr En-De
Beam Width 1 12 1 12
Baseline 24.54 (27.02) 27.62 (29.21) 15.01 (15.84) 15.93 (17.05)
+Context (C) 27.62 (29.01) 28.87 (30.72) 16.24 (16.68) 17.82 (17.89)
+Symbol (S) 27.05 (29.51) 29.39 (31.83) 17.78 (17.55) 19.45 (19.00)
+C+S 28.58 (31.22) 30.10 (33.30) 18.87 (18.34) 20.79 (19.55)
+BPE 27.05 (29.10) 30.35 (32.32) 17.43 (17.51) 20.51 (19.97)
+BPE+C 29.65 (31.39) 32.02 (33.80) 19.09 (18.84) 21.95 (20.81)
+BPE+C+S 29.32 (31.33) 31.19 (33.83) 19.54 (19.48) 21.99 (20.97)
Table 4: BLEU scores on the test sets for En-Fr and En-De with two different beam widths. The scores on the development sets are in the parentheses.

6.2 Effect of Contextualization

We conjectured earlier in Sec. 3.3 that the contextualization helps translation by selectively masking out irrelevant some dimensions of word meaning based on the context. This directly implies that the neural translation system with the contextualization will be less confused among many similar words. Browsing through the translations of the source sentences included in the development and test sets, we have observed many such cases, and the following is one such example:

The Scorsese-DiCaprio duo seems to have rediscovered the magic that brought them together in Shutter Island .

The above sentence is translated by the neural translation system with BPE into

Le duo de Corsso-DiCaprio semble avoir retrouvé la magie qui les a réunis dans l’île Shuttle .

Meanwhile, the same sentence is translated into

Le duo Scorson-DiCaprio semble avoir redécouvert la magie qui les rassemblait dans l' île de Shutter .

when the contextualization was used.

Without the contextualization, the word rediscovered was translated into “retrouvé” (“found” according to Collins French-English Dictionary777 ). This is not an incorrect translation, but the translation of this word into “redécouvert” (“rediscovered” according to the same source888 ) by the contextualized model is closer to the original English word. This is an example of the source-side context disambiguating the target word.

Let us provide another example in the case of En-De. The following source sentence

There are 13,435 cumulative cases (12,158 AIDS and 1,317 HIV).

is translated by the neural translation model with BPE into

Es gibt 13.335 kumulierte Fälle (12,158 Aidg und 1,317 HIV).

The same sentence is translated by the same model with the contextualization into

Es gibt 13.435 kumulative Fälle (12.158 AIDS und 1.317 HIV).

Notice that the tokens 13,435 and 13.335 are close to each other in the word embedding space, as they represent close-by numbers. This makes it difficult for a vanilla neural machine translation model to distinguish between those two. The contextualization, as seen above, can successfully disambiguate “13.435” from “13.335” and correctly puts the former.

6.3 Effect of Symbolization

As briefly mentioned earlier in Sec. 5.2, it is known that neural machine translation transliterates rare (proper) nouns using BPE-based subword symbols. This is however not perfect, as the rules for transliteration exhibit many exceptions, and statistical generalization often fails to account for rare proper nouns. For instance, the following sentence

Trakhtenberg was the presenter of many programs before Hali-Gali times.

is translated by the model using BPE-based subword symbols into

Trakttenberg war der Moderator vieler Programme vor Hali-Gi Male.

It is easy to notice that the model has failed at correctly transliterating “Trakhtenberg”. On the contrary, once the symbolization is used (together with the contextualization), the model correctly translates the source sentence above into

Trakhtenberg war der Moderator von vielen Programmen vor Hali-Gali-Zeiten.

A similar behaviour is also observed with “Hali-Gali”. This example clearly demonstrates the effectiveness of the proposed symbolization, even when the BPE-based subword symbols are used.

The advantage of the symbolization is more apparent when words are used as basic symbols instead of BPE-based subword symbols. The same source sentence is translated into

UNK war der Moderator von vielen Programmen vor UNK.

using the word-based translation model with the contextualization only. By including the symbolization as pre- and post-processing routines, we get

Trakhtenberg war der Moderator vieler Programme , bevor Hali-Gali-Zeiten UNK .

It is clear that both of those proper nouns are correctly translated.

7 Conclusions

In this paper, we discussed the shortcoming of the existing neural machine translation in terms of how a word or a symbol is represented as a continuous vector and fed to recurrent networks. Based on the observation that a word embedding vector encodes multiple dimensions of similarities, we proposed to contextualize it by adaptively masking out each dimension of the source and target embedding vectors based on the context of a source sentence. In addition to the contextualization of the word embedding vectors, we also propose to symbolize special tokens to facilitate translating those tokens that are not well-suited for translating via continuous vectors.

The experiments on En-Fr and En-De revealed that both the contextualization and symbolization techniques improve the translation quality of neural machine translation significantly. Furthermore, we confirmed that these approaches are agnostic to the type of linguistic symbols used to represent source and target sentences by using byte-pair encoding to segment source and target sentences. Especially, the proposed contextualization was found to be complementary to the use of BPE-based subword symbols, and we find it an interesting future work to test the contextualization with character-level neural machine translation Ling et al. (2015); Chung et al. (2016).


The authors would like to thank the developers of Theano Bastien et al. (2012). We acknowledge the support of the following agencies for research funding and computing support: NSERC, Calcul Québec, Compute Canada, the Canada Research Chairs, CIFAR and Samsung. KC thanks the support by Facebook and Google (Google Faculty Award 2016).


  • Bahdanau et al. (2015) Bahdanau, D., K. Cho, and Y. Bengio, 2015: Neural Machine Translation by Jointly Learning to Align and Translate. In Proc. Int’l Conf. on Learning Representations (ICLR).
  • Bastien et al. (2012) Bastien, F., P. Lamblin, R. Pascanu, J. Bergstra, I. Goodfellow, A. Bergeron, N. Bouchard, D. Warde-farley, and Y. Bengio, 2012: Theano : new features and speed improvements. arXiv preprint arXiv:1211.5590.
  • Bengio et al. (2003) Bengio, Y., R. Ducharme, and P. Vincent, 2003: A Neural Probabilistic Language Model. The Journal of Machine Learning Research, 3, 1137–1155.
  • Brown et al. (1993) Brown, P. F., V. J. D. Pietra, S. A. D. Pietra, and R. L. Mercer, 1993: The mathematics of statistical machine translation: Parameter estimation. Computational linguistics, 19(2), 263–311.
  • Cho (2015) Cho, K., 2015: Natural language understanding with distributed representation. arXiv preprint arXiv:1511.07916.
  • Cho et al. (2014a) Cho, K., B. van Merrienboer, D. Bahdanau, and Y. Bengio, 2014a: On the properties of neural machine translation: Encoder–decoder approaches. arXiv preprint arXiv:1409.1259.
  • Cho et al. (2014b) Cho, K., B. van Merrienboer, C. Gulcehre, F. Bougares, H. Schwenk, and Y. Bengio, 2014b: Learning phrase representations using rnn encoder-decoder for statistical machine translation. In Conference on Empirical Methods in Natural Language Processing (EMNLP 2014).
  • Chung et al. (2016) Chung, J., K. Cho, and Y. Bengio, 2016: A character-level decoder without explicit segmentation for neural machine translation. arXiv preprint arXiv:1603.06147.
  • Collobert et al. (2011) Collobert, R., J. Weston, L. Bottou, M. Karlen, K. Kavukcuoglu, and P. Kuksa, 2011: Natural language processing (almost) from scratch. The Journal of Machine Learning Research, 12, 2493–2537.
  • Firat et al. (2016) Firat, O., K. Cho, and Y. Bengio, 2016: Multi-way, multilingual neural machine translation with a shared attention mechanism. arXiv preprint arXiv:1601.01073.
  • Hill et al. (2015) Hill, F., K. Cho, A. Korhonen, and Y. Bengio, 2015: Learning to understand phrases by embedding the dictionary. arXiv preprint arXiv:1504.00548.
  • Hochreiter and Schmidhuber (1997) Hochreiter, S. and J. Schmidhuber, 1997: Long short-term memory. Neural computation, 9(8), 1735–80.
  • Jean et al. (2015a) Jean, S., K. Cho, R. Memisevic, and Y. Bengio, 2015a: On Using Very Large Target Vocabulary for Neural Machine Translation. In 53rd Annual Meeting of the Association for Computational Linguistics.
  • Jean et al. (2015b) Jean, S., O. Firat, K. Cho, R. Memisevic, and Y. Bengio, 2015b: Montreal neural machine translation systems for wmt15. In Proceedings of the Tenth Workshop on Statistical Machine Translation, pp. 134–140.
  • Kalchbrenner and Blunsom (2013) Kalchbrenner, N. and P. Blunsom, 2013: Recurrent continuous translation models. EMNLP, 3(39), 413.
  • Kingma and Ba (2014) Kingma, D. P. and J. L. Ba, 2014: Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
  • Koehn (2010) Koehn, P., 2010: Statistical Machine Translation. Statistical Machine Translation, Cambridge University Press, ISBN 9780521874151.
  • Koehn et al. (2003) Koehn, P., F. J. Och, and D. Marcu, 2003: Statistical phrase-based translation. In Proceedings of the 2003 Conference of the North American Chapter of the Association for Computational Linguistics on Human Language Technology-Volume 1, Association for Computational Linguistics, pp. 48–54.
  • Ling et al. (2015) Ling, W., I. Trancoso, C. Dyer, and A. W. Black, 2015: Character-based neural machine translation. arXiv preprint arXiv:1511.04586.
  • Luong et al. (2015a) Luong, M.-T., H. Pham, and C. D. Manning, 2015a: Effective approaches to attention-based neural machine translation. arXiv preprint arXiv:1508.04025.
  • Luong et al. (2015b) Luong, M.-T., I. Sutskever, Q. V. Le, O. Vinyals, and W. Zaremba, 2015b: Addressing the Rare Word Problem in Neural Machine Translation. arXiv preprint arXiv:1410.8206.
  • Miikkulainen and Dyer (1991) Miikkulainen, R. and M. G. Dyer, 1991: Natural language processing with modular neural networks and distributed lexicon. Cognitive Science, 15, 343–399.
  • Mikolov et al. (2013) Mikolov, T., G. Corrado, K. Chen, and J. Dean, 2013: Efficient Estimation of Word Representations in Vector Space. In Proc. Int’l Conf. on Learning Representations (ICLR).
  • Sennrich et al. (2015a) Sennrich, R., B. Haddow, and A. Birch, 2015a: Improving neural machine translation models with monolingual data. arXiv preprint arXiv:1511.06709.
  • Sennrich et al. (2015b) —, 2015b: Neural Machine Translation of Rare Words with Subword Units. arXiv preprint arXiv:1508.07909.
  • Shen et al. (2015) Shen, S., Y. Cheng, Z. He, W. He, H. Wu, M. Sun, and Y. Liu, 2015: Minimum Risk Training for Neural Machine Translation. arXiv preprint arXiv:1512.02433.
  • Sutskever et al. (2014) Sutskever, I., O. Vinyals, and Q. V. Le, 2014: Sequence to Sequence Learning with Neural Networks. In Advances in Neural Information Processing Systems (NIPS).
  • Turian et al. (2010) Turian, J., L. Ratinov, and Y. Bengio, 2010: Word representations: a simple and general method for semi-supervised learning. In Proceedings of the 48th annual meeting of the association for computational linguistics, Association for Computational Linguistics, pp. 384–394.
  • Van der Maaten and Hinton (2012) Van der Maaten, L. and G. Hinton, 2012: Visualizing non-metric similarities in multiple maps. Machine learning, 87(1), 33–55.
  • Weaver (1949) Weaver, W., 1949: Translation. John Wiley and Sons.
  • Zeiler (2012) Zeiler, M. D., 2012: Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description