Integrating Weakly Supervised Word Sense Disambiguation into Neural Machine Translation

This paper demonstrates that word sense disambiguation (WSD) can improve neural machine translation (NMT) by widening the source context considered when modeling the senses of potentially ambiguous words. We first introduce three adaptive clustering algorithms for WSD, based on k-means, Chinese restaurant processes, and random walks, which are then applied to large word contexts represented in a low-rank space and evaluated on SemEval shared-task data. We then learn word vectors jointly with sense vectors defined by our best WSD method, within a state-of-the-art NMT system. We show that the concatenation of these vectors, and the use of a sense selection mechanism based on the weighted average of sense vectors, outperforms several baselines including sense-aware ones. This is demonstrated by translation on five language pairs. The improvements are more than 1 BLEU point over strong NMT baselines, +4% accuracy over all ambiguous nouns and verbs, or +20% when scored manually over several challenging words.


Introduction
The correct translation of polysemous words remains a challenge for machine translation (MT). While some translation options may be interchangeable, substantially different senses of * Work conducted while at the Idiap Research Institute. source words must generally be rendered by different words in the target language. Hence, an MT system should identify -implicitly or explicitlythe correct sense conveyed by each occurrence in order to generate an appropriate translation. For instance, in the following sentence from Europarl, the translation of 'deal' should convey the sense 'to handle' (in French 'traiter') and not 'to cope' (in French 'remédier', which is wrong): Source: How can we guarantee the system of prior notification for high-risk products at ports that have the necessary facilities to deal with them?
Current MT systems perform word sense disambiguation implicitly, based on co-occurring words in a rather limited context. In phrase-based statistical MT, the context size is related to the order of the language model (often between 3 and 5) and to the length of n-grams in the phrase table (seldom above 5). In attention-based neural MT (NMT), the context extends to the entire sentence, but multiple word senses are not modeled explicitly. The implicit sense information captured by word representations used in NMT leads to a bias in the attention mechanism towards dominant senses. Therefore, the NMT decoders cannot clearly identify the contexts in which one word sense should be used instead of another one. Hence, while NMT can use local constraints to translate 'great rock band' into French as 'superbe groupe de rock' rather than 'grande bande de pierre' -thus correctly assigning the musical rather than geological sense to 'rock' -it fails to do so for word senses which require larger contexts.
In this paper, we demonstrate that the explicit modeling of word senses can be helpful to NMT by using combined vector representations of word types and senses, which are inferred from contexts that are larger than that of state-of-the-art NMT systems. We make the following contributions: • Weakly supervised word sense disambiguation (WSD) approaches integrated into NMT, based on three adaptive clustering methods and operating on large word contexts.
• Three sense selection mechanisms for integrating WSD into NMT, respectively based on top, average, and weighted average (i.e., attention) of word senses.
• Consistent improvements against baseline NMT on five language pairs: from English into Chinese, Dutch, French, German, and Spanish.
The paper is organized as follows. In Section 2, we present three adaptive WSD methods based on k-means clustering, the Chinese restaurant process, and random walks. In Section 3, we present three sense selection mechanisms which integrate the word senses into NMT. The experimental details appear in Section 4, while the results concerning the optimal parameter settings are presented in Section 5, where we also show that our WSD component is competitive on the SemEval 2010 shared task. Section 6 presents our results: the BLEU scores increase by about one point with respect to a strong NMT baseline, the accuracy of ambiguous noun and verb translation improves by about 4%, while a manual evaluation of several challenging and frequent words shows an improvement of about 20%. A discussion of related work appears finally in Section 7.

Adaptive Sense Clustering for MT
In this section, we present the three unsupervised or weakly supervised WSD methods used in our experiments, which aim at clustering different occurrences of the same word type according to their senses. We first consider all nouns and verbs in the source texts that have more than one sense in WordNet, and extract from there the definition of each sense and, if available, the example. For each occurrence of such nouns or verbs in the training data, we use word2vec to build word vectors for their contexts, i.e. neighboring words. All vectors are passed to an unsupervised clustering algorithm, possibly instantiated with WordNet definitions or examples. The resulting clusters can be numbered and used as labels, or their centroid word vector can be used as well, as explained in Section 3.
This approach answers several limitations of previous supervised or unsupervised WSD methods. On the one hand, supervised methods require data with manually sense-annotated labels and are thus limited to typically small subsets of all word types, e.g. up to a hundred of content words targeted in SemEval 2010 1  and up to a thousand words in SemEval 2015 (Moro and Navigli, 2015). In contrast, our method does not require labeled texts for training, and applies to all word types with multiple senses in WordNet (e.g. nearly four thousands for some data sets, see Table 1). On the other hand, unsupervised methods often pre-define the number of possible senses for all ambiguous words before clustering their occurrences, and do not adapt to what is actually observed in the data; as a result, the senses are often too fine-grained for the needs of MT, especially for a particular domain. In contrast, our model learns the number of senses for each analyzed ambiguous word directly from the data.

Definitions and Notations
For each noun or verb type W t appearing in the training data, as identified by the Stanford POS tagger, 2 we extract the senses associated to it in WordNet 3 (Fellbaum, 1998) using NLTK. 4 Specifically, we extract the set of definitions D t = {d tj |j = 1, . . . , m t } and the set of examples of use E t = {e tj |j = 1, . . . , n t }, each of them containing multiple words. While most of the senses are accompanied by a definition, only about half of them also include an example of use.
Definitions d tj and examples e tj are represented by vectors defined as the average of the word embeddings over all the words constituting them (except stopwords). Formally, these vectors are d tj = ( w l ∈d tj w l )/|d tj | and e tj = ( w l ∈e tj w l )/|e tj |, respectively, where |d tj | is the number of tokens of the definition. While the entire definition d tj is used to build the d tj vector, we do not consider all words in the example e tj , but limit the sum to a fragment e tj contained in a window of size c centered around the considered word, to avoid noise from long examples. Hence, we divide by the number of words in this window, noted |e tj |. All the word vectors w l above are pre-trained word2vec embeddings from Google 5 (Mikolov et al., 2013). If dim is the dimensionality of the word vector space, then all vectors w l , d tj , and e tj are in R dim . Each definition vector d tj or example vector e tj for a word type W t is considered as a center vector for each sense during the clustering procedure.
Turning now to tokens, each word occurrence w i in a source sentence is represented by the average vector u i of the words from its context, i.e. a window of c words centered on w i , c being an even number. We calculate the vector u i for w i by averaging vectors from c/2 words before w i and from c/2 words after it. We stop nevertheless at the sentence boundaries, and filter out stopwords before averaging.

Clustering Word Occurrences by Sense
We adapt three clustering algorithms to our needs for WSD applied to NMT. The objective is to cluster all occurrences w i of a given word type W t , represented as word vectors u i , according to the similarity of their senses, as inferred from the similarity of the context vectors. We compare the algorithms empirically in Section 5.
k-means Clustering. The original k-means algorithm (MacQueen, 1967) aims to partition a set of items, which are here tokens w 1 , w 2 , . . . , w n of the same word type W t , represented through their embeddings u 1 , u 2 , . . . , u n where u i ∈ R dim . The goal of k-means is to partition (or cluster) these vectors into k sets S = {S 1 , S 2 , . . . , S k } so 5 code.google.com/archive/p/word2vec/ as to minimize the within-cluster sum of squared distances to each centroid µ i : (1) At the first iteration, when there are no clusters yet, the algorithm selects k random points as centroids of the k clusters. Then, at each subsequent iteration t, the algorithm calculates for each candidate cluster a new centroid of the observations, defined as their average vector, as follows: In an earlier application of k-means to phrasebased statistical MT, but not neural MT, we made several modifications to the original k-means algorithm, to make it adaptive to the word senses observed in training data (Pu et al., 2017). We maintain these changes and summarize them briefly here. The initial number of clusters k t for each ambiguous word type W t is set to the number of its senses in WordNet, either considering only the senses that have a definition or those that have an example. The centroids of the clusters are initialized to the vectors representing the senses from WordNet, either using their definition vectors d tj or their example vectors e tj . These initializations are thus a form of weak supervision of the clustering process.
Finally, and most importantly, after running the k-means algorithm, the number of clusters for each word type is reduced by removing the clusters that contain fewer than 10 tokens and assigning their tokens to the closest large cluster. 'Closest' is defined in terms of the cosine distance between u i and their centroids. The final number of clusters thus depends on the observed occurrences in the training data (which is the same data as for MT), and avoids modeling infrequent senses which are difficult to translate anyway. When used in NMT, in order to assign each new token from the test data to a cluster, i.e. to perform WSD, we select the closest centroid, again in terms of cosine distance.
Chinese Restaurant Process. The Chinese Restaurant Process (CRP) is an unsupervised method considered as a practical interpretation of a Dirichlet process (Ferguson, 1973) for nonparametric clustering. In the original analogy, each token is compared to a customer in a restaurant, and each cluster is a table where customers can be seated. A new customer can choose to sit at a table with other customers, with a probability proportional to the numbers of customers at that table, or sit at a new, empty table. In an application to multi-sense word embeddings, Li and Jurafsky (2015) proposed that the probability to "sit at a table" should also depend on the contextual similarity between the token and the sense modeled by the table. We build upon this idea and bring several modifications that allow for an instantiation with sense-related knowledge from WordNet, as follows.
For each word type W t appearing in the data, we start by fixing the maximal number k t of senses or clusters as the number of senses of W t in Word-Net. This avoids an unbounded number of clusters (as in the original CRP algorithm) and the risk of cluster sparsity by setting a non-arbitrary limit based on linguistic knowledge. Moreover, we define the initial centroid of each cluster as the word vector corresponding either to the definition d tj of the respective sense, or alternatively to the example e tj illustrating the sense.
For each token w i and its context vector u i the algorithm decides whether the token is assigned to one of the sense clusters S j to which previous tokens have been assigned, or whether it is assigned to a new empty cluster, by selecting the option which has the highest probability, which is computed as follows: In other words, for a non-empty sense, the probability is proportional to the popularity of the sense (number of tokens it already contains, N j ) and to the weighted sum of two cosine similarities s(·, ·): one between the context vector u i of the token and the definition of the sense d tj , and another one between u i and the average context vector of the tokens already assigned to the sense (µ j ). These terms are weighted by the two hyper-parameters λ 1 and λ 2 . For an empty sense, only the second term is used, weighted by the γ hyper-parameter.
Random Walks. Finally, we also consider for comparison a WSD method based on random walks on the WordNet knowledge graph (Agirre and Soroa, 2009;Agirre et al., 2014) available from the UKB toolkit. 6 In the graph, senses correspond to nodes and the relationships or dependencies between pairs of senses correspond to the edges between those nodes. From each input sentence, we extract its content words (nouns, verbs, adjectives, and adverbs) that have an entry in the WordNet weighted graph. The method calculates the probability of a random walk over the graph from a target word's sense ending on any other sense in the graph, and determines the sense with the highest probability for each analyzed word. In this case, the random walk algorithm is PageRank (Grin and Page, 1998), which computes a relative structural importance or 'rank' for each node.

Baseline Neural MT model
We now present several models integrating WSD into NMT, starting from an attention-based NMT baseline (Bahdanau et al., 2015;Luong et al., 2015). Given a source sentence X with words w x , , the model computes a conditional distribution over translations, expressed as p(Y = (w y 1 , w y 2 , ..., w y T )|X). The neural network model consists of an encoder, a decoder and an attention mechanism. First, each source word w x t ∈ V is projected from a one-hot word vector into a continuous vector space representation x t . Then, the resulting sequence of word vectors is read by the bidirectional encoder which consists of forward and backward recurrent networks (RNNs). The forward RNN reads the sequence in left-to-right order, i.e.
The hidden states from the forward and backward RNNs are concatenated at each time step The decoder RNN maintains an internal hidden state z t . After each time step t , it first uses the attention mechanism to weight the annotation vectors in the context tuple C. The attention mechanism takes as input the previous hidden state of the decoder and one of the annotation vectors, and returns a relevance score e t ,t = f ATT (z t −1 , h t ). These scores are normalized to obtain attention scores: These scores serve to compute a weighted sum of annotation vectors c t = T t=1 α t ,t h t , which are used by the decoder to update its hidden state: Similarly to the encoder, φ z is implemented as either an LSTM or GRU and y t −1 is the targetside word embedding vector corresponding to word w y .

Sense-aware Neural MT Models
To model word senses for NMT, we concatenate the embedding of each token with a vector representation of its sense, either obtained from one of the clustering methods presented in Section 2, or learned during encoding, as we will explain. In other words, the new vector w i representing each source token w i consists of two parts: where w i is the word embedding learned by the NMT, and µ i is the sense embedding obtained from WSD or learned by the NMT. To represent these senses, we create two dictionaries, one for words and the other one for sense labels, which will be embedded in a lowdimensional space, before the encoder. We propose several models for using and/or generating sense embeddings for NMT, named and defined as follows.
Top sense (TOP). In this model, we directly use the sense selected for each token by one of the WSD systems above, and use the embeddings of the respective sense as generated by NMT after training.
Weighted average of senses (AVG). Instead of fully trusting the decision of a WSD system (even one adapted to MT), we consider all listed senses and the respective cluster centroids learned by the WSD system. Then we convert the distances d l between the input token vector and the centroid of each sense S l into a normalized weight distribution either by a linear or a logistic normalization: where k is the total number of senses of token w i . The sense embedding for each token is computed as the weighted average of all sense embeddings: Attention-based sense weights (ATT). Instead of obtaining the weight distribution from the centroids computed by WSD, we also propose to dynamically compute the probability of relatedness to each sense based on the current word and sense embeddings during encoding, as follows. Given a token w i , we consider all the other tokens in the sentence (w 1 , . . . , w i−1 , w i+1 , . . . , w L ) as the context of w i , where L is the length of the sentence. We define the context vector of w i as the mean of all the embeddings u j of the words w j , i.e. u i = ( l =i u l )/(L − 1). Then, we compute the similarity f (u i , µ ij ) between each sense embedding µ ij and the context vector u i using an additional attention layer in the network, with two possibilities which will be compared empirically: The weights ω j are now obtained through the following softmax normalization: Finally, the average sense embedding is obtained as in Eq. (7) above, and is concatenated to the word vector u i . ATT model with initialization of embeddings (ATT ini ). The fourth model is similar to the ATT model, with the difference that we initialize the embeddings of the source word dictionary using the word2vec vectors of the word types, and the embeddings of the sense dictionary using the centroid vectors obtained from k-means.

Data, Metrics and Implementation
Datasets. We train and test our sense-aware MT systems on the data shown in Corpus 7 (Rafalovitch and Dale, 2009) and the Europarl Corpus 8 (Koehn, 2005). We first experiment with our models using the same dataset and protocol as in our previous work (Pu et al., 2017), to enable comparisons with phrase-based statistical MT systems, for which the sense of each ambiguous source word was modeled as a factor. Moreover, in order to make a better comparison with other related approaches, we train and test our sense-aware NMT models on large datasets from WMT shared tasks over three language pairs (EN/DE, EN/ES and EN/FR).
The dataset used in our previous work consists of 500k parallel sentences for each language pair, 5k for development and 50k for testing. The data originates from UN for EN/ZH, and from Europarl for the other pairs. The source sides of these sets contain around 2,000 different English word forms (after lemmatization) that have more than one sense in WordNet. Our WSD system generates ca. 3.8k different noun labels and 1.5k verb labels for these word forms.
The WMT datasets additionally used in this paper are the following ones. First, we use the complete EN/DE set from WMT 2016 (Bojar et al., 2016) with a total of ca. 4.5M sentence pairs. In this case, the development set is NewsTest 2013, and the testing set is made of NewsTest 2014 and 2015. Second, for EN/FR and EN/ES, we use data from WMT 2014 (Bojar et al., 2014) 9 with 5.3M sentences for EN/FR and 3.8M sentences for EN/ES. Here, the development sets are NewsTest 2008 and 2009, while the testing sets are NewsTest 2012 and 2013 for both language pairs. The source sides of these larger additional sets contain around 3,500 unique English word forms with more than one sense in WordNet, and our system generates ca. 8k different noun labels and 2.5k verb labels for each set.
Finally, for comparison purposes and model selection, we use the WIT 3 Corpus 10 (Cettolo et al., 2012), a collection of transcripts of TED talks. We use 150k sentence pairs for training, 5k for development and 50k for testing.
Pre-processing. Before assigning sense labels, we tokenize all the texts and identify the parts of speech using the Stanford POS tagger 11 . Then, we filter out the stopwords and the nouns which are proper names according to the Stanford Name Entity Recognizer 11 . Furthermore, we convert the plural forms of nouns to their singular forms and the verb forms to infinitives using the stemmer and lemmatizer from NLTK 12 , which is essential because WordNet has description entries only for base forms. The pre-processed text is used for assigning sense labels to each occurrence of a noun or verb that has more than one sense in WordNet.
K-means settings. Unless otherwise stated, we adopt the following settings in the k-means algorithm, with the implementation provided in Scikitlearn (Pedregosa et al., 2011). We use the definition of each sense for initializing the centroids, and later compare this choice with the use of examples. We set k t , the initial number of clusters, to the number of WordNet senses of each ambiguous word type W t , and set the window size for the context surrounding each occurrence to c = 8.
Neural MT. We build upon the attention-based neural translation model (Bahdanau et al., 2015) from the OpenNMT toolkit (Klein et al., 2017) 13 . We use long short-term memory units (LSTM) and not gated recurrent units (GRU). For the proposed ATT and ATT ini models, we add an external attention layer before the encoder, but do not otherwise alter the internals of the NMT model.
We set the source and target vocabulary sizes to 50,000 and the dimension of word embeddings to 500, which is recommended for OpenNMT, so as to reach a strong baseline. For the ATT ini model, since the embeddings from word2vec used for initialization have only 300 dimensions, we randomly pick up a vector with 200 dimensions within range [-0.1,0.1] and concatenate it with the vector from word2vec to reach the required number of dimensions, ensuring a fair comparison.
It takes around 15 epochs (25-30 hours on Idiap's GPU cluster) to train each of the five NMT models: the baseline and our four proposals. The AVG model takes more time for training (around 40 hours) since we use additional weights and senses for each token. In fact, we limit the number of senses for AVG to 5 per word type, after observing that in WordNet there are fewer than 100 words with more than 5 senses.
Evaluation metrics. For the evaluation of intrinsic WSD performance, we use the V -score, the F 1 -score, and their average, as used for instance at SemEval 2010 . The V -score is the weighted harmonic mean of homogeneity and completeness (favoring systems generating more clusters than the reference), while the F 1 -score measures the classification performance (favoring systems generating fewer clusters). Therefore, the ranking metric for SemEval 2010 is the average of the two.
We select the optimal model configuration based on MT performance on development sets, as measured with the traditional multi-bleu score (Papineni et al., 2002). Moreover, to estimate the impact of WSD on MT, we also measure the actual impact on the nouns and verbs that have several WordNet senses, by counting how many of them are translated exactly as in the reference translation. To quantify the difference with the baseline, we use the following coefficient. First, for a certain set of tokens in the source data, we note as N improved the number of tokens which are translated by our system with the same token as in the reference translation, but are translated differently by the baseline system. Conversely, we note as N degraded the number of tokens which are translated by the baseline system as in the reference, but differently by our system 14 . We use the normalized coefficient ρ = (N improved − N degraded )/T , where T is the total number of tokens, as a metric to specifically evaluate the translation of words submitted to WSD.
For all tables we mark in bold the best score per condition. For MT scores in Tables 5, 7, and 8, we 14 The values of N improved and N degraded are obtained using automatic word alignment. They do not capture, of course, the intrinsic correctness of a candidate translation, but only its identity or not with one reference translation.
show the improvement over the baseline and its significance based on two confidence levels: either p < 0.05 (indicated with a ' †') or p < 0.01 (' ‡'). P -values larger than 0.05 are treated as not significant and are left unmarked.

Best WSD Method Based on BLEU
We first select the optimal clustering method and its initialization settings, in a series of experiments with statistical MT over the WIT 3 corpus, extending and confirming our previous results (Pu et al., 2017). In Table 2, we present the BLEU and ρ scores of our previous WSD+SMT system for the three clustering methods, initialized with vectors either from the WordNet definitions or from examples, for two language pairs. We also provide BLEU scores of baseline systems and of oracle ones, i.e. using correct senses as factors. The best method is k-means and the best initialization is with the vectors of definitions. All values of ρ show improvements over the baseline, with up to 4% for k-means on DE/EN. Moreover, we found that random initializations under-perform with respect to definitions or examples. For a fair comparison, we set the number of clusters equal either to the number of synsets with definitions or with examples, for each word type, and obtained BLEU scores on EN/ZH of 15.34 and 15.27 respectively -hence lower than 15.54 and 15.41 in Table 2. We investigated earlier (Pu et al., 2017) the effect of the context window surrounding each ambiguous token, and found with the WSD+SMT factored system on EN/ZH WIT 3 data that the optimal size was 8, which we use here as well. Table 3 shows our WSD results in terms of Vscore and F 1 -score, comparing our methods (six lines at the bottom) with other significant systems that participated in the SemEval 2010 shared task . 15 The adaptive k-means initialized with definitions has the highest average score (35.20) and ranks among the top systems for most of the metrics individually. Moreover, the adaptive k-means method finds on average 4.5 senses per word type, which is very close to the ground-truth value of 4.46. Overall, we observed   Table 3: WSD results from three SemEval 2010 systems and our six systems, in terms of V -score, F 1 score and their average. 'C' is the average number of clusters. The adaptive k-means using definitions outperforms the others on the average of V and F 1 , when considering both nouns and verbs, or nouns only. The SemEval systems are UoY (Korkontzelos and Manandhar, 2010); KCDC-GD (Kern et al., 2010); and Duluth-Mix-Gap (Pedersen, 2010).

Best WSD Method Based on V/F1 Scores
that k-means infers fewer senses per word type than WordNet. These results show that k-means WSD is effective and provides competitive performance against other weakly supervised alternatives (CRP or Random Walk) and even against Se-mEval WSD methods, but using additional knowledge not available to SemEval participants.

Selection of WSD+NMT Model
To compare several options of the WSD+NMT systems, we trained and tested them on a subset of EN/FR Europarl (a smaller dataset shortened the training times). The results are shown in Table 4. For the AVG model, the logistic normalization in Eq. 6 works better than the linear one. For the ATT model, we compared two different labeling approaches for tokens which do not have multiple senses: either use the same NULL label for all tokens, or use the word itself as a label for its sense; the second option appeared to be the best. Finally, for the ATT ini model, we compared the two options for the attention function in Eq. 8, and found that the formula with tanh is the best. In what follows, we use these settings for the AVG and ATT systems.

Results
We first evaluate our sense-aware models with smaller data sets (ca. 500k lines) for five language pairs with English as source. We evaluate them through both automatic measures and human assessment. Later on, we evaluate our sense-aware NMT models with larger WMT data sets to enable a better comparison with other related approaches. BLEU scores. Table 5 displays the performance of both sense-aware phrase-based and neural MT systems with the training sets of 500k lines listed in Table 1 on five language pairs. Specifically, we compare several approaches which integrate word sense information in SMT and NMT. The best hyper-parameters are those found above, for each of the WSD+NMT combination strategies, in particular the k-means  Table 5: BLEU scores of our sense-aware NMT systems over five language pairs: ATT ini is the best one among SMT and NMT systems. Significance testing is indicated by † for p < 0.05 and ‡ for p < 0.01. method for WSD+SMT, and the ATT ini method for WSD+NMT, i.e. the attention-based model of senses initialized with the output of k-means clustering.
Comparisons with baselines. Table 5 shows that our WSD+NMT systems perform consistently better than the baselines, with the largest improvements achieved by NMT on EN/FR and EN/ES. The neural systems outperform the phrase-based statistical ones (Pu et al., 2017), which are shown for comparison in the upper part of the table.
We compare our proposal to the recent system proposed by Yang et al. (2017), on the 500k-line EN/FR Europarl dataset (the differences between their system and ours are listed in Section 7). We carefully implemented their model by following their paper, since their code is not available. Using the sense embeddings of the multi-sense skipgram model (MSSG) (Neelakantan et al., 2014) as they do, and training for 6 epochs as in their study, our implementation of their model reaches only 31.05 BLEU points. When increasing the training stage until convergence (15 epochs), the best BLEU score is 34.52, which is still below our NMT baseline of 34.60. We also found that the initialization of embeddings with MSSG brings less than 1 BLEU point improvement with respect to random initializations (which scored 30.11 over 6 epochs and 33.77 until convergence), while Yang et al. found a 1.3-2.7 increase on two different test sets. In order to better understand the difference, we tried several combinations of their model with ours. We obtain a BLEU score of 35.02 by replacing their MSSG sense specification model with our adaptive k-means approach, and a BLEU score of 35.18 by replacing our context calculation method (averaging word embeddings within one sentence) with their context vector generation method, which is computed from the output of a bi-directional RNN. In the end, the best BLEU score on this EN/FR data set (35.78 as shown in Table 5, column 1, last line) is reached by our system with its best options.
Lexical choice. Using word alignment, we assess the improvement brought by our systems with respect to the baseline in terms of the number of words -here, WSD-labeled nouns and verbs -that are translated exactly as in the reference translation (modulo alignment errors). These numbers can be arranged in a confusion matrix with four values: the words translated correctly (i.e., as in the reference) by both systems, those translated correctly by one system but incorrectly by the other one, and vice-versa, and those translated incorrectly by both. Table 6 shows the confusion matrix for our sense-aware NMT with the ATT ini model versus the NMT baseline over the Europarl test data. The net improvement, i.e. the fraction of words improved by our system minus those degraded, 16 appears to be +2.5% for EN/FR and +3.6% for EN/ES. For comparison, we show the results of the WSD+SMT system versus the SMT baseline in the lower part of Table 6: the improvement is smaller, at +1.4% for EN/FR and +1.5% for EN/ES. Therefore, the ATT ini NMT model brings higher benefits over the NMT baseline than the WSD+SMT factored model, although the NMT baseline is stronger than the SMT one (see Table 5).
Human assessment. To compare our systems against baselines we also consider a human evaluation of the translation of words with multiple senses (nouns or verbs). The goal is to capture more precisely the correct translations that are, Correct Incorrect Correct Incorrect WSD+ C. 134,552 17,145 146,806 16,523 NMT I. 10,551 101,228 8,183 58,387 WSD+ C. 124,759 13,408 139,800 11,194 SMT I. 9,676 115,633 7,559 71,346   however, different from the reference. Given the cost of the procedure, one evaluator with good knowledge of EN and FR rated the translations of four word types that appear frequently in the test set and have multiple possible senses and translations into French. These words are: 'deal' (101 tokens), 'face' (84), 'mark' (20), and 'subject' (58). Two translations of 'deal' are exemplified in Section 1.
For each occurrence, the evaluator sees the source sentence, the reference translation, and the outputs of the NMT baseline and the ATT ini in random order, so that the system cannot be identified. The two translations of the considered word are rated as good, acceptable, or wrong. We submit only cases in which the two translations differ, to minimize the annotation effort with no impact on the comparison between systems.
Firstly, Figure 1 (a) shows that ATT ini has a higher proportion of good translations, and a lower proportion of wrong ones, for all four words. The largest difference is for 'subject', where ATT ini has 75% good translations and the baseline only 46%; moreover, the baseline has 22% errors and ATT ini has only 9%. Secondly, Figure 1 (b) shows the proportions of tokens, for each type, for which ATT ini was respectively better, equal, or worse than the baseline. Again, for each of the four words, there are far more improvements brought by ATT ini than degradations. On average, 40% of the occurrences are improved and only 10% are degraded.
Results on WMT datasets. To demonstrate that our findings generalize to larger datasets, we report results on three datasets provided by the WMT conference (see Section 4), namely for EN/DE, EN/ES and EN/FR. Tables 7 and 8 show the results of our proposed NMT models on these test sets. The results in Table 7 confirm that our sense-aware NMT models improve significantly the translation quality also on larger datasets, which permit stronger baselines. Comparing these results to the ones from Table 5, we even conclude that our models trained on larger, mixed-domain datasets achieve higher improvements than the models trained on smaller, domainspecific datasets (Europarl). This clearly shows that our sense-aware NMT models are beneficial on both narrow and broad domains.
Finally, we compare our model to several recent NMT models which make use of contextual information, thus sharing a similar overall goal to our study. Indeed, the model proposed by Choi et al. (2017) attempts to improve NMT by integrating context vectors associated to source words into the generation process during decoding. The model proposed by Zhang et al. (2017) is aware of previous attended words on the source side in order to better predict which words will be attended in future. The self-attentive residual decoder designed by Werlen et al. (2018) leverages the contextual information from previously translated words on the target side. BLEU scores on the English-German pair shown in Table 8 demonstrate that our baseline is strong and that our model is competitive with respect to recent models that leverage contextual information in different ways.

Related Work
Word sense disambiguation aims to identify the sense of a word appearing in a given context (Agirre and Edmonds, 2007). Resolving word sense ambiguities should be useful, in particular, for lexical choice in MT. An initial investigation found that a statistical MT system which makes   use of off-the-shelf WSD does not yield significantly better quality translations than a SMT system not using it (Carpuat and Wu, 2005). However, several studies (Vickrey et al., 2005;Cabezas and Resnik, 2005;Chan et al., 2007;Carpuat and Wu, 2007) reformulated the task of WSD for SMT and showed that integrating the ambiguity information generated from modified WSD improved SMT by 0.15-0.57 BLEU points compared to baselines.
Recently, Tang et al. (2016) used only the supersenses from WordNet (coarse-grained semantic labels) for automatic WSD, using maximum entropy classification or sense embeddings learned using word2vec. When combining WSD with SMT using a factored model, Tang et al. improved BLEU scores by 0.7 points on average, though with large differences between their three test subsets (IT Q&A pairs).
Although the above-mentioned reformulations of the WSD task proved helpful for SMT, they did not determine whether actual source-side senses are helpful or not for end-to-end SMT. Xiong and Zhang (2014) attempted to answer this question by performing self-learned word sense induction instead of using pre-specified word senses as traditional WSD does. However, they created the risk of discovering sense clusters which do not correspond to the senses of words actually needed for MT. Hence, they left open an important question, namely whether WSD based on semantic resources such as WordNet (Fellbaum, 1998) can be successfully integrated with SMT.
Several studies integrated sense information as features to SMT, either obtained from the sense graph provided by WordNet (Neale et al., 2016) or generated from both sides of word dependencies (Su et al., 2015). However, apart from the sense graph, WordNet provides also textual information such as sense definitions and examples, which should be useful for WSD, but were not used in the above studies. In previous work (Pu et al., 2017), we used this information to perform sense induction on source-side data using k-means and demonstrated improvement with factored phrasebased SMT but not NMT. Neural MT became the state of the art (Sutskever et al., 2014;Bahdanau et al., 2015). Instead of working directly at the discrete symbol level as SMT, it projects and manipulates the source sequence of discrete symbols in a continuous vector space. However, NMT generates only one embedding for each word type, regardless of its possibly different senses, as analyzed e.g. by Hill et al. (2017). Several studies proposed efficient non-parametric models for monolingual word sense representation (Neelakantan et al., 2014;Li and Jurafsky, 2015;Bartunov et al., 2016;Liu et al., 2017), but left open the question whether sense representations can help neural MT by reducing word ambiguity. Recent studies integrate the additional sense assignment with neural MT based on these approaches, either by adding such sense assignments as additional features (Rios et al., 2017) or by merging the context information on both sides of parallel data for encoding and decoding (Choi et al., 2017). Yang et al. (2017) recently proposed to add sense information by using weighted sense embeddings as input to neural MT. The sense labels were generated by a multi-sense skip-gram model (MSSG) (Neelakantan et al., 2014), and the context vector used for sense weight generation was computed from the output of a bi-directional RNN. Finally, the weighted average sense embeddings were used in place of the word embedding for the NMT encoder. The numerical results given in Section 6 above show that our options for using sense embeddings outperform Yang et al.'s proposal. In fact, their approach even performed below the NMT baseline on our EN/FR dataset. We conclude that adaptive k-means clustering is better than MSSG for use in NMT, and that concatenating the word embedding and its sense vector as input for the RNN encoder is better than just using the sense embedding for each token. In terms of efficiency, Yang et al. (2017) need an additional bidirectional RNN to generate the context vector for each input token, while we compute the context vector by averaging the embeddings of the neighboring tokens. This slows down the training of the encoder by a factor of 3, which may explain why they only trained their model for 6 epochs.

Conclusion
We presented a neural MT system enhanced with an attention-based method to represent multiple word senses, making use of a larger context to disambiguate words that have various possible translations. We proposed several adaptive contextdependent clustering algorithms for WSD and combined them in several ways with NMT -following our earlier experiments with SMT (Pu et al., 2017) -and found that they had competitive WSD performance on data from the SemEval 2010 shared task. For NMT, the best performing method used the output of k-means to initialize the sense embeddings that are learned by our system. In particular, it appeared that learning sense embeddings for NMT is better than using embeddings learned separately by other methods, although such embeddings may be useful for initialization. Our experiments with five language pairs showed that our sense-aware NMT systems consistently improve over strong NMT baselines, and that they specifically improve the translation of words with multiple senses.
In the future, our approach to sense-aware NMT could be extended to other NMT architectures such as the Transformer network proposed by Vaswani et al. (2017). As was the case with the LSTM-based architecture studied here, the Transformer network does not explicitly model or utilize the sense information of words, and, therefore, we hypothesize that its performance could also be improved by using our sense integration approaches. To encourage further research in sense-aware NMT, our code is made available at https://github.com/idiap/ sense_aware_NMT.