Full text
Document-Level Machine Translation Ensuring Translational Consistency of Non-Local Phenomena This dissertation has been submitted to the Computer Science Department (CS) at Universitat Politècnica de Catalunya (UPC) in partial fulfilment of the requirements of the Artificial Intelligence Ph.D. programme for the degree of Doctor of Philosophy by Eva Martínez Garcia with advisors Cristina España-Bonet Lluís Màrquez Villodre Barcelona, September 10, 2019
Abstract In this thesis, we study the automatic translation of documents by taking into account cross-sentence phenomena. This document-level information is typically ignored by most of the standard state-of-the-art Machine Translation (MT) systems, which focus on translating texts processing each of their sentences in isolation. Translating each sentence without looking at its surrounding context can lead to certain types of translation errors, such as inconsistent translations for the same word or for elements in a coreference chain. We introduce methods to attend to document-level phenomena in order to avoid those errors, and thus, reach translations that properly convey the original meaning. Our research starts by identifying the translation errors related to such documentlevel phenomena that commonly appear in the output of state-of-the-art Statistical Machine Translation (SMT) systems. For two of those errors, namely inconsistent word translations as well as gender and number disagreements among words, we design simple and yet effective post-processing techniques to tackle and correct them. Since these techniques are applied a posteriori, they can access the whole source and target documents, and hence, they are able to perform a global analysis and improve the coherence and consistency of the translation. Nevertheless, since following such a two-pass decoding strategy is not optimal in terms of efficiency, we also focus on introducing the context-awareness during the decoding process itself. To this end, we enhance a document-oriented SMT system with distributional semantic information in the form of bilingual and monolingual word embeddings. In particular, these embeddings are used as Semantic Space Language Models (SSLMs) and as a novel feature function. The goal of the former is to promote word translations that are semantically close to their preceding context, whereas the latter promotes the lexical choice that is closest to its surrounding context, for those words that have varying translations throughout the document. In both cases, the context extends beyond sentence boundaries. Recently, the MT community has transitioned to the neural paradigm. The final step of our research proposes an extension of the decoding process for a Neural Machine Translation (NMT) framework, independent of the model architecture, by shallow fusing the information from a neural translation model and the context semantics enclosed in the previously studied SSLMs. The aim of this modification is to introduce the benefits of context information also into the decoding process of NMT systems, as well as to obtain an additional validation for the techniques we explored. The automatic evaluation of our approaches does not reflect significant variations. This is expected since most automatic metrics are neither context- nor semanticaware and because the phenomena we tackle are rare, leading to few modifications with respect to the baseline translations. On the other hand, manual evaluations demonstrate the positive impact of our approaches since human evaluators tend to prefer the translations produced by our document-aware systems. Therefore, the changes introduced by our enhanced systems are important since they are related to how humans perceive translation quality for long texts.
Acknowledgments1 One of the most important things that I have learned in the long journey of this thesis is that you can make a good work alone but it will be better if you work in a team. Primer de tot, vull agraïr als meus tutors Cristina España i Lluís Màrquez per tota la seva (santa) paciència durant tot aquest procés. Agraïr-vos totes les coses que m’heu donat l’oportunitat d’apendre. Al cap i a la fi el meu camí a MT va començar amb vosaltres. També vos heu convertit en un referent de com ser un bon professional, un bon “researcher”. M’heu ensenyat com treballar amb gust pel que es fa, com donarli la volta a un resultat dolent per aprendre i continuar treballant; sobretot això, com continuar treballant tot i que les circumstàncies no siguen les millors. El Lluís m’ha ensenyat com mai s’està massa ocupat per a no dedicar atenció a les coses importants, a saber distingir entre lo important i lo urgent, a no tindre por a preguntar i a no perdre mai la curiositat. La Cristina m’ha ensenyat que sempre es pot fer més, que sempre es pot treballar més i millor, que la constància n’és la clau per arribar a la meta. Menció especial té el Lluís Padró, per ser el nostre “flawless” infiltrat a la UPC. Moltes gràcies per tenir sempre la millor de les disposicions per ajudar-nos, sempre a punt per trobar sol·lucions. I would like to thank Joakim Nivre, Jörg Tiedemann, and Christian Hardmeier, who welcomed me at Uppsala Universitet back in 2013. Thanks for having me there, thanks for showing me other ways of making things, thanks for letting me learn from you. A great part of this thesis work began from the ideas I got during my research stay, it was a very productive experience for me. I would like to specially thank Christian for his infinite patience with the installation of Docent, and for being there for me as a valuable contact during the years. Also from this Swedish journey, I had the chance to meet very lovely and welcoming people. Thanks to Marie, Mojgan, Ali, Eva, Mats, Vera. My heart will always have a Swedish part because of you. Tack! També volia agraïr al grup TALP de la UPC per tindre’m. Tot i que ara estiguem dispersos, sempre pense en vosaltres com el meu grup madriu: Meritxell, Jesús, Maria, Pere, Xavi Lluís, Edgar, Danielle, Audi, Pranava, Ali, Horacio. Sou gent molt maca i fàcil de trobar a faltar. Tot i que el seu treball es queda sempre en un segon pla, també volia agraïr al personal de la secretaria del departament de LSI/CS per tot el suport durant la meva vinculació amb la UPC. Especialment a la Mercè Juan, perquè fa miracles burocràtics, fent senzill lo que sembla impossible i estant sempre de bon humor. Mientras estuve en la UPC, también tuve la suerte de trabajar con el grupo IXA de la UPV/EHU: Kepa, Iñaki Alegría, Iñaki San Vicente, Nora, Mikel, Gorka. Con 1This work has been partially supported by an FPI 2010 grant from the Spanish Ministry of Science and Innovation (MICINN) within the OpenMT-2 project (ref. TIN2009-14675-C03-03, http://ixa.si.ehu.es/openmt2/en/index.html) of MICINN, a mobility EEBB 2013 grant from the Spanish Ministry of Economy and Competitiveness (MINECO) for a stay at the Department of Linguistics and Philology at the Uppsala University, and by the TACARDI project (ref. TIN2012- 38523-C02-02, http://ixa.si.ehu.es/tacardi/en/index.html) of the MINECO.
algunos de vosotros compartí mi primera sagardotegi o mi primer congreso internacional, y eso son cosas que no se olvidan. Eskerrik asko denoi! Los últimos tres años de este viaje los he pasado en San Sebastián. Mila esker Arantza por toda tu ayuda en la revisión del draft de esta tesis. Also, to the ELRI consortium (Helen, Jane, Andy, Teresa, Gary, Victoria, Hervé, Rui, Maite), thanks for letting me grow as professional and to believe in my skills again. En este periodo también tuve la suerte de colaborar con Christian Blum para la aplicación del ACO a MT. Muchas gracias por tu tiempo y tu buena disposición, Christian, fue un verdadero placer poder trabajar contigo. Durante estos años he podido trabajar desde distintos sitios: 8 mudanzas, 5 ciudades y mucha gente involucrada en el éxito de este trabajo. Els meus companys de màster i de fatigues “tesils”: el Gabo i l’Àtia. Els companys de despatx de l’Omega: Jorge, Nikita, Àlex, Alberto, (Gran) Javier, Xuri, Dani, Sergi, Alessandra, Josep Lluís, Lucas, Eve, Albert, MaÀngels, Lander, Jesús, Adrià, Guillem. Gràcies per compartir els “pastissos allibera estrés”. Especialmente a Carles. Estuviste en este proceso desde el principio, y con paciencia infinita me has acompañado hasta el final. Gracias por todo, todo y todo. En el sector vasco, mila esker a Haritz i Cristina per aguantar els baixons i els subidons i per compartir les nits de guacamole. Montse, moltes gràcies per tot, pels ànims i per alegrar els dies. También a Andoni, por recordarme que es importante saber lo que quiero y a veces aún más lo que no quiero, y enseñarme la parte más amable del País Vasco. Al sector en la distancia, que no sois pocos. Teresa, Álex, Montse i Aleix, mis chicas de italiano, gracias por llenar mis días en Barcelona de un color especial. Javi, Sandra y Javi, el pequeño reducto castellonense que hace más dulce la vuelta a casa. Marina, Manu, sé que los dos desde Madrid habéis estado pendientes de cómo se desarrollaba esta aventura, gracias por estar ahí. Los informates (Ester, Marta, Jorge, Javi V., Javi A., Gerardo, Miguel Ángel, Luis, Jaime) me habéis visto crecer y, aunque desde lejos, me habéis acompañado a lo largo de todo este camino. Gracias por ser. Finalmente, una de las partes más importantes de este trabajo, la familia. Sin esa red de seguridad no podría haber llegado hasta donde estoy hoy. Mamá, Rubén, aunque no hayáis participado en el trabajo técnico sí que habéis sufrido y compartido todos los momentos de estrés, el estar lejos, las prisas para entregar un artículo, la frustración porque algo no funciona. Sin vuestro apoyo y cariño incondicional esto no habría sido posible, esta tesis está dedicada a vosotros por ser la parte infalible de mi vida. Aquesta tesi és tota vostra. This thesis is all yours. Tesi hau guztia zuena da. Esta tesis es toda vuestra.
Contents 1 Introduction 7 1.1 Motivation ................................. 7 1.2 Context ................................... 9 1.3 ResearchGoals ............................... 9 1.4 MainContributions............................. 10 1.5 Outline ................................... 11 2 State of the Art 13 2.1 Machine Translation Background . . . . . . . . . . . . . . . . . . . . . 13 2.1.1 Statistical Machine Translation . . . . . . . . . . . . . . . . . . 14 2.1.2 Neural Machine Translation . . . . . . . . . . . . . . . . . . . . 16 2.2 Document-Level Machine Translation . . . . . . . . . . . . . . . . . . 20 2.2.1 Document-Level Statistical Machine Translation . . . . . . . . 21 2.2.2 Docent and Lehrer . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.2.3 Decoding with Ants . . . . . . . . . . . . . . . . . . . . . . . . 24 2.2.4 Document-Level Neural Machine Translation . . . . . . . . . . 26 2.3 Automatic Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.3.1 Automatic Evaluation Metrics . . . . . . . . . . . . . . . . . . 28 3 Towards Document-Level Machine Translation 31 3.1 Document-Level Phenomena . . . . . . . . . . . . . . . . . . . . . . . . 31 3.2 Post-Process Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2.1 Lexical Consistency . . . . . . . . . . . . . . . . . . . . . . . . 35 3.2.2 Coreference and Agreement . . . . . . . . . . . . . . . . . . . . 36 3.2.3 Experiments ............................ 37 3.3 Conclusions................................. 42 4 Word Embeddings in Machine Translation 45 4.1 Semantic Models Using word2vec . . . . . . . . . . . . . . . . . . . . . 46 4.2 Accuracy of the Semantic Model . . . . . . . . . . . . . . . . . . . . . 46 4.2.1 Results ............................... 47 4.3 Cross-Lingual Lexical Substitution Task . . . . . . . . . . . . . . . . . 48 4.3.1 Settings............................... 49 4.3.2 Results ............................... 49 4.4 Translation Task with Semantic Space Language Models . . . . . . . . 50
4.4.1 Settings............................... 51 4.4.2 Results ............................... 54 4.5 Conclusions................................. 56 5 Lexical Consistency in Statistical Machine Translation 57 5.1 Approach .................................. 57 5.2 Semantic Space Lexical Consistency Feature . . . . . . . . . . . . . . . 59 5.3 Lexical Consistency Change Operation . . . . . . . . . . . . . . . . . . 61 5.4 Experiments................................. 62 5.4.1 Automatic Evaluation . . . . . . . . . . . . . . . . . . . . . . . 64 5.4.2 Human Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . 66 5.5 Conclusions................................. 68 6 Document-Aware Neural Machine Translation Decoding 69 6.1 Fusion of an NMT System and an SSLM . . . . . . . . . . . . . . . . . 70 6.1.1 Deep, Shallow, Cold, and Simple Fusion . . . . . . . . . . . . . 70 6.1.2 Shallow Fusion of an NMT System and an SSLM . . . . . . . . 74 6.2 Experiments................................. 75 6.2.1 Settings............................... 75 6.2.2 Analysis with Oracles . . . . . . . . . . . . . . . . . . . . . . . 76 6.2.3 Results ............................... 78 6.3 Conclusions................................. 80 7 Conclusions 83 7.1 FutureWork ................................ 84 Bibliography 87 A Decoding with Ants 105 A.1 DecodingMethod.............................. 105 A.1.1 Detailed Steps of ACODec . . . . . . . . . . . . . . . . . . . . 109 A.1.2 Detailed Steps of ACODecmono indep and ACODecmono share ........ 111 A.2 TimeComplexity.............................. 113 A.3 Experiments................................. 114
List of Figures 2.1 VauquoisTriangle ............................. 14 2.2 Structure of an SMT system . . . . . . . . . . . . . . . . . . . . . . . . 16 2.3 Encoder-Decoder NMT system with Attention mechanism . . . . . . . 17 2.4 Attention mechanism functionality . . . . . . . . . . . . . . . . . . . . 18 2.5 Sketch of Docent’s search space and path through it . . . . . . . . . 23 2.6 Example of decoding a sentence with ACO . . . . . . . . . . . . . . . 25 4.1 MERT evolution on Lehrer without document-level features . . . . . 53 4.2 MERT evolution on Moses ........................ 53 4.3 MERT evolution on Lehrer withSSLM................. 54 5.1 Example of differing translations for several occurrences of “desk” . . . 58 5.2 Sketch of the behaviour of LCCO . . . . . . . . . . . . . . . . . . . . . 61 5.3 MERT evolution on Lehrer with SSLM and SSLC . . . . . . . . . . 64 5.4 Translation example with (in)consistent lexical choices . . . . . . . . . 68 6.1 Sketch of the deep fusion approach . . . . . . . . . . . . . . . . . . . . 71 6.2 Sketch of the shallow fusion approach . . . . . . . . . . . . . . . . . . 72 6.3 Sketch of the shallow fusion of SSLM and NMT . . . . . . . . . . . . . 75 6.4 BLEU score of the oracles . . . . . . . . . . . . . . . . . . . . . . . . . 77 6.5 BLEU score of the fused system . . . . . . . . . . . . . . . . . . . . . . 79 A.1 Example of decoding a sentence with ACO . . . . . . . . . . . . . . . 107 A.2 Example of an ant creating a hole in the translation and refilling it . . 112 A.3 Plot of normalized scores per sentence . . . . . . . . . . . . . . . . . . 116 A.4 Plot of normalized scores per aggregated document . . . . . . . . . . . 116 A.5 Critical difference plots with sentences and aggregated documents . . . 116 A.6 Plot of normalized scores per document . . . . . . . . . . . . . . . . . 118 A.7 Critical difference plot with documents . . . . . . . . . . . . . . . . . . 118 A.8 Score evolution with Lehrer ....................... 120 A.9 Score evolution with ACODec, ACODecmono indep, and ACODecmono share . . . . 121
10 Chapter 1. Introduction cohesion to documents and are susceptible to be lost in the MT process. Before exploring ways to solve such mistakes as part of the MT process, it is interesting to implement a set of simple post-processing techniques and evaluate their impact. 2. Capturing the semantic information of a document in a useful manner to aid the MT decoding process. Undeniably, leveraging a document’s semantic context should help improve the coherence and cohesion levels of its translation. Thus, it is necessary to explore ways to introduce contextual semantic information into the MT process. In particular, our final intention is to extend a documentoriented decoder to incorporate document context semantics. 3. Enhancing an NMT framework using context-aware techniques. To finalize the work of this thesis, one of our goals is to integrate the explored ideas into the NMT paradigm. 1.4 Main Contributions The main contributions of this thesis are directly related to the research goals described in the previous section. Our work has resulted in several published works, mainly as conference papers. In fact, much of the content of this thesis is an update or extension of the published papers. Our set of contributions and related publications is as follows: •Analysis of translation errors related to document-level phenomena and the development of a set of simple, yet effective, post-processing techniques to handle them. Since the particular document-level phenomena they handle are sparse, we need a manual evaluation to assess their effectiveness because the automatic evaluation metrics do not capture their improvements. These findings were published as a technical report (Martínez Garcia et al., 2014b) and presented in the SEPLN2014 conference (Martínez Garcia et al., 2014a). •Demonstrating that bilingual word embeddings are capable of modeling semantic relations that help the SMT process. We observe that the quality of the translation and alignments previous to building the semantic models are crucial for the final performance of the embeddings. Word embeddings prove to be helpful in the task of lexical substitution for words that are ambiguously translated within a document. This work resulted in a publication in the SSST-8 conference (Martínez Garcia et al., 2014c). •Showing that the introduction of bilingual word embeddings guides documentoriented SMT decoders towards more coherent and cohesive translations. Although we only observe a slight improvement in the results of automatic evaluation metrics, the improvement is consistent among metrics and is larger as we introduce more semantic information into the system, getting the best results when using the models with bilingual information. This approach was presented in the EAMT2015 conference (Martínez Garcia et al., 2015).
1.5. Outline 11 •Designing new strategies that guide document-oriented decoders through the translation search space towards more consistent, coherent, and cohesive translations, focusing primarily on maintaining lexical consistency. Our strategies based on word embeddings aid the decoder to assess the compatibility of the possible translations for ambiguous words with their context. This extension led to participating in the EAMT2017 conference (Martínez Garcia et al., 2017). •Enhancing the NMT decoding algorithm to include contextual semantics captured by a language model based on word embeddings. Our experiments show how the semantic language models can help NMT systems to produce better translations. Our approach does not need to modify the training process, so we do not increase the training time, or document-level annotated data. This work is under review for publication at the time of submission of this thesis. 1.5 Outline The remainder of the thesis is organized as follows. In order to contextualize our research, Chapter 2 revisits the state-of-the-art of the MT research area, focusing on the main technologies of the SMT and NMT paradigms, both at sentence and document level. Chapters 3 to 6 present the results of our research. In Chapter 3, we analyze some of the translation errors related to document-level phenomena (Section 3.1) and present a set of post-processing strategies to handle them (Section 3.2). Afterwards, in Chapter 4, we describe how to introduce word embeddings for decoding. First, we study the applicability of word embeddings to enhance the MT process in general (Sections 4.1 to 4.3). Then, we explain a method to enhance a document-oriented SMT decoder with word embeddings working as Semantic Space Language Models (Section 4.4). Next, Chapter 5 describes our extension of a document-oriented SMT decoder to handle the particular document-level phenomenon of lexical choice consistency for a translation. We present a new feature function that guides the decoder towards more lexically consistent translation candidates (Section 5.2), as well as a new strategy to shortcut the exploration of the search space (Section 5.3). Chapter 6 presents our approach to extend the usual NMT decoding process to take into account contextual semantics. In particular, we extend the beam search decoding algorithm by fusing the discourse information captured by the models we describe in Chapter 4 to work in tandem with the NMT model. Finally, Chapter 7 draws the conclusions of the work of this thesis and describes possible avenues of future work. Additionally, Appendix A describes a new document-level decoding strategy based on a swarm optimization algorithm, integrated into the decoder used in Section 4.4 and Chapter 5 as an alternative to its default hill climbing strategy.
Chapter 2 State of the Art 2.1 Machine Translation Background Machine Translation is one of the earliest problems in Natural Language Processing and Artificial Intelligence. The origins of MT as a field itself can be dated in the late 1940s, with the end of World War II and the birth of the first electronic computers in the United States. In the 1950s, the original MT systems were very simple but obtained promising results. However, after the initial euphoria, there was an increasing acknowledgment of the linguistic difficulties involved that produced a lack of productivity in the area during the 1960s. This discouraging atmosphere ended up with the Automatic Language Processing Advisory Committee (ALPAC) report in 1966 (Pierce and Carroll, 1966). In such document, MT was qualified as useless and stated as a slower and more expensive procedure than human translation. Therefore, there was a recommendation not to invest in MT but to do it in other more basic NLP tasks instead. It was not until the late 1980s, with the rise of more powerful and faster computers, that the MT field emerged again. Statistical approaches appeared in the 1990s becoming the most successful MT systems until the rise of neural architectures in 2015. MT approaches can be classified according to different criteria. According to their usage, there are systems designed for machine-aided translation, both for human translation with machine support and for machine translation with human support. On the other hand, there are fully automated translation systems, which typically prioritize speed over quality. Regarding the level of linguistic analysis performed, MT systems can be classified in direct,transfer, and interlingua. The Vauquois triangle of Figure 2.1 shows this classification. The direct approach performs a word-by-word or phrase-by-phrase translation. The transfer approach makes a syntactic and/or semantic analysis of the input to build an abstract representation of the source. This abstract representation is then transferred to the abstract representation of the target language, from which the output is generated. The interlingua approach is similar to the transfer approach 13
14 Chapter 2. State of the Art input output interlingua transfer direct analysis generation Figure 2.1: The Vauquois Triangle for the classification of MT systems according to the level of linguistic analysis. but using a single abstract representation common to all languages. According to the architecture of the system, we can distinguish between rulebased systems and empirical systems.Rule-based systems (RBMT) use a set of rules to describe the translation process. Typically, these rules are established by a group of human experts and drive the translation process. Although these systems obtain high quality syntactics of the translated output, the process followed is generally slow, expensive, not portable, and language dependent. RBMT systems are usually characterized also by a linguistic transfer process from a syntactic or semantic analysis. On the other hand, empirical systems are data driven. They get knowledge automatically, typically from a sentence-aligned parallel corpus. Although it is not a common procedure, these systems can also include some linguistic analysis too. Since these systems learn automatically from data, there is no need for human interaction at least at translation time. Example-based Machine Translation (EBMT), Statistical Machine Translation (SMT), and Neural Machine Translation (NMT) systems are all empirical systems. Briefly, the EBMT systems build new translations using translations compiled previously as a basis. SMT systems consider that each sentence of the target language is a possible translation of a sentence in the source language and assign a probability to each of them. NMT systems use artificial neural networks to predict the likelihood of a sequence of words in the target language given a sequence of words in the source language. 2.1.1 Statistical Machine Translation SMT systems assign a probability to every possible translation for each sentence and choose the final translation by finding the one that maximizes this probability. Formally, SMT systems estimate the probability of a target sentence y= (y1, . . . , yN) being the translation of a source sentence x= (x1, . . . , xM), and find the best translation ˆyby selecting the target sequence that maximizes such probability (Brown et al., 1990): ˆy= arg max y p(y|x)
2.1. Machine Translation Background 15 Making an analogy with the noisy channel model (Shannon, 1948), that posterior probability is rewritten with the Bayes’ rule into: ˆy= arg max y p(x|y)p(y) having already removed the divisor p(x)as it does not affect the result of arg max. In this reformulation, p(x|y)is the reverse translation probabilistic model. In other words, it represents the probability of seeing the sequence xof source words as the translation of the sequence yof target words. Also, the factor p(y)represents a Language Model (LM) that estimates the probability of seeing the sequence of words yin the target language. This objective probability can be decomposed using a loglinear model: log p(y|x)∝log p(x|y)p(y) = log p(x|y) + log p(y) and re-written in a more general way as the sum of different feature functions fithat represent probabilistic models that capture different linguistic aspects: log p(y|x) = X i wifi(x, y) + C The probabilistic models fiare trained on large parallel or monolingual corpora, depending on the feature characteristics. In turn, the weight parameters wiare tuned on smaller parallel development sets using standard generic algorithms to that end, such as MERT (Och, 2003), PRO (Hopkins and May, 2011), or adaptations of MIRA (Crammer et al., 2006) for SMT (Chiang et al., 2008; Watanabe et al., 2007). These probabilistic models can be applied at different translation unit levels: word, phrase, or even sentence. The basic structure of a phrase-based SMT system (Koehn et al., 2003) is shown in Figure 2.2. First, there is a pre-processing step where the source text is normalized and tokenized. Then, there is a process of phrase extraction from the parallel corpus used to train the system. In this stage, the source language phrases are aligned with their corresponding target language ones. From these alignments, a probabilistic translation model is built capturing the information about the most probable translations of a given source phrase. Each of these translation pairs is assigned a probability, estimated by frequency counts in the training corpus. In a similar way, a stochastic language model is derived from a monolingual corpus to represent the information of the target language that must be present in a good translation output. Using that information, the decoder builds several possible translations from a source sentence and ranks them using a scoring function. This function can be defined using different language features depending on which characteristics to reinforce in the translation system. Finally, there could be a post-processing step where some translation errors can be fixed. The most commonly used decoding algorithm in phrase-based SMT is the beam search (Koehn et al., 2003). It constructs the translation of each sentence incrementally: it starts with an empty hypothesis and expands it iteratively with possible phrases, thus producing diverging hypotheses of varying quality. Since the amount of possible hypotheses grows exponentially as the sentence building advances, extensive
16 Chapter 2. State of the Art Pre-processing Post-processing Language Model Translation Model Word/Phrase Alignment Phrase Extraction Monolingual corpus Parallel corpus Target Language Text Source Language Text Decoding Pre-processing Pre-processing Figure 2.2: Structure of a state-of-the-art SMT system. pruning of the search space must be performed. To this end, two distinct techniques are applied. First, groups of similar hypotheses are merged in a recombination process like the one proposed by Och et al. (2001), which consists in discarding the hypothesis with the worst score from any pair of hypotheses that cannot be distinguished according to the language and translation models. In particular, indistinguishable hypotheses are essentially those that have translated the exact same part of the input sentence and their trailing translated words coincide. And second, only a handful of the hypotheses remaining after the recombination is retained for further expansion. In particular, those that seem most promising according to the score of the already constructed part and an estimated score for the remaining part. The set of hypotheses the algorithm works on conforms the beam, which is of a fixed size, usually small. 2.1.2 Neural Machine Translation Although SMT systems have shown several advantages, such as training speed and easy adaptation to new domains, with the pass of time their limitations have also been identified, such as the generation of local translations that do not model entire sentences. Neural Machine Translation arises from the comeback of deep learning methods
2.1. Machine Translation Background 17 embeddings BiLSTM BiLSTM x1 h1 embeddings BiLSTM BiLSTM x2 h2 embeddings BiLSTM BiLSTM xN hN Encoder Attention embeddings LSTM LSTM embeddings LSTM embeddings LSTM LSTM softmax softmax softmax y1y2yM c1 Decoder c2cM LSTM Figure 2.3: Encoder-Decoder NMT system with Attention mechanism. based on artificial neural networks (NN). Thus, NMT is based on developing neuralbased end-to-end translation systems. Some first attempts of pure NMT appeared in the late 1990s in Spain. Forcada and Ñeco (1997) proposed a recursive hetero-associative memory (RHAM) model that was able to learn general translations from examples. Also, Castaño and Casacuberta (1997) proposed an NN-based system with promising results. However, these approaches reported that the size of the neural networks required for the MT task, and thus also their training time, was excessive for the computation power available at that time. Modern pure NMT systems appear in the 2010s integrating word embeddings (Mikolov et al., 2013a,c) and neural language modeling techniques into MT systems. The first approaches tried to combine neural components with SMT approaches either in a chain (Schwenk et al., 2006) or introducing them as a new component of the MT systems (Devlin et al., 2014). End-to-end neural MT systems are designed from the “sequence-to-sequence” perspective. They are devised to be able to generate an output sequence from an input one. Sutskever et al. (2014), Cho et al. (2014a,b), and Bahdanau et al. (2015) proposed systems that implement a neural architecture based on two main components: the Encoder and the Decoder (see Figure 2.3). The Encoder projects a source sentence with variable length into a set of continuous vectors with a fixed length, and then, the Decoder takes this continuous representation to generate a target sentence. These systems are trained to maximize the conditional log-likelihood of the bilingual training corpus: max θ 1 N N X n=1 log pθ(yn|xn) where θis the set of the model parameters. For an encoder-decoder model the conditional probability of the next word is: yt= softmax DNN ~ HT M t, yt−1,~ Ct(2.1)
18 Chapter 2. State of the Art h1h2hN Ct a1t a2t aNt embeddings Ht-1 softmax Ht yt Decoder Encoder Attention The black cat eats fish El gato negro come pescado Figure 2.4: Attention mechanism functionality as described by Bahdanau et al. (2015). The example depicts the soft alignments handled by the NMT system on a particular sentence. where DNN represents the deep neural network that conforms the decoder, ~ HT M tis the hidden state from the decoder, and ~ Ctis the context vector from the encoder. The context vector is the encoder hidden state and represents a summary of the whole input sentence. Finally, the output is a softmax layer that draws a probability distribution over the target vocabulary. In these approaches, the encoder and the decoder are built using Recurrent Neural Networks (RNNs) (Bengio et al., 2013). These neural nets are designed specifically to deal with sequence problems. They are able to take into account the previously processed/generated context before generating the next step in a sequence. RNNs are mainly built using LSTM (Hochreiter and Schmidhuber, 1997) or GRU (Cho et al., 2014a) neural units. Both of these neuron types include gating mechanisms that allow the neurons to remember the information from the previous step with a certain probability. Introducing bidirectional networks in the NMT systems architecture shows a significant improvement. The NMT architecture by Bahdanau et al. (2015) includes a bidirectional encoder (BiEncoder) that projects the source sentence into a continuous vector by processing it from left to right but also from right to left, capturing in this way sentence context from both sides of sentence words. The main contribution to NMT systems was the introduction of the Attention Mechanism (Bahdanau et al., 2015). This module regularizes the output projection by learning soft alignments among the source sentence words and the generated target words. So, the system not only learns to translate, but it also learns a probability
2.1. Machine Translation Background 19 distribution of the alignments among the input and the output words. Figure 2.3 depicts the attentional encoder-decoder NMT architecture, and Figure 2.4 shows how the attention mechanism relates source and target words through a probability distribution. For these systems, the probability of the following predicted word in a sequence is calculated as described in Equation 2.1 but being ˆ Cta weighted sum of the annotations where the encoder maps the input sentence. In particular, the context vector is computed as follows: ˆ Ct= n X j=1 αtj~ hj with αtj being the weight: αtj =exp(etj) Pn k=1 exp(etk) where the soft-alignment weights etj reflect how well the inputs around position jand the output at position tmatch. They are computed by: etj =a(~ HT M t−1,~ hj) depending on the hidden state ~ HT M t−1previous to generating ytand on the jth annotation ~ hjof the input sentence. The alignment model ais a feed-forward neural network which is trained jointly with the rest of the components of the system. These attention weights then perform normalization on the output taking into account the alignment information among source and target words. Typically, in order to generate the target sentence, the NMT systems implement a beam search algorithm to explore the space of translation candidates and finally propose the sequence that maximizes the translation probability. The latest NMT systems propose the use of encoder-decoder implementations based on the Attention Mechanism (Vaswani et al., 2017). In particular, the Transformer architecture claims that attention is all you need to have a good MT system. The Transformer also follows the encoder-decoder architecture, but it does not include any recurrent or convolutional network. Instead, this approach implements a set of techniques that allow knowing the sequence. First, it employs positional embeddings to be aware of the position of the tokens in the sequence. Also, it includes position-wise feed-forward layers, that can be understood as two convolutions with a kernel of dimension 1. Finally, it implements multi-head self-attention layers. These layers allow attending to information that comes from different representation subspaces, acting as a set of attention layers working in parallel. The Transformer is the NMT architecture that achieves the best results across many language pairs nowadays, producing very fluent translations and reducing training times. However, it seems to be sensitive to parameter tuning and to require high usage of memory when translating (Popel and Bojar, 2018). Independently of their neural architecture, NMT systems cannot afford an open vocabulary translation, i.e., they can only perform translations managing a fixed source and target vocabularies. One of the most used approaches to solve this problem is sub-unit segmentation by Byte Pair Encoding (BPE). Sennrich et al. (2016) apply this encoding algorithm to segment infrequent words without taking into account
26 Chapter 2. State of the Art the highly parallelizable nature of ACO could be further exploited), but nevertheless, it is unlikely that we could get any significant asymptotic improvement. Appendix A presents a detailed description of the approach, together with a report on the conducted experiments and the obtained results. 2.2.4 Document-Level Neural Machine Translation NMT systems have proved their good performance in a short time, beating SMT systems broadly. However, they inherited the limitation of SMT systems of not being able to handle extra-sentence context information since they are typically designed to treat each sentence in an isolated and independent way. The interest in making NMT systems able to include wider context information in the translation process has increased in recent years (Jean et al., 2017; Popescu-Belis, 2019), exposing the necessity of exploring new approaches of document-level machine translation (Läubli et al., 2018). There are several approaches that tried to extend the context beyond the sentence information by modifying the system’s input. Tiedemann and Scherrer (2017) concatenate the previous source sentence to the current one, whereas Bawden et al. (2018) also concatenate the previous predicted target sentence. More sophisticated approaches propose to modify the NMT model itself to make it able to handle context information beyond the sentence scope. Wang and Cho (2016) present an approach to include document-level context into language modeling by implementing fusion approaches that help the LSTM maintain separated the inter- and the intra-sentence context dependencies. They report that using a wider context helps a neural LM capture better the semantics of a document. There are several approaches that extend the context handled by an NMT taking into account the previously encoded source sentences. Jean et al. (2017) analyze whether NMT systems can also benefit from larger contexts. They propose a variation of an attentional RNN NMT system to model the surrounding text in addition to the source sentence. They include an additional encoder and attentional model to encode as context sentence the previous source sentence. Wang et al. (2017a) propose a cross-sentence context-aware approach that integrates the historical contextual information within the NMT system in three different ways: by initializing the encoder or the decoder or both with the history representation, by using the history representation as static inter-sentence context in combination with the source sentence context produced by the attention model and, finally, by adding a gating to the amount of context information used to generate the next word. However, these approaches only extend the source context but ignore the target side context. In contrast, Tu et al. (2018) take into account the target side context by using a lightweight cache-like memory network which stores bilingual hidden representations as translation history, showing the utility of using this context information. More recent approaches implement system extensions that handle both source and target side contexts. While Maruf and Haffari (2018) extend an RNN-based NMT system using memory networks to capture global source and target document context, Voita et al. (2018) present a variation of the Transformer that extends the handled context by taking in the input both the current and previous sentences. And Jean
2.3. Automatic Evaluation 27 and Cho (2019) extend it by including a context-aware regularization. The importance of document-level neural machine translation is also seen in the recent WMT20197news translation shared task, where for the first time a specific track for document-level MT was included. The systems presented at the shared task follow the previously explained strategies: introducing the inter-sentence context information into the NMT system by augmenting the training data including documentlevel information, i.e., including coreference information (España-Bonet et al., 2019), or just by increasing the training-sequence length in order to capture a larger data context (Junczys-Dowmunt, 2019; Popel et al., 2019; Talman et al., 2019), or introducing variations in the NMT architecture to take into account document-level information (Stahlberg et al., 2019; Talman et al., 2019). In summary, many NMT approaches have been explored to include document-wide context or, at least, to make an NMT system able to handle a wider context than the intra-sentence one. Some of these approaches only exploit the context information from the source side ignoring the valuable information from the target side, although more recent variation proposals also include the target context information. The most successful approaches propose complex variations in the NMT models by including new document-oriented modules or regularization mechanisms to model document context. However, they do not show much success in exploiting the inter-sentence context information, presenting relative improvements in the final translation quality. 2.3 Automatic Evaluation Automatic evaluation of machine translation quality deals with computing the similarity between an MT system’s output and one or several reference translations for a given source text. Automatic machine translation evaluation metrics are not only useful to provide a quality measure for machine translation results but also are an important guidance for MT development and tuning. The first approaches for automatic MT evaluation were based on lexical similarity, that is, designing lexical measures. These measures work by rewarding lexical matches between automatic translations and a set of reference translations. The most popular and representative measure here is BLEU. This measure has been widely accepted as a de facto standard for years but it has several well-known drawbacks: 1. It has been shown that lexical similarity is neither a sufficient nor a necessary condition for two sentences to convey the same meaning (Callison-Burch et al., 2006; Coughlin, 2003; Culy and Riehemann, 2003). 2. It is also the case that BLEU and current BLEU-like metrics (Doddington, 2002; Lavie and Agarwal, 2007) perform well on low-quality machine translation results, but worse for high-quality ones. 3. It has been shown that BLEU has trouble distinguishing raw, inadequate machine translation output from fully fluent and adequate translation obtained from them through professional post-editing (Denkowski and Lavie, 2012b). 7http://www.statmt.org/wmt19/translation-task.html
28 Chapter 2. State of the Art 4. In particular, string-based metrics are not able to capture the syntax or semantic structure of sentences; therefore, they are not sensitive to the improvement of machine translation systems on these aspects. 5. The reliability of lexical metrics depends very strongly on the heterogeneity and representativity of reference translations. 6. String-based metrics tend to favour statistical MT systems when compared to rule-based MT or other paradigms on a particular data set. In order to cope with these issues, a number of authors have suggested exploiting linguistic information beyond the lexical level to increase robustness. Some have used additional linguistic knowledge to extend the reference lexicon. For instance, ROUGE, METEOR, and TER allow for morphological variations via stemming. TER and METEOR may perform an additional dictionary-based lookup for synonyms and paraphrases (Denkowski and Lavie, 2012a; Snover et al., 2009b). Russo-Lassner et al. (2005), Kauchak and Barzilay (2006), Owczarzak et al. (2006), and Zhou et al. (2006) have also studied the use of automatically-generated paraphrases to find potential phrase matchings. Surprisingly little work has actually been done in tuning the parameters of automatic evaluation metrics to correlate with actual assessments of quality, an exception being the work by Denkowski and Lavie (2012a) just cited. More recent approaches have been designed focusing on performing a semantic evaluation rather than only looking for lexical and syntactical features, resulting in more adequacy-oriented evaluation metrics. The MEANT metrics family (Lo, 2017; Lo and Wu, 2011; Lo et al., 2014) compute the similarity of the semantic frames and their role fillers between the human reference and machine translations, relying on semantic parsers, and some of them weighting the importance of a word by inverse document frequency when computing the phrasal similarity score. However, although these metrics correlate well with human accuracy judgements, they are not widely used. Furthermore, there exist also Adequacy-Fluency oriented metrics (Banchs et al., 2015; D’Haro et al., 2019) that are designed, although at sentence level, to take into account the syntactic and the semantic information in a decoupling way in order to provide a more balanced view of the translations quality. 2.3.1 Automatic Evaluation Metrics Throughout this thesis, the Asiya8toolkit by Giménez and Màrquez (2010) and Gonzàlez et al. (2012) is used to carry out the automatic evaluations. Depending on the experiment, we use a certain selection of the following metrics on lexical similarity: •Three metrics that compute some variant of the edit distance by Levenshtein (1966). First, the word error rate, WER (Nießen et al., 2000), is the minimal amount of changes (i.e., substitutions, deletions, and insertions of tokens) needed to transform the generated translation into the reference. Second, the position-independent word error rate, PER (Tillmann et al., 1997), is similar to WER but does not take into account the token order in the sentences. And 8http://asiya.cs.upc.edu/
2.3. Automatic Evaluation 29 third, the translation edit rate, TER (Snover et al., 2006, 2009a), is also similar to WER but adding as a possible change to shift forward or backward a phrase within the sentence. Furthermore, TER performs stemming and synonymy lookup when matching tokens from the translation to the reference. We denote by TERbase the version that performs only exact matching. Since the previous metrics measure the number of changes needed to coincide with the reference, their value is lower the closer the translation is to the reference. In the following chapters, we may append ↓to the names of these metrics as a reminder of the fact that lower values are better. This is in contrast to all the remaining metrics that we describe below, whose values are higher the closer the translation is to the reference. For them, we will use ↑as a reminder. •Two metrics based on lexical precision.9First, the bilingual evaluation understudy, BLEU (Papineni et al., 2002), measures the amount of n-grams of varying lengths in the generated translation that appear in the reference. We use the variant that considers up to 4-grams and is smoothed as described by Lin and Och (2004a). And second, the NIST metric (Doddington, 2002) is an evolution of BLEU which puts more weight on the infrequent n-grams, especially the short ones. In this case, we score up to 5-grams. •We also use three metric families based on the F-measure.10 First, the general text matcher, GTM (Melamed et al., 2003; Turian et al., 2003), has several variants depending on the value given to the eparameter appearing in the exponent and the root of its formulation: GTM1counts the matching unigrams between the translation and the reference, whereas GTM2and GTM3reward longer matchings. Second, from the ROUGE metric (Lin and Och, 2004b) we use several of its variants, differing on how the translation and reference are matched: the ROUGELlooks for the longest common subsequence (allowing gaps) between them, whereas ROUGEWadditionally penalizes gaps; on the other hand, ROUGES* counts the matching bigrams (allowing gaps) between them, whereas ROUGESU* additionally counts the matching unigrams. And third, the METEOR metric (Banerjee and Lavie, 2005; Denkowski and Lavie, 2010) counts the amount of words of the generated translation that match the reference, either exactly, with stemming, with synonyms, or with paraphrasing, adding penalties for reorderings. •The lexical overlap, Ol, is based on the Jaccard coefficient (Jaccard, 1912) to quantify the similarity between sets. In particular, it is defined as the ratio of distinct lexical items common to both translation and reference to the total amount of distinct lexical items among translation and reference together. In other words, given the set of lexical items in the translation and the analogous 9Remember the standard definitions of precision(T|R) = |T∩R|/|T|and of recall(T|R) = |T∩R|/|R|, where Tstands for the set of obtained translation items and Rfor the set of reference translation items. Metrics based on either concept usually differ on how Tand Rare specifically defined and, especially, how the intersection T∩Rmust be handled. 10The F-measure is a combination of precision and recall through their harmonic mean (Rijsbergen, 1979).
30 Chapter 2. State of the Art set for the reference, Olis computed as the division of the cardinal of their intersection by the cardinal of their union. On syntactic similarity, we use metrics of two broad families: •The metrics building on shallow parsing work on annotations for part-of-speech, word lemmas, and base phrase chunks, all obtained with automatic tools. We use six distinct metrics of this class. The overlap on part-of-speech, SP-Op(?), computes the lexical overlap restricted to tokens belonging to a certain part-of- speech, and averages over all parts of speech. The overlap on base phrase chunk, SP-Oc(?), is analogous, but working on base phrase chunks instead of parts-of- speech. Finally, four metrics that use the NIST measure for computing the accumulated scores over sequences of up to 5elements, which may be lemmas (SP-NISTl), parts of speech (SP-NISTp), base phrase chunks (SP-NISTc), or chunk type and inside/outside/beginning-position labels (SP-NISTiob). •Three metrics working on the trees obtained through automatic constituent parsing on the translation and reference. The overlap according to part-of-speech, CP-Op(?), is similar to SP-Op(?), i.e., it computes the lexical overlap according to the part-of-speech, averaging over all parts of speech. The overlap according to phrase constituent type, CP-Oc(?), is similar to SP-Oc(?)but working on phrase constituents instead of base phrase chunks, which in particular allows to consider phrase embedding and overlap. The syntactic tree matching, CP-STM (Liu and Gildea, 2005), computes the ratio of matching subtrees of a certain height, averaging the results for heights from 1to 9. Finally, we also use the uniformly-averaged linear combination, ULC (Giménez and Màrquez, 2008), which combines the values of other metrics to give a general quality ranking. Thus, its precise definition depends on the list of metrics selected to be averaged. Furthermore, the reported ULC value for a system is relative to the other systems appearing in the same ranking. Hence, the exact same system may obtain different ULC values depending on which other systems it is ranked against. Note that, in particular, this implies that ULC values are not directly comparable across evaluations on different sets of systems.
Chapter 3 Towards Document-Level Machine Translation In this chapter, we analyze some of the problems of translating texts sentence by sentence ignoring inter-sentence context information. In particular, we focus on frequent errors made by SMT systems that can be handled by exploiting context information across sentences. Then, we present a simple approach that uses context information to improve the coherence and cohesion levels of translations. This approach takes the form of a post-process strategy, which takes the output of an SMT system, detects words affected by some of the identified document-level issues, and suggests a better re-translation. 3.1 Document-Level Phenomena We analyze SMT system outputs in order to identify and categorize those translation errors that can be related to document-level phenomena, caused by incorrectly managing inter-sentence and document-level information. For such purpose, we selected a set of newswire articles. Journalistic texts exemplify the translation setting we are interested in, as the discourse in such formal texts holds a high level of coherence, cohesion, and lexical consistency since their objective is to describe a series of facts about a certain topic. In particular, we chose the newsCommentary corpus, which is a free corpus that is released every year for the WMT translation shared tasks.1We carried out our analysis on the test set from the 2011 release. It contains documents in English, Spanish, French, German, and Czech. However, only the English-Spanish parallel corpus was analyzed because our experiments focus on English to Spanish translations. This test set has 110 news items on different topics, with a total of 3,003 sentences. Each text is labeled with XML tags 1Available at: http://www.statmt.org/wmt13/training-parallel-nc-v8.tgz 31
32 Chapter 3. Towards Document-Level Machine Translation that identify the news title and mark the limits of the document, paragraphs, and sentences, reflecting the document structure. To generate automatic translations of the newswire corpus under analysis, we built a baseline SMT system based on the Moses (Koehn et al., 2003) decoder, using the Europarl-v7 English-Spanish parallel corpus. Then, in order to recognize patterns that could help identify errors in the generated translations, we used several NLP tools2to analyze the selected source document and, then, the gathered information was projected into the machine translations. Special attention was devoted to annotating the most typical features linked to document-level information, such as coreference or lexical consistency. Coreference directly correlates with the cohesion level of a document, while translations of named entities throughout a document are a direct indicator of its translation quality. Thus, coreference mistakes in the translations were studied to assess whether the cohesion from the source text had been transferred to the translation by the SMT system or not. Similarly, the relations of the same named entity in the source document were followed in the translation to identify and study those cases in which it varied. As a result of the analysis, the following errors were identified as the most relevant translation phenomena related to the lack of document-level information management: •Inconsistent translation of “ambiguous” words: One of the first detected errors were mistakes that break the semantic coherence of a document. Taking the “one-sense-per-discourse” assumption, a translation is better if its words appear translated in a consistent way, that is, the same source word appears translated into the same target word or, at least, into words with similar meanings within a document. In the analyzed translation examples, there were words that appeared translated into different and semantically incompatible forms within a document. This kind of error noticeably hinders the final translation quality. So, we want to identify these words and design a strategy to correct their incoherent translations. Choosing the right translation for these ambiguous words is equivalent to disambiguate the word in its context, but, in contrast to a word sense disambiguation problem, we are facing here instead a lexical choice problem, since our aim is to correct the bad translation choices made by the decoder. Consider, for example, the English word “desk”. It can be translated into Spanish as “ventanilla”, “escritorio”, “mesa”, or “mostrador”, depending on the context where it is used. These translation options cover two basic meanings: “desk” as a piece of furniture (“mesa” and “escritorio”) and “desk” as a counter (“ventanilla” or “mostrador”). The aim of our work is to make the decoder able to translate “desk” homogeneously throughout the document regarding its context. 2In particular, we employed the tools integrated in the Asiya toolkit (http://asiya.cs.upc.edu), the PoS tagger provided by the FreeLing library (http://nlp.cs.upc.edu/freeling/) by Padró et al. (2010), the RelaxCor (http://nlp.cs.upc.edu/relaxcor/) coreference resolutor of Sapena et al. (2010), and the BIOS (http://www.surdeanu.info/mihai/bios/) named entity recognizer of Surdeanu et al. (2005).
3.1. Document-Level Phenomena 33 A general strategy to follow in order to handle this phenomenon is to identify those words in the source document that appear translated into different forms, detect wrong translations, and correct them by disambiguating these words in their contexts thus improving the translation consistency and coherence. The already mentioned example when translating the word “desk” illustrates the situation. Another example of this phenomenon is the word “nickname”; in the context of a news item about the names used among colleagues, this word can be translated as “denominación”, “sobrenombre”, or “apodo”. Since “sobrenombre” and “apodo” are synonyms given a context, the option of using “denominación” is not as accurate as the others. Then, we want to filter out this option to not use this term in the final translation to improve its lexical cohesion. •Incoherent translation of coreference mentions: A word corefers with another in a text if both of them refer to the same entity. It is easy to find this kind of relation between names and pronouns through a text. If it is a well-formed text, these words must agree in gender and number, and these relations confer cohesion to the document. Moving to the side of a document translation, an indicator of its level of coherence is how this intra- and inter-sentential agreement among the corefered words is preserved. Studying the appearance of correlations in translations and how the agreement is maintained by the MT systems gave us hints about handling errors related to this document-level phenomenon. In particular, we would like to keep the translations coherence through coreference chains at translation time or fix the disagreements by a post-process strategy. An example of this phenomenon is the translation of the term “the engineer”. In a document where the term refers to a woman called Ana, in Spanish it would become “la ingeniera” and not “el ingeniero”. Another example, in the context of a news item talking about several councilors in the city hall of Prague, we find the sentence “.. .the Councilor for the environment, Lukas Plachy. He also guesses the right meaning.” translated as “... la consejera de medioambiente, Lukas Plachy. Él también adivinó el significado correcto.” This example shows a disagreement among the noun phrase “la consejera” and the “Él” pronoun. If the system is able to identify Lukas as a male name, a good translation would be “.. .el consejero de medioambiente, Lukas Plachy. Él también adivinó el significado correcto.” where gender agreement is maintained for the mentions that corefer. The cohesion level of a translation is directly related to how the source text coreference information is projected into the produced translation. Monitoring the gender and number agreement of the coreference chains gives a good idea of how to identify translation errors that can be handled by using the document context information. •Disagreement in gender, number, and person: Going further analyzing the agreement among words within a document, we realized that SMT systems can lose agreement among words in a noun phrase, among the persons of a subject and a verb, or even the verb tense being used in a part of a document.
34 Chapter 3. Towards Document-Level Machine Translation A well written text usually does not present gender nor number disagreements and coherent verbal tenses are used to present different and distinguishable parts of itself. We propose to not only design strategies to identify and fix incoherences in gender or number inside coreference chains, but also to take advantage of the described scenario and correct agreement errors in the intra-sentential scope or in the close inter-sentences context which is a more global and simpler problem than the one we presented related to the coreference information. We use this categorization to design several strategies to correct translation mistakes by using document-level information. Through the rest of this chapter, we propose and analyze approaches to improve translations without modifying the inner decoder functionality. 3.2 Post-Process Strategies Our approach can be broken down into three broad steps: (i) obtaining an initial, preliminary translation of the document, (ii) locating certain kinds of mistakes in the translation and identifying possible new translation options for them, and (iii) retranslating taking into account the new translation options identified in the previous step. Step (i) is standard: we use a Moses system to obtain the translation, sentence by sentence. Step (ii) depends on the goal, i.e., on the kind of phenomenon that is tackled. In particular, we focus on improving the lexical coherence for those source words that appear translated into more than one different form and, additionally, on fixing gender or number incoherences using coreference information. Each of these goals is tackled by a specific approach; the former is described in Section 3.2.1 and the latter in Section 3.2.2. Note that the work performed in this step can take advantage of already having a translation of the whole document. Finally, step (iii) is a retranslation with Moses performed in either a restrictive or a probabilistic way. The restrictive re-translation forces3as the only possible translation the option provided by step (ii). On the other hand, the probabilistic way suggests4several possible translations, the most suitable ones identified in step (ii), and lets the decoder choose among them and the phrase table options. Notice that the latter approach introduces more noise because the system is managing more possible translations than in the restrictive one, sometimes as many as in the initial translation. In Section 3.2.3 we evaluate the post-processing of lexical inconsistencies, of disagreements, and their combination. 3Forcing a translation is a feature of the Moses decoder that involves an XML markup of the source sentence with the information of available translation options. For the restrictive approach, we use the exclusive option of the decoder, which forces Moses to only use the translation option provided in the XML tag when translating the tagged source word. 4Suggesting a translation is another feature of Moses handled through XML markup. In this case, for the probabilistic approach we use the inclusive option of the decoder, which makes Moses take into account the translation options provided in the XML tag when translating the tagged source word. Each of the provided options has an associated probability and, if the aggregated probability of all of them is less than 1, then the decoder can also use the phrase table in the remaining cases.
3.2. Post-Process Strategies 35 3.2.1 Lexical Consistency The strategy that deals with lexical consistency works on source words that appear translated into more than one different form when translating a document. We focus on tackling this phenomenon for nouns, adjectives, and main verbs in English, filtering out determiners, prepositions, auxiliary verbs, and others, that is, we focus on content words. In particular, we use the part-of-speech tags obtained with FreeLing (Padró et al., 2010) to do this filtering. For each of the resulting relevant source words, we use the alignments provided by the Moses’ preliminary translation to link them to their corresponding target words. Next, for each of the distinct source words in consideration, we count the number of different translations it has throughout the document. This counting of target words is done at the lemma level, i.e., we conflate different translations when their lemmas coincide. For instance, the Spanish target words “amigo” and its feminine “amiga” would be considered as the same translation form for “friend” since they share the same lemma. On the other hand, “compañero” would be considered a different translation than “amigo” since they do not share the lemma, even if they can be synonyms in certain contexts. Lemmas are also obtained with FreeLing. At this point, the process has enough information to identify the words that have multiple different translations in the document. Finally, we try to identify the most suitable translations for them. We do that in two different ways, depending on whether the re-translation step follows the restrictive or the probabilistic approach. For the former, we only have to obtain one single translation option in each case: we provide as the translation for each ambiguous word the option with most occurrences in the current document, unless there is a tie, in which case we do not suggest anything to avoid biasing the result in a wrong direction. Note that, although the most frequent translation option needs not be the correct one, we expect the intrasentential context to be enough for the decoder to pick the proper translation in the majority of cases. Another option would be to pick a random translation as the good one. Doing this we control the introduced noise but we also lose information given by the decoder in the available preliminary translation. For the probabilistic approach, we proceed slightly differently: as before, for each ambiguous word we provide as a translation the option with most occurrences in the current document, but, in the case of a tie, in this occasion, we suggest all the tying options (all with the same associated probability). In this case, we are giving Moses freedom to choose guided by its language information, but we are also introducing noise because we are managing more possible translations than in the previous situation. Looking at a concrete example, if the English source word “desk” appears four times in the text and it is translated two times as “mesa”, one as “mostrador”, and another one as “ventanilla”, then the four occurrences of “desk” in the source text will be marked for re-translation. In this situation, the word “mesa” will be the single option given in the restrictive and probabilistic approaches, as it is the most frequent translation. However, if “desk” had another occurrence translated as “mostrador”, then the restrictive approach would not suggest any re-translation due to the tie between the two “mesa” and the two “mostrador”, whereas the probabilistic approach would give both “mesa” and “mostrador” as re-translation options, with 1/2proba-
42 Chapter 3. Towards Document-Level Machine Translation source phrase “the amicable meetings”. This phrase is translated by the baseline as “el amistosa reuniones”, where one can find disagreements of gender and number among the determiner, the adjective, and the noun. The system detects these disagreements and after tagging the source with the correct forms and re-translating, one obtains the correct final translation “las reuniones amistosas”, where we observe also that the decoder has reordered the sentence. Regarding the errors introduced by the system, we observe again that many of them are caused by wrong analysis. For instance, in the sentence “all (the) war cries” which should be translated as “todos los gritos de guerra”, the dependence tree shows that the determiner depends on the noun “war” and not on “cries”, so, according to this relation, our method identifies that the determiner and the translation do not agree and produces the wrong translation “todos (la) guerra gritos”. These results also show that for our approach it is easier to detect and fix disagreements among determiners or adjectives and nouns than among subjects and their related verbs. In general, this is because our current system does not take into account subordinated sentences, agent subjects, or other complex grammatical structures, and therefore the number of detected cases is smaller than for the determiner–adjective– noun cases. Chaining both Post-Processes In order to complete this set of experiments, we run sequentially both systems. Global automatic evaluations of the whole test set are shown in Table 3.1 (lex.+agr. rows), where again it is only possible to observe a very small variability with respect to the baseline. Table 3.6 shows the results of a manual evaluation for 5documents with the most suggested changes, following the same format as in the previous experiment. Once again, we observe small variations in BLEU scores, but we see that when the systems introduce changes, they are able to fix more translations than the ones they damage. Also as before, it is easier to detect and fix disagreements among determiners, adjectives, and nouns than those regarding verbs because it is more difficult to detect disagreements with verbs and also these kinds of errors are less frequent than gendernumber disagreement among elements in a noun phrase. 3.3 Conclusions Most of the current MT systems are designed to translate documents sentence by sentence ignoring the contextual information, generating then translation outputs with different kinds of errors that hinder the coherence and cohesion levels. Section 3.1 analyzes and presents a categorization of the most noticeable translation errors related to document-level information in the sense that they may be easy to fix using context information. In particular, lexical consistency and gender and number agreement at intra- and inter-sentence scope are described. Once we have identified and described the phenomena we are interested to handle, in Section 3.2 we explored a methodology to include document-level information within a translation system without changing the decoding mechanism. The method
3.3. Conclusions 43 news item System BLEU↑OK/ch dets adjs verbs 20 baseline 13.40 restrictive + restrictive 13.38 17/19 14/15 3/3 0/1 restrictive + probabilistic 13.44 14/19 11/15 2/3 1/1 probabilistic + restrictive 13.21 16/17 13/14 3/3 0/0 probabilistic + probabilistic 13.44 12/17 10/14 2/3 0/0 25 baseline 14.42 restrictive + restrictive 14.68 12/19 9/13 3/6 0/0 restrictive + probabilistic 15.09 15/19 10/13 5/6 0/0 probabilistic + restrictive 14.39 10/17 6/11 4/6 0/0 probabilistic + probabilistic 14.82 13/17 8/11 5/6 0/0 39 baseline 28.49 restrictive + restrictive 30.02 20/22 14/16 6/6 0/0 restrictive + probabilistic 29.59 18/22 13/16 5/6 0/0 probabilistic + restrictive 29.94 19/21 14/16 5/5 0/0 probabilistic + probabilistic 29.59 17/21 13/16 4/5 0/0 48 baseline 30.05 restrictive + restrictive 29.57 6/6 5/5 1/1 0/0 restrictive + probabilistic 29.60 4/6 4/5 0/1 0/0 probabilistic + restrictive 29.57 6/6 5/5 1/1 0/0 probabilistic + probabilistic 29.60 4/6 4/5 0/1 0/0 49 baseline 25.54 restrictive + restrictive 25.82 9/11 3/4 6/7 0/0 restrictive + probabilistic 26.02 9/11 3/4 6/7 0/0 probabilistic + restrictive 25.63 8/11 3/4 5/6 0/1 probabilistic + probabilistic 26.02 9/11 3/4 5/6 1/1 Table 3.6: Manual evaluation of chaining both post-processes (first applying the disambiguation post-process and, afterwards, checking for the agreement), using either the restrictive or the probabilistic approaches, and compared to the Moses baseline system. The OK/ch column shows the number of changes made with respect to the baseline translation and how many are correct, and these amounts are broken down into three categories: dets show the same information but only for changes done over determiners, adjs over adjectives, and verbs over verb forms. performs a two-pass translation. First, a translation is generated by means of a baseline SMT system. Afterwards, incorrect translations according to predefined criteria are detected and new translations are suggested. The re-translation step uses this information to promote the correct translations in the final output. A common post-process is applied to deal with lexical coherence at document level and intra- and inter-sentence agreement. The source documents are annotated with linguistic processors and the interesting structures are projected on the translation where inconsistencies can be uncovered. In order to handle lexical coherence, we developed a post-process that identifies words translated with different meanings through the same document, described in Section 3.2.1. For treating disagreements, we developed a post-process that looks for inconsistencies in gender, number, and person
44 Chapter 3. Towards Document-Level Machine Translation within the structures determiner–adjective(s)–noun(s) and subject–verb, described in Section 3.2.2. Because we are treating sparse phenomena, an automatic evaluation of our systems does not give us enough information to assess the performance of the systems. A detailed manual evaluation of both systems shows that we only introduce local changes. The lexical-coherence-oriented post-process induces mostly correct translation changes when using our restrictive system, improving the final coherence of the translation. Furthermore, for the post-process focused on the analysis of the number and gender agreement, it achieves more than 80% of accuracy over the introduced changes in the manually-evaluated news documents. We also observed that some of the negative changes are consequence of bad word alignments which introduce noise when proposing new translations.
Chapter 4 Word Embeddings in Machine Translation Recently, distributed representation models have been used successfully in many natural language processing tasks. These models have proved to be robust and powerful to predict semantic relations between words. However, they are unable to handle lexical ambiguity as they conflate word senses of polysemous words into one common representation1. This limitation is already discussed by Wolf et al. (2014), who also propose an extension of the learning architecture that jointly trains two monolingual models for a language pair. In this way, they are able to capture meanings across the two languages. This is a refinement of the observation of Mikolov et al. (2013b), who noticed that even when training the two monolingual models independently they can be related through a linear mapping: this allows the authors to use the language of the pair with the best linguistic resources to improve dictionaries or phrase tables for the language with the poorer resources. We also exploit language pairs, but in contrast to these approaches, our goal is to use word alignments between the two corpora to create bilingual tokens and, in this way, disambiguate the lexicon and obtain a bilingual vector model with more precise semantics. We use the word2vec package presented by Mikolov et al. (2013a) to build monolingual and bilingual word embeddings and then evaluate the acquired representations on three different tasks: (i) predicting semantically related words, (ii) performing a cross-lingual lexical substitution task, and (iii) guiding the decoding in a translation task. The latter evaluation is the most relevant for our ultimate ends, as it assesses the appropriateness of the models for the purpose of translation. 1More recent embedding approaches like BERT Devlin et al. (2019) are able to produce contextualized word embeddings, although they still consider only sentence level context. 45
46 Chapter 4. Word Embeddings in Machine Translation 4.1 Semantic Models Using word2vec We use the implementation of the Continuous Bag-of-Words (CBOW) algorithm in the word2vec package to build our models. This algorithm uses a neural network to predict a word given a set of its surrounding words, where the order of the words in the history does not influence the projection. This is in contrast to the other algorithm available in word2vec for building the models, Skipgram, which trains a neural network to predict the context of a given word. We choose to use CBOW because we want to apply these models in the translation task and the CBOW training mechanism is closer to that, i.e., predict an adequate (translated) word taking into account a set of (translated) context words. In order to enrich the semantic information encoded in the models, we transform the training data to hold information from both the source and target languages together. In particular, we use an aligned parallel corpus to extract a new training corpus of word pairs: (wi,S|wi,T ). For instance, if the words house and casa are aligned in the parallel corpus, we consider the new form house|casa. In this way, we hope to better capture the semantic information that is implicitly contained by a text and its translation. For example, we expect to be able to distinguish among the different meanings of the word desk by considering its corresponding forms in Spanish, i.e., differentiate between desk|mesa,desk|mostrador,desk|escritorio, and any others. The training has been performed under the following settings. We build the bilingual training data set from parallel corpora in the English-Spanish language pair available in Opus2(Tiedemann, 2009, 2012). In particular, we select the Europarl-v7, United Nations,Multilingual United Nations, and Subtitles-2012 corpora, which total 584 million words for English and 759 millions for Spanish. These corpora have been automatically aligned to obtain the word alignment information necessary for our bilingual models. We choose the one-to-one alignments to avoid noise and repetitions in the final data. Monolingual models are built with the Spanish or English side of these same corpora. Finally, regarding the word2vec training parameters, we consider several configurations for the dimensionality of the vectors and the context window size. 4.2 Accuracy of the Semantic Model We first evaluate the quality of the models based on the task of predicting related words. A bilingual test set is manually built from the Semantic-Syntactic Word Relationship test set of Mikolov et al. (2013a) by attaching to each English word its Spanish translation, according to a native Spanish speaker. This test set contains 19,544 questions, divided into 8,869 semantic and 10,675 syntactic questions. For the monolingual models, we use the same test set projected to either the English or the Spanish side. The evaluation task consists in predicting a word given a pair of related words and a question word. Intuitively, the task can be understood as solving analogies, such as: 2http://opus.lingfil.uu.se/
4.2. Accuracy of the Semantic Model 47 Model Vector dimensions Context window size 300 600 1,000 2 5 10 English 31.24% 33.53% 33.34% 31.97% 33.53% 32.68% Spanish 11.42% 12.30% 12.16% 12.54% 12.30% 14.15% English-Spanish 21.96% 23.68% 23.41% 19.50% 23.68% 25.54% Table 4.1: Accuracy of the vector models filtered to the 30,000 most frequent vocabulary entries, when varying the vector dimensions (with the size of the context window fixed to 5) and when varying the context window size (with the dimension of the vectors fixed to 600). The 600 and 5columns coincide by definition. Athens is to Greece as Paris is to ? which in the word vector setting becomes the equation: Paris −Athens +Greece =? with its expected solution being France or, rather, a vector that is closest to the word embedding of France. In that example, the words provided by the English test set are the pair Athens Greece and the question is Paris. In our English-Spanish bilingual scenario, the same example is represented by the pair Athens|Atenas Greece|Grecia and the question Paris|París, and in this case the task is to predict France|Francia. The previous analogy is an example of a semantic question. The syntactic questions of the test set follow the same scheme, but relating words through syntactic transformations. For instance: good is to better as bad is to ? with the expected solution being the comparative worse. 4.2.1 Results First of all, we evaluate how the training parameters affect the quality of our models. Table 4.1 shows the effect of varying the vector dimensionality in terms of accuracy,3 with the vocabulary of each model filtered to its 30,000 most frequent entries. We observe the benefit of using more than 300 dimensions, but there is no clear gain in using more than 600 dimensions in any of the models. Regarding the context window size, the same Table 4.1 shows that we obtain the best results for the English model when using a window of 5, whereas a window of 10 is optimal for the Spanish model. In the case of the bilingual model, we also observe an improvement of the accuracy when increasing the size of the context window, showing how a larger context helps the model disambiguate word senses. 3All the accuracy values are computed over the questions of the test set whose words are known to the model in consideration. The percentage of questions of the test set with known words for the English model is 64.67%, for the Spanish model 44.96%, and for the English-Spanish model 13.74%.
48 Chapter 4. Word Embeddings in Machine Translation Model Overall Semantic Syntactic English 32.47% 19.17% 38.57% Spanish 10.24% 15.15% 8.70% English-Spanish 23.68% 25.63% 22.60% Table 4.2: Accuracy of the vector models per question category. Table 4.2 shows the accuracy results for our models of 600-dimensional vectors and trained with a context window size of 5, both overall for the whole test set and broken down into the subcategories of semantic and syntactic questions. Notice that, compared to Table 4.1, without filtering vocabularies the models achieve a slightly worse accuracy. This is because, although using the whole vocabulary improves the coverage, it also decreases the precision: each subspace is populated by more vectors (e.g., because more synonyms are present), making it harder for the correct word embedding to be the closest one. An analogous problem will manifest later in the results of the cross-lingual lexical substitution task in Section 4.3.2, where considering the 5closest embeddings will prove to be more accurate than focusing exclusively on the single closest one. We observed that the low accuracies achieved by the Spanish models are due to the noise in the training data, such as multiple spellings or synonyms for some words, e.g., “Kazakhstan” appearing as “Kazajistán”, “Kazajstán”, or “Kazakstán”. Accuracy decrease may also be caused by the compromises made during the translation of the test set, e.g., “faster” becoming “rápido” instead of “más rápido” since we are not considering multi word expressions. In the bilingual case, the accuracy is lower than for English due to the coverage problem inherited from the Spanish data and the noise from word alignments. 4.3 Cross-Lingual Lexical Substitution Task We now evaluate the semantic models through the effect they can have in a scenario resembling translation. In particular, we implement a cross-lingual lexical substitution task inspired by the one carried out in SemEval-2010.4To this end, first, we identify the content words of an English test set which are translated into Spanish in more than one different way by a Moses system. We call these words ambiguous. Then, the task consists in choosing the adequate Spanish translation for each of the ambiguous words. In our case, the correct choice is given by the reference translation of the test set. To give an example, the word “desk” appears several times in a news item about a service to attend grievances against exaggerated rents. This word in such context has the meaning of a service counter or table in a public building, such as a hotel.5 The correct translation to that meaning in Spanish would be the word “mostrador” or “ventanilla”. But in the output of the SMT system, besides the correct translations, 4http://semeval2.fbk.eu/semeval2.php?location=tasks#T24 5Definition taken from Collins Concise English Dictionary.
4.3. Cross-Lingual Lexical Substitution Task 49 Model Top 1 Top 5 Spanish CBOW 47.71% 65.44% Skipgram 47.71% 59.19% English-Spanish CBOW 62.39% 85.49% Skipgram 62.39% 78.36% Table 4.3: Accuracy of the vector models in the cross-lingual lexical substitution task, when suggesting either the top 1(i.e., only the best) or the top 5(i.e., the five best) Spanish translation options. we can also find “desk” translated as “mesa” or even as “escritorio” in the same document. Since the reference translation contains “ventanilla”, only this word will be considered correct in the evaluation. We tackle the problem of choosing the adequate translation for each occurrence of an ambiguous word as follows. Given one of such occurrences, we first compute a vector representing its context in the target side: we take the 2previous and 2 following words in the target, look for their word embedding in our models, and combine them with a vector addition. Note that, clearly, when accessing a bilingual model it is necessary to retrieve the source word aligned to the target word in question in order to build the pairs (wS|wT)needed for querying the model. Next, we score each translation option seen within the document. This score is the cosine similarity between the computed context vector and the word embedding of the translation option in consideration. Finally, we choose the translation option with highest score as the best option for that particular occurrence of the ambiguous word. 4.3.1 Settings Our English-to-Spanish translation system is a Moses decoder (Koehn et al., 2007) trained on the Europarl-v7 corpus (Koehn, 2005) and using GIZA++ (Och and Ney, 2003) to obtain the word alignments. The Spanish language model is an interpolation of several 5-gram language models obtained using SRILM (Stolcke, 2002) with interpolated Kneser-Ney discounting on the target side of the Europarl-v7, United Nations,newsCommentary2007-2010,AFP,APW, and Xinhua corpora as given by QuEst (Specia et al., 2013).6The feature weight optimization is done with MERT (Och, 2003) against the BLEU metric (Papineni et al., 2002) on the newsCommentary2009 development corpus. We use newsCommentary2011 as test set. 4.3.2 Results Table 4.3 shows the results of the evaluation of our bilingual model in comparison to our monolingual model trained in Spanish. In this case, we consider models trained with both the CBOW and the Skipgram algorithms of word2vec, using 600 dimen- 6Resources are available at: https://www.quest.dcs.shef.ac.uk/wmt13_qe.html
50 Chapter 4. Word Embeddings in Machine Translation sions for the vectors and a context window size of 5. We use a stop-word list to skip some adverbs, common verbs, the prepositions and conjunctions as ambiguous words to avoid noise in the results. For our test set, 8.12% of the words are ambiguous and, in average, there are 3.26 translation options per ambiguous word. The monolingual model has, in average, a coverage of 90.97% per document and the bilingual one 87.53%, which over the ambiguous words become 87.37% for the monolingual and 83.97% for the bilingual. The two word2vec algorithms have the same performance for this task when they suggest only the best option: an accuracy of 47.71% for the monolingual model and 62.39% for the bilingual one. So, bilingual models are encoding considerably more semantic information than monolingual models in the Top 1setting. Furthermore, the bilingual model is able to outperform a frequentist approach, since always using the most frequent translation option for this task leads to 59.76% of accuracy. Accuracies are significantly improved when more options are taken into account. This is expected since, for instance, synonym translations are considered mistakes when they turn up in the Top 1setting, leading to underestimating those accuracy results (Mikolov et al., 2013b). More precisely, when looking at the accuracy at Top 5, CBOW achieves 65.44% with the monolingual model and 85.49% with the bilingual one, whereas the Skipgram models have, approximately, 6less points in the monolingual case and 7in the bilingual one. These results indicate that CBOW bilingual models are capturing better the semantics and that considering more than one option can be important in the full translation task. Furthermore, the models improve over the 59.76% accuracy of the frequentist approach, except for the Skipgram monolingual model, which nevertheless achieves a similar accuracy. 4.4 Translation Task with Semantic Space Language Models We now focus on the usage of word embeddings within the Lehrer document-oriented decoder. Intuitively, the decoder uses these models in analogy with the standard language models, but working on vectors representing words and their contexts instead of n-grams of words. Thus, when using monolingual word embeddings, the approach mimics a language model computed over semantic information from the target document, whereas in the case of the bilingual vector models, the approach mimics a language model over semantic information from both the target and the source sides. In any case, the expected effect is to promote translation choices that are semantically similar to the target context. More precisely, we follow the use of word vector models as a Semantic Space Language Model (SSLM) by Hardmeier et al. (2012). In that work, the authors use latent semantic analysis7(Bellegarda, 2000; Foltz et al., 1998) to build their word vector models and proceed as follows to reward word choices that are semantically close to their context. For each word win a document translation candidate, a score 7This technique uses the analysis of relationships among a set of documents and their terms to create a simplified matrix that represents the word counts per paragraph. This approach assumes that two close words occur in similar pieces of text.
4.4. Translation Task with Semantic Space Language Models 51 is computed based on the cosine similarity between the vector representation of w and the sum of the vector representations of the ntarget words that precede win the document translation. The similarity is then converted into a probability by a histogram lookup, as proposed by Bellegarda (2000). The non-content words and the words unknown to the model are handled specially, both when computing their associated score and when considering them as part of the context of any later word. Formally, the score for wis: score(w|~ h) = punigram(w)if wis a stop word α·psimilarity(cossim(µ(w),~ h)) if w∈dom(µ)is not a stop word εotherwise (4.1) where ~ his the vector representing the preceding context of w(i.e., the sum of the vector representations of the nprevious non-stop known words in the document translation), punigram maps each stop word to its relative frequency in the training corpus, αis the proportion of content words in the training corpus, psimilarity takes the cosine similarity computed by cossim and maps it from the range [−1,1] into a probability in [0,1] according to a given histogram, µrepresents the word vector model mapping words to their associated vector representations, with dom(µ)being its domain, and εis a small fixed probability. The final score for the document translation candidate is the sum of the natural logarithm of the score of each of its words. The logarithm is required to properly fit in the log-linear scoring model from Koehn et al. (2003) used by the decoder. The value chosen by Hardmeier et al. (2012) for the parameter nis 30 to make it possible that the context used in the computations crosses sentence boundaries. Other parameters are offered by the SSLM implementation to alter its basic scheme described above. For instance, it is possible to ignore casing differences when accessing either the stop-word list or the vector model, to perform bilingual queries into the vector model by taking the source words aligned with the target word in consideration, or to use a transformation different from a histogram when mapping the cosine similarities to probabilities. For the latter, we use the mapping where psimilarity(x)is xwhen x > 0and 1otherwise. In this way, the cosine similarity of words that are semantically distant from their context (in particular, when the vectors are π/2radians or more apart) does not contribute to the final score, since its natural logarithm after such psimilarity mapping is 0. This idea is similar to how the translation model of the decoder scores out-of-vocabulary words. 4.4.1 Settings We use as SMT baseline for English-to-Spanish translation the Moses system described in Section 4.3.1. Regarding the document-level decoder, we use a Lehrer baseline system with the following configuration. First, the enabled features coincide with the ones of the Moses baseline system, except for lexical reordering, which is not implemented. Second, its feature weights are tuned with MERT (Och, 2003) against the BLEU metric (Papineni et al., 2002) on the newsCommentary2009 develop-
58 Chapter 5. Lexical Consistency in Statistical Machine Translation desk desk desk desk mostrador ventanilla mostrador mostrador mostrador mostrador mostrador mostrador mostrador ventanilla mesa escritorio Figure 5.1: Example where the source document (left) is translated with differing options for the word “desk”. The greyed-out target document (top) is undesirable for us since the translation options used for “desk” are inconsistent. Moreover, the specific options “mesa” and “escritorio” are not adequate in Spanish assuming that the context of the document is related to a service attending rent grievances: they are not likely to occur in such setting. The other two target documents (right and bottom) are valid for us. Notice that the bottom one also uses multiple translation options, but both “mostrador” and “ventanilla” are adequate for the context. its context and the other translation options seen through the document. However, the SSLC may not be enough to help the decoder obtain better translations in terms of consistency. Recall from Section 2.2.2 that the decoding performs a hill climbing in a translation search space. At each step, the decoder explores the neighborhood of the current translation by randomly applying to it one of the available change operations. The default operations perform simple modifications such as changing the translation of a phrase, swapping phrase-pairs, or re-segmenting the data. Unfortunately, these simple operations do not aid directly in our goal of reaching more lexically consistent translations. The reason for this fact is twofold. On the one hand, to increase the consistency it is in general necessary to perform multiple changes within the document and, since the default change operations only perform one change at a time, it would take several steps to fix one of the lexical choice inconsistencies. On the other hand, since hill climbing only performs a step when it strictly increases the score, each of the intermediate steps that try to fix an inconsistency would need to increase the score. Here arises the necessity of introducing a new change operation. We implement the Lexical Consistency Change Operation (LCCO) that shortcuts the process by, at a single step, performing multiple simultaneous changes that fix inconsistent translations of the same source word.
5.2. Semantic Space Lexical Consistency Feature 59 5.2 Semantic Space Lexical Consistency Feature Intuitively, SSLC scores each occurrence of an inconsistently translated source word with a value in [−∞,0]. This value is intended to measure how worse (in terms of adequacy) the current translation option is when compared to the other translation options seen in the document. We consider a translation option to have better adequacy the more semantically similar it is to the context surrounding the occurrence being scored. We compute this semantic similarity as a cosine similarity between two vectors: (i) the word embedding of the translation option and (ii) the vector representation of its context within the target document. A vector representation of the context is obtained in our case as the sum of all its word vectors. Recall that the aim of SSLC is not to enforce a strict lexically consistent translation, since we allow lexical inconsistencies when they are semantically similar to their surrounding context. As a first step, we need to define one basic property: when two words must be considered to be the same word. To this end, we use a criterion looser than the strict identity: we allow to conflate words having distinct casing and differing on certain kinds of inflection. This is necessary to properly identify ambiguous words; for instance: if “desk” is being translated into Spanish as “mostrador” whereas “desks” is being translated as “mesas”, we want to identify that the common stem of “desk” and “desks” is obtaining two distinct translated stems. More precisely, we define a normalization process for words, and consider two words to be the same one if, and only if, their normalized forms coincide. Formally, we introduce the functions normsrc and normtgt which take as input a source or target word, respectively, and return a normalized version of it. In our settings, normsrc and normtgt are implemented by, first, lower-casing the word and, then, by stemming it with the Snowball library1for the appropriate language. For example, with English source we get normsrc(Penguins) = penguin, where “P” has been lower-cased to “p” and the plural suffix “s” has been erased by the stemming. Second, to formalize SSLC we still need some preliminary artillery. Let the source and target documents be the sequences of words s1, s2, . . . , sNand t1, t2, . . . , tM, respectively, for some N, M > 0. Recall that source and target words are aligned with an arbitrary relation, say T. In particular, one source word may be aligned to zero, one, or more target words, and conversely, one target word may be aligned to zero, one, or more source words. We focus only on the one-to-one aligned words, i.e., source words that are aligned to just one target word and, in turn, such target word is only aligned with that source word. We denote by τthis one-to-one sub-relation of T, hence τ:{1, . . . , N}→{1, . . . , M}is a partial, injective mapping that associates to a source word index its corresponding target word index. τis partial since it is not defined for those source word indexes aligned to zero or more than one target words, and it is injective since we only consider target words aligned to exactly one source word. In order to identify inconsistently translated words, we first need to identify all occurrences of the same source word. To this end, let occ :{1, . . . , N} → 2{1,...,N} be the function that associates to each source word index ithe set of indexes of the 1http://snowballstem.org/
60 Chapter 5. Lexical Consistency in Statistical Machine Translation source words that have the same normalized form as si, i.e.: occ(i) = {j∈ {1, . . . , N} | normsrc(sj) = normsrc(si)} Observe that i∈occ(i)always holds. Additionally, we need to obtain the target word indexes aligned to the source word indexes in occ(i). To this end, we use τocc(i)to denote the set of target word indexes resulting of applying τto each source word index in occ(i), skipping those for which τis undefined. Finally, we say that the ith source word is inconsistent in the current translation, denoted incons(i), if the source words sjthat have the same normalized form as sihave been translated into more than two distinct normalized targets. Formally: incons(i) = {normtgt(tj) : j∈τocc(i)}>2 We are now in the position to define the associated score for inconsistent words. First, let µbe the mapping defined by the word vector model in use by the decoder. Recall that these models are a projection that maps words to vectors in a certain space Rn, for some n > 0. Second, let C > 0be the size of the context to either side of the target word, possibly crossing sentence boundaries. The vector representation for the context of the jth target word is defined as the sum of the word embeddings around j: ctxt(j) = Xk∈{max(1,j−C),...,j−1,j+1,...,min(j+C,M)}µ(tk) And third, the score associated to the ith source word, denoted score(i), computes the difference between two similarities: the similarity of the current translation option tτ(i)and its context ~c := ctxt(τ(i)) minus the similarity of ~c and the translation option which is closest to ~c, i.e., the tkwhose similarity to ~c is maximal, with k∈τocc(i). More precisely: score(i) = 0if i /∈dom(τ)∨ ¬incons(i) sim(~c, µ(tτ(i))) −max k∈τocc(i)sim(~c, µ(tk)) otherwise where sim of two vectors is the natural logarithm of their cosine similarity linearly scaled to the range [0,1], i.e.: sim(~a,~ b) = ln 1 2 ~a ·~ b k~akk~ bk+1 2!(5.1) Note that sim ranges in [−∞,0], with −∞ corresponding to the case where the vectors are diametrically opposed (semantically distant) and 0to the case where they have the same orientation (semantically close). The final SSLC score for the whole document simply adds together the individual scores: PN i=1 score(i). As a final remark, notice that for ease of presentation we have assumed that the word vector model is monolingual. If it were bilingual, the expressions like µ(tj) would be µ(tj, sτ−1(j))instead. Also, unknown words for the vector model, i.e., words wsuch that µ(w)is undefined, are ignored when computing the scores, and not taken into account when considering the C-sized context of the target words.
5.3. Lexical Consistency Change Operation 61 desk desk desk desk house house house mostrador ventanilla mesa escritorio casa c´amara casa ventanilla ventanilla ventanilla ventanilla casa c´amara casa Figure 5.2: Sketch of the behaviour of LCCO. The source document (left) has both “desk” and “house” translated into different forms (middle). LCCO selects “desk” as the inconsistent source word to fix, and chooses its second occurrence as the translation (the encircled “ventanilla”) to use in its remaining occurrences. The target document resulting from the LCCO modifications (right) has a consistent translation for “desk”. 5.3 Lexical Consistency Change Operation Intuitively, LCCO first randomly selects an inconsistently translated source word, then, randomly chooses one of its translation options used in the document, and finally, re-translates its occurrences throughout the document to match the chosen translation option (see Figure 5.2). This random behaviour is important to allow the hill climbing performed by the decoder to properly explore the neighborhood. In order to formalize LCCO we need a more refined view of the source and target documents than in Section 5.2. Nevertheless, we will reuse some of the previous definitions where possible. Since the decoder works with phrases as its minimum translation units, the documents are processed as sequences of phrases. Hence, we now consider that all the siand tjare phrases instead of words. The definition of τ is still the same as before, although we can now guarantee that it is a total bijection since the decoder works with phrase-pairs. The functions normsrc and normtgt are similar to before but have phrases as input and output instead of single words. Also, we consider that they normalize each word of the input phrase individually and, in particular, that they preserve the number of words in the phrase. The goal of LCCO is to change the translation of inconsistently translated words but, since the decoder works with phrases, we focus on only changing those inconsistent words appearing in 1-word phrases. This does not hinder our goals, as the other change operations of the decoder can resegment the data and, in this way, isolate for LCCO any inconsistent words appearing in multi-word phrases. For this reason, let us now consider a more restricted definition of occ that only deals with indexes of source phrases having a single word. That is, for any i∈ {1, . . . , N}we have: occ(i) = {j∈ {1, . . . , N} | normsrc(sj) = normsrc(si)∧ |sj|= 1} where |sj|is the number of words in the source phrase sj. Note that i /∈occ(i) = ∅if the source phrase sihas more than one word. Using this redefined occ, we can keep the same definition for τocc and incons as before. LCCO works as follows. First, it selects a source phrase index i∈ {1, . . . , N}such that incons(i)is true. This is done by uniformly drawing that ifrom the following
62 Chapter 5. Lexical Consistency in Statistical Machine Translation set: {k∈ {1, . . . , N} | incons(k)∧ ∀k0∈occ(k):(k≤k0)} where the universally-quantified condition is simply used to pick one single representative from each set occ(k), in particular, the one with the least index (although any other would work too). Using such representatives is important to guarantee that the selection is uniform on the distinct inconsistent source phrases, without biasing the selection towards the ones with most occurrences in the source document. Second, it selects a specific occurrence j∈occ(i)of that source phrase and considers tτ(j)as the translation to use in the other occurrences. This is done by uniformly drawing that j from the following set: {k∈occ(i)| ∀k0∈occ(i):(k≤k0∨normtgt(tτ(k))6=normtgt(tτ(k0)))} where the universally-quantified condition is, again, simply used to pick a single representative (the one with the least index, although any other would work too) from each subgroup of occ(i)whose corresponding target phrases have an identical normalized form. As before, the use of representatives guarantees that the selection is not biased towards the translation options with most occurrences in the document. Finally, the new document translation t0 1, t0 2, . . . , t0 Mis obtained by setting for each k∈ {1, . . . , M}: t0 k:= tkif k /∈τocc(i) tkif k∈τocc(i)∧normtgt(tk) = normtgt(tτ(j)) tkif k∈τocc(i)∧@t∈ρ(sτ−1(k)) : normtgt(t) = normtgt(tτ(j)) telse, with random t∈ρ(sτ−1(k))such that normtgt(t) = normtgt(tτ(j)) where ρmaps a source phrase to the set of target phrases that are its possible translations according to the phrase table in use by the decoder. Note that t0 kand tkcoincide in the three first cases of the definition. In the first one, this is simply because the target phrase index kis not aligned through τto any of the source phrase indexes in occ(i)that are being affected. The second and third cases do involve an affected index k, but in the second one we already have a target phrase with the same normal form as the desired tτ(j)and in the third case the phrase table has no translation option for the corresponding source phrase sτ−1(k)with the same normal form as tτ(j). In other terms, in the second case it is unnecessary to perform any change since we already have the desired translation, whereas in the third one it is not possible to perform the change. The third case would never arise if normsrc had been defined as the identity. The fourth and final case is the only one that alters the kth target phrase: it involves an affected index k, containing a translation tkwith different normal form than the desired tτ(j), and the phrase table contains some translation options for sτ−1(k)with the same normal forms as tτ(j). Thus, in this fourth case it suffices to set t0 kto a t uniformly drawn from the available options in the phrase table. 5.4 Experiments We conduct English-to-Spanish translation experiments building on the settings detailed in Chapter 4. In particular, we reuse the baseline Moses and Lehrer systems
5.4. Experiments 63 from Sections 4.3.1 and 4.4.1, respectively, and for a more complete comparison we consider again the three Lehrer system variants from Section 4.4.1 that implement the SSLM with monolingual and bilingual word embeddings. Furthermore, here we also use the same development and test sets as the ones specified there. Besides the systems inherited from the previous chapter, we introduce several new variants of Lehrer implementing the SSLC feature function and further ones with the LCCO change operation. Overall, we analyze the performance of 17 systems, comprising the standard baseline Moses from Section 4.3.1, the following 8variants of Lehrer: •the baseline Lehrer system from Section 4.4.1, •the three systems from Section 4.4.1 that implement the SSLMs within Lehrer using either the bilingual (+SSLMbi), the monolingual (+SSLMmo), or both (+SSLMbi&mo) embeddings, •two new systems implementing our SSLC feature within Lehrer using the same bilingual embeddings as the SSLMbi in Section 4.4.1 (+SSLCbi) and its combination with both SSLM features (+SSLMbi&mo+SSLCbi), and •two new systems implementing our SSLC feature using the same monolingual embeddings as the SSLMmo in Section 4.4.1 (+SSLCmo) and its combination with both SSLMs (+SSLMbi&mo+SSLCmo), and another 8new analogous variants of Lehrer+LCCO (which we denote with equivalent names). We tried several values for the context size parameter Cand decided to fix C= 15 for the experiments as a good trade off between performance and results and to assure that the context is beyond sentence scope. To avoid extra noise in the process, we use a list of stop-words that are filtered out from the scoring of the SSLC and not considered for changing by the LCCO. Thus, the scoring and changes are only applied to content words. For tuning the weights of the document-level features in the +SSLC system variants, we again resort to performing manual grid searches due to the difficulty commented in Section 4.4.1 of applying automatic methods (see Figure 5.3).2For the +LCCO variants, we additionally perform a manual grid search to optimize the weights for the change operations in use. In particular, we adjust the weights for the default change operations (change-phrase-translation, swap-phrases, and resegment) and for LCCO in the Lehrer+LCCO system, and use the resulting weights in all its variants.3 2The grid search is performed along the same lines as the one in Section 4.4.1. The resulting non-normalized weights for the document-level features in the extensions of the Lehrer system variants of Section 4.4.1 are as follows: 0.01 for the new +SSLCbi variant, 0.006 for +SSLCmo, h0.03,0.015,0.01ifor +SSLMbi&mo+SSLCbi, and h0.03,0.015,0.03ifor +SSLMbi&mo+SSLCbi. When adding LCCO, we re-tune again the document-level features, obtaining: 0.035 for +SSLMbi, 0.011 for +SSLMmo, h0.035,0.001ifor +SSLMbi&mo, 0.25 for +SSLCbi, 0.06 for +SSLCmo, h0.035,0.001,0.2ifor +SSLMbi&mo+SSLCbi, and h0.035,0.001,0.08ifor +SSLMbi&mo+SSLCbi. 3The tuned weights for the change operations are 0.45 for change-phrase-translation, 0.1for swapphrases, 0.4for resegment, and 0.05 for LCCO. For comparison, the weights for the default change operations alone, as reported by Hardmeier (2014), are 0.8for change-phrase-translation, 0.1for swap-phrases, and 0.1for resegment.
64 Chapter 5. Lexical Consistency in Statistical Machine Translation GDM 0 0.1 0.2 WP −0.4 −0.2 0 PP −0.2 0 LM 0 0.1 0.2 0.3 PT −0.1 0 0.1 0.2 SSLMbi −0.2 0 SSLMmo −0.05 0 0.05 0.1 SSLCbi −0.5 0 0.5 1 BLEU 0.1 0.15 0.2 MERT iteration 0 2 4 6 8 10 12 14 16 18 20 22 24 Figure 5.3: MERT on Lehrer, with analogous interpretation as Figure 4.3, but adding the document-level feature SSLCbi to be tuned. The process reaches its final 25th iteration without having converged. 5.4.1 Automatic Evaluation We carry out an automatic evaluation using again the Asiya toolkit (Gonzàlez et al., 2012) and the same metrics as in Section 4.4.2. In Tables 5.1 and 5.2 we show the performance of the systems. On the development set, results without LCCO show that bilingual information in SSLM appears to be more helpful than monolingual, but also seems that both kinds of models can work together to improve the final system output, as already seen in Section 4.4.2. Looking at the results for both SSLC systems, there are almost no noticeable differences with respect to baseline Lehrer. The best results have been obtained combining all the information: bilingual and monolingual SSLMs with either of the SSLCs. When introducing LCCO, we observe more or less the same trends as before, except that combining SSLC and SSLM does not seem to provide the same benefit. On the test set we observe a similar behaviour, although differences among system scores are smaller. In this occasion both SSLC appear to improve the baseline Lehrer. Note that, as in the development set, both SSLC seem to work better in combination with SSLM, even though now the trend is reversed in some of the metrics, like BLEU. As a general remark, the differences between most of the systems are not statistically significant.4Several causes contribute to this effect. On the one hand, a pairwise 4According to bootstrap resampling (Koehn, 2004) over BLEU and NIST metrics with a p-value
5.4. Experiments 65 System WER↓PER↓TER↓BLEU↑NIST↑METEORpa↑ULC↑ Moses 64.17 43.10 58.28 24.27 6.8264 46.84 49.96 Lehrer 64.30 43.34 58.34 24.28 6.8199 46.92 49.84 +SSLMbi 64.05 42.90 58.08 24.35 6.8451 46.93 50.26 +SSLMmo 64.21 43.18 58.28 24.27 6.8272 46.89 49.95 +SSLMbi&mo 63.96 42.83 58.01 24.36 6.8535 46.91 50.35 +SSLCbi 64.33 43.36 58.38 24.26 6.8165 46.90 49.79 +SSLCmo 64.34 43.34 58.37 24.24 6.8182 46.91 49.79 +SSLMbi&mo+SSLCbi 63.91 42.79 57.99 24.39 6.8607 46.95 50.43 +SSLMbi&mo+SSLCmo 63.93 42.79 57.99 24.37 6.8629 46.95 50.42 Lehrer+LCCO 64.30 43.33 58.36 24.27 6.8194 46.92 49.83 +SSLMbi 63.99 42.85 58.04 24.38 6.8489 46.94 50.34 +SSLMmo 64.23 43.21 58.29 24.27 6.8247 46.91 49.93 +SSLMbi&mo 63.98 42.84 58.04 24.35 6.8480 46.92 50.32 +SSLCbi 64.30 43.31 58.36 24.25 6.8189 46.89 49.81 +SSLCmo 64.29 43.32 58.35 24.27 6.8194 46.91 49.84 +SSLMbi&mo+SSLCbi 64.00 42.85 58.06 24.34 6.8460 46.93 50.30 +SSLMbi&mo+SSLCmo 63.99 42.80 58.03 24.36 6.8510 46.92 50.35 Table 5.1: Automatic evaluation of the systems on the development set. The ULC is computed over the other metrics of the table. System WER↓PER↓TER↓BLEU↑NIST↑METEORpa↑ULC↑ Moses 59.54 39.95 53.70 27.52 7.3229 50.02 49.91 Lehrer 59.67 39.72 53.78 27.58 7.3127 50.08 49.98 +SSLMbi 59.38 39.84 53.49 27.60 7.3491 50.13 50.21 +SSLMmo 59.58 39.83 53.70 27.57 7.3194 50.07 49.99 +SSLMbi&mo 59.37 39.97 53.49 27.48 7.3436 50.10 50.06 +SSLCbi 59.63 39.75 53.77 27.61 7.3152 50.07 50.00 +SSLCmo 59.66 39.74 53.78 27.59 7.3125 50.07 49.98 +SSLMbi&mo+SSLCbi 59.36 39.96 53.50 27.50 7.3436 50.07 50.07 +SSLMbi&mo+SSLCmo 59.36 39.96 53.51 27.51 7.3470 50.08 50.08 Lehrer+LCCO 59.67 39.76 53.77 27.57 7.3081 50.07 49.94 +SSLMbi 59.32 39.88 53.45 27.61 7.3518 50.14 50.24 +SSLMmo 59.60 39.79 53.71 27.58 7.3195 50.09 50.01 +SSLMbi&mo 59.29 39.86 53.43 27.60 7.3554 50.15 50.27 +SSLCbi 59.70 39.75 53.81 27.59 7.3097 50.07 49.94 +SSLCmo 59.63 39.76 53.77 27.59 7.3114 50.07 49.97 +SSLMbi&mo+SSLCbi 59.32 39.89 53.46 27.57 7.3508 50.12 50.20 +SSLMbi&mo+SSLCmo 59.35 39.90 53.47 27.57 7.3481 50.12 50.18 Table 5.2: Automatic evaluation of the systems on the test set. The ULC is computed over the other metrics of the table.
66 Chapter 5. Lexical Consistency in Statistical Machine Translation comparison of all the system outputs shows that the amount of different sentences is only between 8% and 42%. On the other hand, SSLC and LCCO deal with very sparse phenomena, and thus, they cannot have a huge impact on the automatic metrics. For instance, in average, LCCO is applied on 8% of the documents5on the development and test sets, and in those cases it comprises between 4% and 9% of the total amount of change operation applications.6Nevertheless, this does not necessarily hinder our goals, as consistent lexical selection improvements can also be introduced by the default change operations (although taking more search steps in decoding than LCCO, as the latter performs several modifications at once), which are promoted by SSLC. These results make necessary a human evaluation of the translations, since we expect that the few changes induced by SSLC and LCCO will be appreciated by humans. 5.4.2 Human Evaluation We carry out two distinct evaluation tasks. The first one tries to assess the quality of the different systems, working with and without LCCO. The second one is a small document-level evaluation task that compares the adequacy of the lexical choices between pairs of system variants that differ on whether they use LCCO or not. For the first evaluation task, we select a common subset of sentences from the test set translated by the Moses system and by the 8variants of the Lehrer system. More precisely, we randomly choose 100 sentences with at least 5and at most 30 words, and with at least 3different translations among all the considered system outputs. We set up an evaluation environment where 3native Spanish annotators with a high English level have been asked to rank the output of all the systems for each of the 100 selected sentences, from best to worst general translation quality and with possible ties. System outputs were presented in random order to avoid system identification. The same evaluation procedure is also carried out with the 8 variants of Lehrer+LCCO. Table 5.3 shows the results obtained, where each entry of the table contains the mean number of times that the row system is better/worse than the column system according to the annotators, the remainder being ties. For the ranking with Lehrer variants, the annotators agreed 70% of the time when ranking two distinct outputs, and for Lehrer+LCCO, they agreed 72% of the time,7 respectively reaching κ= 0.4362 and κ= 0.4623 (Fleiss, 1971) showing in both cases a “moderate” inter-annotator agreement (Landis and Koch, 1977). of 0.05. In particular, the only statistical differences found are between Lehrer+LCCO and its variants +SSLMbi and +SSLMbi&mo and, additionally, between its variant +SSLMbi&mo and the variants +SSLCbi and +SSLCmo. 5The LCCO is, in fact, applied on all the documents multiple times, but most applications are unsuccessful (i.e., unable to improve the score, and thus, rejected by the hill climbing). The reported amount corresponds to the percentage of documents where there has been, at least, one successful application of LCCO during the translation process. 6Similarly to the previous footnote, the two reported percentages are computed over the successful applications of the change operations only, disregarding the vast majority of the unsuccessful ones. 7These agreements are computed as follows. For each pair of annotators, for each pair of systems, and for each sentence in the sample where the two systems have produced distinct output, we consider that the annotators agree if they have given the same relative ranking to both outputs, otherwise they disagree. The reported amounts are simply the percentage of agreements among the total.
5.4. Experiments 67 ID System 1 2 3 4 5 6 7 8 9 1Moses - 39 / 39 44 / 43 35 / 45 38 / 48 37 / 41 43 / 39 36 / 47 40 / 46 2Lehrer 39 / 39 - 28 / 32 24 / 28 37 / 40 11 / 14 14 / 11 35 / 45 34 / 44 3+SSLMbi 43 / 44 32 / 28 -36 / 33 34 / 34 33 / 34 37 / 29 23 / 34 23 / 34 4+SSLMmo 45 / 35 28 / 24 33 / 36 - 31 / 35 31 / 30 32 / 26 27 / 38 26 / 39 5+SSLMbi&mo 48 / 38 40 / 37 34 / 34 35 / 31 -42 / 36 44 / 36 18 / 27 20 / 25 6+SSLCbi 41 / 37 14 / 11 34 / 33 30 / 31 36 / 42 - 13 / 8 34 / 43 36 / 45 7+SSLCmo 39 / 43 11 / 14 29 / 37 26 / 32 36 / 44 8 / 13 - 31 / 47 33 / 47 8+SSLMbi&mo+SSLCbi 47 / 36 45 / 35 34 / 23 38 / 27 27 / 18 43 / 34 47 / 31 -21 / 18 9+SSLMbi&mo+SSLCmo 46 / 40 44 / 34 34 / 23 39 / 26 25 / 20 45 / 36 47 / 33 18 / 21 - ID System 1 2 3 4 5 6 7 8 9 1Moses -40 / 38 44 / 45 39 / 43 41 / 49 36 / 40 39 / 40 40 / 46 44 / 42 2Lehrer+LCCO 38 / 40 - 32 / 40 23 / 32 28 / 38 14 / 19 13 / 19 31 / 41 35 / 38 3+SSLMbi 45 / 44 40 / 32 - 38 / 39 21 / 26 40 / 36 36 / 36 21 / 28 24 / 26 4+SSLMmo 43 / 39 32 / 23 39 / 38 - 36 / 37 31 / 27 32 / 26 34 / 36 37 / 36 5+SSLMbi&mo 49 / 41 38 / 28 26 / 21 37 / 36 -39 / 34 40 / 35 18 / 24 22 / 23 6+SSLCbi 40 / 36 19 / 14 36 / 40 27 / 31 34 / 39 - 16 / 13 35 / 40 36 / 35 7+SSLCmo 40 / 39 19 / 13 36 / 36 26 / 32 35 / 40 13 / 16 - 37 / 44 37 / 37 8+SSLMbi&mo+SSLCbi 46 / 40 41 / 31 28 / 21 36 / 34 24 / 18 40 / 35 44 / 37 -21 / 19 9+SSLMbi&mo+SSLCmo 42 / 44 38 / 35 26 / 24 36 / 37 23 / 22 35 / 36 37 / 37 19 / 21 - Table 5.3: The two pairwise system comparisons done in the human evaluation. Each entry is the mean % of times a row system is evaluated better/worse than the column system (in bold if the better times are more than the worse ones). From the results in Table 5.3, we can say that Lehrer and Lehrer+LCCO are equivalent to Moses: they have a few ties, and either system is considered better than the other in roughly the same amount of cases. On the other hand, most non-baseline variants of Lehrer and Lehrer+LCCO surpass Moses on wins. Translations from the systems including the combination of several features appear to be preferred in general; for instance, annotators prefer the combination SSLMbi&mo over SSLMbi or SSLMmo alone. Another interesting detail is that the SSLC systems seem analogous to the corresponding Lehrer and Lehrer+LCCO baselines, as they have many ties (although the SSLC systems have a slight advantage on wins). Also, SSLCbi and SSLCmo seem analogous, with SSLCbi having a slight win advantage over SSLCmo. This fact shows that bilingual information has helped SSLC more than monolingual information. Both combinations of SSLMbi&mo with either of the SSLCs also seem analogous. As final remarks, the SSLMbi&mo+SSLCbi variants of Lehrer and Lehrer+LCCO systematically beat the other systems, and the non-baseline Lehrer and Lehrer+LCCO variants beat their respective baseline variant (except for Lehrer+SSLCmo). The second, small evaluation task is a comparison between three system pairs with and without LCCO: the baseline, +SSLCbi, and +SSLMbi&mo+SSLCbi variants of Lehrer against the analogous variants of Lehrer+LCCO. We selected 10 documents with lexical changes introduced by LCCO, and asked an annotator to choose the translation with best lexical consistency and adequacy, given the source and two translated documents obtained by a system pair. The annotator preferred the translations of the variants with LCCO 60% of the time, and 20% of the time considered the translations of either system to have the same quality. So, systems with LCCO provided better translations according to the annotator regarding lexical consistency
74 Chapter 6. Document-Aware Neural Machine Translation Decoding where ~ ST M tis the output of the translation model projection layer before softmax. Thus, PostNorm combines the ~ ST M ttransformed into a probability distribution via a softmax with the LM probabilities, whereas PreNorm applies normalization after combining ~ ST M twith the logarithmic probabilities of the LM. In contrast to deep or cold fusion, simple fusion benefits from not needing a gating network to balance the translation and language models. However, it proposes a more sophisticated model than the one of shallow fusion, since a translation model in simple fusion has to be trained with a fixed LM. The shallow fusion approach allows to use different LMs depending on the domain of the document to translate, without the need to change the base translation model or conduct a new training process. 6.1.2 Shallow Fusion of an NMT System and an SSLM The extension of the NMT decoding process at document level we propose through this section benefits from the shallow fusion technique. In particular, it exploits the flexibility of being able to combine a general NMT model with a more domain specific language model to guide the NMT system towards a more adequate translation. In our approach, this other model is an SSLM used to introduce inter-sentence context information into the NMT decoding process. An additional advantage of shallow fusion is that it is one of the less time consuming fusion techniques in terms of training time, since it only needs to adjust the λweight for the language model by a gridsearch on development data, avoiding a long training on a large amount of data. Furthermore, this technique can be easily applied to any NMT model, either RNN- based or purely attention-based neural models. Formally, we substitute the language model probability pLM (y)in the decoding function of shallow fusion by the SSLM associated probability (cf. Equation 6.2): ˆy= arg max ylog p(y|x) + λlog pSSLM (y) where pSSLM (y)represents the probability that the SSLM model estimates for a generated sentence y. That probability is the product of the individual probabilities associated by SSLM to each of the words of y, which we compute as detailed in Equation 4.1 when psimilarity is defined as a linear scale from the range [−1,1] to the range [0,1] (cf. Equation 5.1, where that scale has an additional ln). Since SSLM requires the preceding context ~cytof the next word ytto be generated in order to estimate its probability, we need to modify the beam search of the NMT decoding that produces the translation of a sentence. We implement a cache mechanism to take into account the context information from the previously generated words, extending beyond sentence boundaries. In particular, the cache allows to add together the word embeddings from the previously generated words to obtain ~cyt. However, the NMT model requires not only an estimate for a given target word, but a distribution probability over the entire target vocabulary space. Thus, it must be computed for each word yiin the target vocabulary. Unfortunately, such an approach would have a high computational cost. Following the ranking/filtering approaches of Jean et al. (2015) and Wang et al. (2017b), we speed up this computation by filtering the words to score by the SSLM. In particular, it is only computed on the N
6.2. Experiments 75 El de mostrador cerrado . está Theinformation desk is closed. Source información SSLMNMT λ escritorio mesa ventanilla recepción asistencia pupitre banco caja 0.3 0.2 0.18 0.16 0.12 0.07 0.05 0.04 0.03 0.6 0.30 0.05 0.1 0.1 0.175 0.21 0.23 SCORE mostrador 0.15 0.7 0.36 Figure 6.3: Sketch of the shallow fusion of an SSLM and an NMT inside the beam search algorithm. In this example, the process re-scores the N= 5 best candidates from the NMT model using the scores from the SSLM. target words with the highest probabilities from the NMT model, that is, only the Nbest candidates from the NMT model are considered by the SSLM. Figure 6.3 depicts how the filtering process works in combination with the shallow fusion of the NMT and the SSLM models during the beam search. As a final remark, notice that although our system does not need any document-level annotation, it will understand any set of sentences in its input as a document. 6.2 Experiments 6.2.1 Settings Our baseline NMT model follows the encoder-decoder architecture with attention of Bahdanau et al. (2015) and it is built using the OpenNMT-lua toolkit (Klein et al., 2017). We use a 4-layered bidirectional RNN encoder and a 4-layered RNN- based decoder with 800-dimensional hidden layers. Word embeddings are set to 500 dimensions for both source and target vocabularies. Stochastic gradient descent is used as optimizer algorithm for training, setting an initial learning rate of 1and a learning decay of 0.7after epoch 10 or if there is no loss improvement over the validation set. Training data is distributed on batches of 64 sentences and we use a 0.3dropout probability between recurrent layers. Finally, a maximum sentence length of 50 tokens is used for both source and target sides and the vocabulary size is 50,000 for both target and source languages. The system is trained on the Europarl-v7 parallel corpus, analogously to the SMT baseline system from Section 4.3.1, using the newsCommentary2009 corpus as validation set. The system at epoch 20 is to be shallow fused with the SSLM.
76 Chapter 6. Document-Aware Neural Machine Translation Decoding We implement the shallow fusion of the SSLM and an NMT as an extension of the attentional encoder-decoder NMT baseline. The SSLM is the one we described and used in Section 4.4.1 with monolingual Spanish data. We use newsCommentary2011 as test set. 6.2.2 Analysis with Oracles We implement three oracles to assess the potential impact of our techniques. The oracles behave as our fused approach, but leverage the reference translation to bias the decoding towards the word choices that are present in the reference. The goal of Oracle1 and Oracle2 is to assess the utility of the information enclosed in the Word Vector Model (WVM) used by the SSLM, i.e., to check whether the semantic information of SSLM can help in producing better translations. Oracle3 mimics our fused decoding approach and its goal is to evaluate the potential gain of using an SSLM in combination with an NMT. In other words, with Oracle3 we check how much the SSLM can help the NMT disambiguate between its best translation candidates, thus obtaining an upper bound for the improvements that can be achieved by shallow fusing an SSLM and an NMT system. Oracle1 proceeds offline as follows: once a sentence has been translated, for each target word tit (i) uses the attention information to map that tto its corresponding source word sand, in turn, maps that sto its corresponding target word rfound in the reference, and (ii) it replaces the target word tby rwhenever t6=rand, furthermore, ris among the Mwords that are closest to t(with respect to cosine similarity) according to our WVM. Note that the use of attention in step (i) to map between target and source words is not as straightforward as the alignment information in an SMT system. In particular, we consider that a target word tand a source word s are one-to-one mapped, denoted t1 ←→ s, when the following holds: the attention from tto sis maximal among the attentions from that tto any source word s0and also among the attentions from any target word t0to that s, i.e., t1 ←→ sif and only if att(t, s) = max{att(t0, s0) : t0=t∨s0=s}, where att(., .)denotes the attention value between two words. We use an analogous definition for the one-to-one mapping s1 ←→ r between the source and reference words. Thus, for the target word tin consideration, step (i) tries to find the word rof the reference satisfying t1 ←→ s1 ←→ r, for some source word s. Table 6.1 and Figure 6.4 show the results for Oracle1. We observe that the WVM encodes semantically-valid candidates close together, as there is a noticeable improvement in the BLEU score even when considering just the M= 5 closest candidates. Also, the accuracy of the oracle’s translations increases with the number Mof considered closest words. This is expected since augmenting the number Malso increases the coverage of the target vocabulary. In the limit, when Mallows to encompass the whole 50K-word vocabulary, Oracle1 simply rewrites the translation into the reference as far as the attention information allows, reaching an increase of +8.02 in BLEU score. Oracle2 works as Oracle1 but proceeds online with the beam search. That is, when a hypothesis of the beam is to be extended with a new target word t, the oracle (i) analyzes the attention information to identify the actual word rused in the
6.2. Experiments 77 M=5 M=10 M=50 M=100 M=1,000 baseline BLEU 30 32 34 36 38 40 a 0.2 0.4 0.6 0.8 N=3 N=4 N=5 N=7 N=10 N=50 baseline BLEU 26 28 30 32 34 a 0.2 0.4 0.6 0.8 Figure 6.4: BLEU score of Oracle1 (left, bullets), Oracle2 (left, line plots), and Oracle3 (right, line plots), as a function of the threshold a(Oracle2 and Oracle3) and for several values of the parameters M(Oracle1 and Oracle2) and N(Oracle3). For Oracle1 and Oracle2, increasing the value of Mbeyond 1,000 does not affect the obtained scores noticeably. System BLEU↑METEOR↑N M a baseline 30.77 49.86 - - - Oracle1 38.79 57.85 - 1,000 - Oracle2 37.32 54.35 - 1,000 0.1 Oracle3 33.25 51.74 3 - 0.2 Table 6.1: Automatic evaluation of the oracle systems, together with the value used for their respective parameters. reference to translate the source word sthat tcorresponds to and (ii) replaces twith runder the same circumstances as before (i.e., when t6=rand rappears in the list of Mwords closest to taccording to our WVM). In this occasion, however, the attention information needed in step (i) to deduce the one-to-one mappings between the target and source is not fully available, as the target sentence is still being generated. For this reason, we need to add a minimal threshold afor the attention and refine our criterion as t1,a ←→ sif and only if t1 ←→ s∧att(t, s)≥a. Thus, for the target word tin consideration, step (i) tries to find the word rof the reference satisfying t1,a ←→ s1 ←→ r, for some source word s. Table 6.1 and Figure 6.4 present also the results for Oracle2. The results are analogous to those of Oracle1, but with lower scores. This difference of score between both oracles is almost negligible for the smallest values of Mand a, but the distance widens as either Mor aincreases. This shows that our definition of 1,a ←→ is a proper approximation to obtain the mappings when not having the full attention information, as the permissive value a= 0.1does not seem to be affected by noisy alignments for low values of M. This is because the oracle only replaces words by other semantically-close words (e.g., by synonyms), and thus, each of the substitutions preserves the meaning of the replaced word even if in some occasions the
78 Chapter 6. Document-Aware Neural Machine Translation Decoding computed alignment is not adequate. Conversely, by increasing Mthe oracle handles lists of candidates that are more semantically distant, and thus, in combination with the uncertainty of the alignments, the system introduces more errors. Oracle3 proceeds online with the beam search like Oracle2, just differing on the criterion used to replace the target word tby the corresponding reference word r: the replacement is done when t6=rand, moreover, rappears among the Nbest candidates proposed by the NMT model. Note that this oracle does not use in any way the WVM underlying the SSLM: it simply assumes that such model will properly promote the correct word (i.e., the reference word) whenever it is present among the Ntop candidates of the NMT. Table 6.1 and Figure 6.4 present also the results for Oracle3, which show that there is some margin for improvement for the fused system with respect to the NMT working in isolation. In contrast with Oracle2,Oracle3 produces more errors the more candidates that it considers, i.e., the greater the value of Nis. Also, considering alignments with lower probabilities only helps when the value of Nis small. In particular, considering more candidates by increasing Nneeds a stronger (i.e., higher) attention threshold ain order to filter out noisy substitutions. Nevertheless, in that more restrictive configuration of a, the results for the various values of Ntend to converge. In summary, Oracle1 shows that the WVM of the SSLM properly clusters semantically-valid candidates close together, Oracle2 that incomplete attention information does not hinder the oracle’s ability to approximate the alignments, and Oracle3 that there is a wide enough margin for improvement when fusing the systems. 6.2.3 Results Our system has two main hyperparameters: the number Nof NMT translation options that are used in the fusion, and the weight of the semantic language model λ. Table 6.2 and Figure 6.5 show the results of the automatic evaluation of the different variations of the presented fused system. The figure shows how the maximum quality is achieved around λ= 0.15, independently of the number Nof re-scored candidates. All of our systems are able to improve the baseline for every value of Nthat we explored, achieving a statistically significant improvement of +0.23 in BLEU score and +0.31 in METEOR. Nevertheless, there is still room for further gains since, as seen in Table 6.1, Oracle3 is able to increase +2.48 BLEU and +1.88 METEOR points. We observe in Table 6.2 that the scores improve as long as we increase the value of Nuntil it seems to stabilize for N≥4. Furthermore, comparing the outputs for λ= 0.15, the translations that the system produces with N= 4 only differ in 95 sentences with respect to those for N= 5 and in 107 for N= 7, while having 1,407 sentences out of 3,003 that differ with respect to the baseline. Also, the translations for N= 5 are almost exactly the same as with N= 7, differing only in 30 sentences, whereas the translations for N= 7 and N= 10 coincide. These facts support that the systems with N≥4are converging towards an equivalent output. Looking into these differences, we realize that they manage different synonyms that may or not be in the reference. Like translating “I have to” as “Tengo” or “Voy a tener” which can be equivalent depending on the context.
6.2. Experiments 79 N=2 N=3 N=4 N=5 N=7 baseline BLEU 30.2 30.4 30.6 30.8 31 λ 0.05 0.1 0.15 0.2 0.25 Figure 6.5: BLEU score of the fused system as a function of the weight λ, for several values of the parameter N. NBLEU↑METEOR↑#unknown - 30.77 49.86 5901 2 30.88 50.17 4632 3†30.98 50.14 4501 4†31.00 50.15 4475 5†31.00 50.14 4459 7†31.00 50.14 4463 10 †31.00 50.14 4463 Table 6.2: Automatic evaluation of the fused systems for varying values of the parameter Nand with λ= 0.15, together with the amount of unknown words in their output. The first row corresponds to the baseline. †marks systems that are significantly different to the baseline with a p-value of 0.05, according to bootstrap resampling (Koehn, 2004). We also observe that with larger values of N, the translations tend to be noisier or less adequate with respect to the source. For instance, “Offices need a kindergarten nearby, architects have understood.” is translated as: “las Oficinas necesitan una guardería cercana, los arquitectos han comprendido” (N=4) “las oficinas de las oficinas de asistencia necesitan una guardería cercana.” (N=7) Notice in the second one the useless repetition of the translation for “Offices” and the appearance of the extra concept of assistance (“asistencia”) that does not appear in the source sentence. Also, the information regarding the architects is missing in the second translation. Two important error types in NMT systems, word omission and new word creation, are exacerbated with large values for N. Another example of more accurate translation occurs when translating “According to Meteo France”. The best system using N≥5translates this as “Según Francia” losing the reference to the meteorological company. In contrast, using N= 4, the
80 Chapter 6. Document-Aware Neural Machine Translation Decoding system is able to generate a more accurate translation “Según Meteo Francia”. This analysis reflects the noise introduced by increasing the number of re-scored translation candidates by the system. In other words, it is important to have enough candidates to see more adequate translations, but there is a trade-off that the system needs to maintain between the number of new options and the noise introduced by these re-scored options. Finally, we observe that the increase in the translation quality is also related to the decrease in the number of unknown words generated by the system. Since we use complete tokens without BPE (Sennrich et al., 2016) or SentencePiece (Kudo and Richardson, 2018) as translation units, several tokens are unknowns to the system. In general, the number of generated unknown words with the shallow fusion approach drops almost a 25% with respect to the unknown words generated by the baseline. For instance, the worst case-scenario sentence “I’m rather a novice in Prague politics responded Lukas Kaucky.” is translated by the baseline as: “Más bien soy un hunkien la política de Praga, hunkia Lucas hunki.” whereas our fused system is able to produce: “Más bien soy un novato en la política de Praga, respondió a Lucas hunki.” generating good translations for “novice” and “responded”. These examples illustrate how fusing the SSLM with the NMT model helps the latter to disambiguate between the considered translation candidates for a word. Finally, we pursue a little manual evaluation with 3native-Spanish speakers with fluent English. We select a common subset of sentences from the test set translated by the baseline NMT and by the fused system with N= 4 and λ= 0.15. We randomly choose 100 sentences with at least 5and at most 30 words with different translations. The annotators were asked for each of the 100 selected sentences to rank the output of both systems according to their general translation quality, allowing to rank them as tying. System outputs were presented in random order to avoid system identification. The annotators find 49% of the time that the translation from the fused system is better than the baseline, and they consider the quality of both translations to tie 19% of the time. They agreed 67% of the time, reaching a κ= 0.4733 (Fleiss, 1971) showing a “moderate” inter-annotator agreement (Landis and Koch, 1977). These results support that fused systems are able to improve the translations’ quality. 6.3 Conclusions We have presented a new approach that extends NMT decoding by introducing information from the preceding context on the target side. It fuses an attentional RNN with an SSLM by modifying the computation of the final score for an element of the target vocabulary inside the beam search algorithm. It is a flexible approach since it is compatible with any NMT architecture, and it allows to combine pre-trained models. A preliminary, positive assessment of the potential improvement in the translation quality when introducing target context semantics has been conducted with oracles. The final validation of the implemented systems has resulted in improvements in the
6.3. Conclusions 81 BLEU and METEOR scores of up to +0.23 and +0.31, respectively, for English-to- Spanish translations. We have analyzed the impact of the different parameters of the system on these scores, observing that it is important to maintain a trade-off between the number of re-scored candidates, the SSLM weight, and the noise that will be introduced in the final translations. It is remarkable that our systems are able to propose valid translations where the baseline fails to choose one, making the number of unknown words drop while the translation quality increases. Also, a small manual evaluation has shown that humans tend to prefer the fused system outputs.
Chapter 7 Conclusions Through this thesis, we explored several techniques to enhance MT systems by introducing global context information from a document. We began by analyzing the most notable translation errors related to documentlevel phenomena and developed the set of post-processing strategies described in Chapter 3. In particular, these post-processes try to correct disagreements of gender and number and to improve lexical consistency over a preliminary full-document translation generated by an SMT system. These simple approaches showed the benefits of using document context information to promote correct translations according to the final users’ criterion, even if not to the evaluation of the automatic metrics. A drawback of using a two-pass decoding strategy is that it limits the attainable performance. Furthermore, the post-processes require a set of additional NLP tools, like the ones included in FreeLing or the coreference resolutor RelaxCor, that are language-dependant and too resource-hungry to adapt to online decoding. Our next step was to explore a set of methods to tackle this kind of document-level phenomena at translation time. We looked for a technique that would allow us to introduce the semantics from the context into the decoding process. Word embeddings emerged in the field as a solution to manage document semantics. Our analysis of these models, discussed in Chapter 4, proved that they can be helpful in the task of maintaining lexical choice consistency through the translation of a document by modeling the context of the words. This was especially so with the models having bilingual tokens. Additionally, we introduced the studied word embedding models inside the decoding process of the Lehrer document-oriented SMT decoder as the basis for Semantic Space Language Models. SSLMs capture the previous context for each word in a document and measure the deviation between the current word and its preceding context, promoting translations with consistent semantics. However, the integration of this information at decoding time did not show significant improvements according to the automatic evaluation metrics. We further analyzed these systems in Chapter 5, together with two new document-level strategies designed to aid MT systems to produce more coherent translations by improving their lexical consistency. 83
90 Bibliography Michael Denkowski and Alon Lavie. Challenges in predicting machine translation utility for human post-editors. In Proceedings of the 10th Biennial Conference of the Association for Machine Translation in the Americas (AMTA), 2012b. Cited on page 27. Jacob Devlin, Rabih Zbib, Zhongqiang Huang, Thomas Lamar, Richard Schwartz, and John Makhoul. Fast and robust neural network joint models for statistical machine translation. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (ACL) – Volume 1, pages 1370–1380, 2014. Cited on page 17. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pretraining of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), pages 4171–4186, 2019. Cited on pages 45 and 85. Luis Fernando D’Haro, Rafael E. Banchs, Chiori Hori, and Haizhou Li. Automatic evaluation of end-to-end dialog systems with adequacy-fluency metrics. Computer Speech & Language, 55:200–215, 2019. Cited on page 28. Teun Adrianus van Dijk. Text and context: Explorations in the semantics and pragmatics of discourse. Number 21 in Longman Linguistics Library. Longman, 1977. Cited on page 8. Shuoyang Ding, Kevin Duh, Huda Khayrallah, Philipp Koehn, and Matt Post. The JHU machine translation systems for WMT 2016. In Proceedings of the First Conference on Machine Translation (WMT), pages 272–280, 2016. Cited on page 20. George Doddington. Automatic evaluation of machine translation quality using ngram co-occurrence statistics. In Proceedings of the 2nd International Conference on Human Language Technology Research (HLT), pages 138–145, 2002. Cited on pages 27 and 29. Marco Dorigo and Christian Blum. Ant colony optimization theory: A survey. Theoretical Computer Science, 344(2-3):243–278, 2005. Cited on page 25. Marco Dorigo, Vittorio Maniezzo, and Alberto Colorni. Ant system: Optimization by a colony of cooperating agents. IEEE Transactions on Systems, Man, and Cybernetics – Part B, 26(1):29–41, 1996. Cited on page 24. Ameur Douib, David Langlois, and Kamel Smaïli. Genetic-based decoder for statistical machine translation. In Proceedings of the 17th International Conference on Intelligent Text Processing and Computational Linguistics (CICLing) – Part II,
Bibliography 91 pages 101–114, 2016. Cited on pages 22 and 85. Cristina España-Bonet, Dana Ruiter, and Josef van Genabith. UdS-DFKI participation at WMT 2019: Low-resource (en–gu) and coreference-aware (en–de) systems. In Proceedings of the Fourth Conference on Machine Translation (WMT) – Volume 2: Shared Task Papers, pages 382–389, 2019. Cited on page 27. Thierry Etchegoyhen, Eva Martínez Garcia, Andoni Azpeitia, Gorka Labaka, Iñaki Alegria, Itziar Cortes Etxabe, Amaia Jauregi Carrera, Igor Ellakuria Santos, Maite Martin, and Eusebi Calonge. Neural machine translation of Basque. In Proceedings of the 21st Annual Conference of the European Association for Machine Translation (EAMT), pages 139–148, 2018. Cited on page 20. Joseph L. Fleiss. Measuring nominal scale agreement among many raters. Psychological Bulletin, 76(5):378–382, 1971. Cited on pages 66 and 80. Peter W. Foltz, Walter Kintsch, and Thomas K. Landauer. The measurement of textual coherence with latent semantic analysis. Discourse Processes, 25(2–3):285– 307, 1998. Cited on page 50. Mikel L. Forcada and Ramón P. Ñeco. Recursive hetero-associative memories for translation. In Biological and Artificial Computation: From Neuroscience to Technology, Proceedings of the 4th International Work-Conference on Artificial and Natural Neural Networks (IWANN), pages 453–462, 1997. Cited on page 17. Salvador García and Francisco Herrera. An extension on “Statistical comparisons of classifiers over multiple data sets” for all pairwise comparisons. Journal of Machine Learning Research, 9:2677–2694, 2008. Cited on page 117. Jesús Giménez and Lluís Màrquez. Heterogeneous automatic MT evaluation through non-parametric metric combinations. In Proceedings of the Third International Joint Conference on Natural Language Processing (IJCNLP), pages 319–326, 2008. Cited on page 30. Jesús Giménez and Lluís Màrquez. Asiya: An open toolkit for automatic machine translation (meta-)evaluation. The Prague Bulletin of Mathematical Linguistics, 94:77–86, 2010. Cited on pages 28 and 37. Jesús Giménez, Lluís Màrquez, Elisabet Comelles, Irene Castellón, and Victoria Arranz. Document-level automatic MT evaluation based on discourse representations. In Proceedings of the Joint Fifth Workshop on Statistical Machine Translation and
92 Bibliography MetricsMATR (WMT@ACL), pages 333–338, 2010. Cited on page 85. Zhengxian Gong, Min Zhang, and Guodong Zhou. Cache-based document-level statistical machine translation. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 909–919, 2011. Cited on page 21. Meritxell Gonzàlez, Jesús Giménez, and Lluís Màrquez. A graphical interface for MT evaluation and error analysis. In Proceedings of the 50th Association for Computational Linguistics (ACL), System Demonstrations, pages 139–144, 2012. Cited on pages 28, 37, 54, and 64. Liane Guillou. Improving pronoun translation for statistical machine translation. In Proceedings of the Student Research Workshop at the 13th Conference of the European Chapter of the Association for Computational Linguistics (EACL), pages 1–10, 2012. Cited on page 21. Çaˇglar Gülçehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, Loïc Barrault, Huei-Chi Lin, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. On using monolingual corpora in neural machine translation. CoRR, abs/1503.03535, 2015. URL http: //arxiv.org/abs/1503.03535. Cited on page 70. Çaˇglar Gülçehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, and Yoshua Bengio. On integrating a language model into neural machine translation. Computer Speech & Language, 45:137–148, 2017. Cited on pages 70, 71, and 72. Michael Alexander Kirkwood Halliday and Ruqaiya Hasan. Cohesion in English. Number 9 in English Language Series. Longman, 1976. Cited on page 8. Christian Hardmeier. Discourse in Statistical Machine Translation. PhD thesis, Uppsala Universitet, 2014. Cited on pages 24, 52, 63, and 85. Christian Hardmeier and Marcello Federico. Modelling pronominal anaphora in statistical machine translation. In Proceedings of the 7th International Workshop on Spoken Language Translation (IWSLT), pages 283–289, 2010. Cited on page 21. Christian Hardmeier, Joakim Nivre, and Jörg Tiedemann. Document-wide decoding for phrase-based statistical machine translation. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (EMNLP-CoNLL), pages 1179–1190, 2012. Cited on pages 9, 22, 24, 25, 50, 51, 57, 108, and 112.
Bibliography 93 Christian Hardmeier, Sara Stymne, Jörg Tiedemann, and Joakim Nivre. Docent: A document-level decoder for phrase-based statistical machine translation. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics: System Demonstrations (ACL), pages 193–198, 2013. Cited on pages 22 and 114. Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, Shujie Liu, Tie-Yan Liu, Renqian Luo, Arul Menezes, Tao Qin, Frank Seide, Xu Tan, Fei Tian, Lijun Wu, Shuangzhi Wu, Yingce Xia, Dongdong Zhang, Zhirui Zhang, and Ming Zhou. Achieving human parity on automatic Chinese to English news translation. CoRR, abs/1803.05567, 2018. URL http: //arxiv.org/abs/1803.05567. Cited on pages 7 and 9. Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. Cited on page 18. John H. Holland. Genetic algorithms and the optimal allocation of trials. Society for Industrial and Applied Mathematics Journal on Computing (SICOMP), 2(2): 88–105, 1973. Cited on page 22. Mark Hopkins and Jonathan May. Tuning as ranking. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1352–1362, 2011. Cited on page 15. Paul Jaccard. The distribution of the flora in the alpine zone. New Phytologist, 11 (2):37–50, 1912. Cited on page 29. Sébastien Jean and Kyunghyun Cho. Context-aware learning for neural machine translation. CoRR, abs/1903.04715, 2019. URL http://arxiv.org/abs/1903. 04715. Cited on page 26. Sébastien Jean, Orhan Firat, Kyunghyun Cho, Roland Memisevic, and Yoshua Bengio. Montreal neural machine translation systems for WMT’15. In Proceedings of the Tenth Workshop on Statistical Machine Translation (WMT), pages 134–140, 2015. Cited on page 74. Sébastien Jean, Stanislas Lauly, Orhan Firat, and Kyunghyun Cho. Does neural machine translation benefit from larger context? CoRR, abs/1704.05135, 2017. URL http://arxiv.org/abs/1704.05135. Cited on page 26.
94 Bibliography Marcin Junczys-Dowmunt. Microsoft translator at WMT 2019: Towards large-scale document-level neural machine translation. In Proceedings of the Fourth Conference on Machine Translation (WMT) – Volume 2: Shared Task Papers, pages 424–432, 2019. Cited on page 27. David Kauchak and Regina Barzilay. Paraphrasing for automatic evaluation. In Proceedings of the Main Conference on Human Language Technology Conference of the North American Chapter of the Association of Computational Linguistics (HLT-NAACL), pages 455–462, 2006. Cited on page 28. Huda Khayrallah and Philipp Koehn. On the impact of various types of noise on neural machine translation. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation (NMT@ACL), pages 74–83, 2018. Cited on page 20. Scott Kirkpatrick, Charles Daniel Gelatt Jr., and Mario P. Vecchi. Optimization by simmulated annealing. Science, 220(4598):671–680, 1983. Cited on page 24. Guillaume Klein, Yoon Kim, Yuntian Deng, Jean Senellart, and Alexander M. Rush. OpenNMT: Open-source toolkit for neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics: System Demonstrations (ACL), pages 67–72, 2017. Cited on page 75. Kevin Knight. Decoding complexity in word-replacement translation models. Computational Linguistics, 25(4):607–615, 1999. Cited on page 24. Philipp Koehn. Statistical significance tests for machine translation evaluation. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 388–395, 2004. Cited on pages 54, 64, 79, and 115. Philipp Koehn. Europarl: A parallel corpus for statistical machine translation. In Proceedings of the Machine Translation Summit X, pages 79–86, 2005. Cited on pages 37 and 49. Philipp Koehn and Rebecca Knowles. Six challenges for neural machine translation. In Proceedings of the First Workshop on Neural Machine Translation (NMT@ACL), pages 28–39, 2017. Cited on page 20. Philipp Koehn, Franz Josef Och, and Daniel Marcu. 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 (HLTNAACL) – Volume 1, pages 48–54, 2003. Cited on pages 8, 15, 21, 22, 24, 32, 51, 105, and 111.
Bibliography 95 Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, Chris Dyer, Ondřej Bojar, Alexandra Constantin, and Evan Herbst. Moses: Open source toolkit for statistical machine translation. In Proceedings of the 45th Annual Meeting of the Association for Computational Linguistics on Interactive Poster and Demonstration Sessions (ACL), pages 177–180, 2007. Cited on pages 9, 21, 37, 49, and 105. Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 66–71, 2018. Cited on page 80. Patrik Lambert and Rafael E. Banchs. Tuning machine translation parameters with SPSA. In Proceedings of the 2006 International Workshop on Spoken Language Translation (IWSLT), pages 190–196, 2006. Cited on page 85. Guillaume Lample, Alexis Conneau, Marc’Aurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. Word translation without parallel data. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018. Cited on page 85. John Richard Landis and Gary Grove Koch. The measurement of observer agreement for categorical data. Biometrics, 33(1):159–174, 1977. Cited on pages 66 and 80. Philippe Langlais, Alexandre Patry, and Fabrizio Gotti. A greedy decoder for phrasebased statistical machine translation. In Proceedings of the 11th International Conference on Theoretical and Methodological Issues in Machine Translation (TMI), pages 104–113, 2007. Cited on page 22. Samuel Läubli, Rico Sennrich, and Martin Volk. Has machine translation achieved human parity? A case for document-level evaluation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4791–4796, 2018. Cited on page 26. Alon Lavie and Abhaya Agarwal. METEOR: An automatic metric for MT evaluation with high levels of correlation with human judgments. In Proceedings of the Second Workshop on Statistical Machine Translation (StatMT@ACL), pages 228–231, 2007. Cited on page 27. Ronan Le Nagard and Philipp Koehn. Aiding pronoun translation with co-reference resolution. In Proceedings of the Joint Fifth Workshop on Statistical Machine Translation and MetricsMATR (WMT@ACL), pages 252–261, 2010. Cited on page 21.
96 Bibliography Vladimir Iosifovich Levenshtein. Binary codes capable of correcting deletions, insertions, and reversals. Soviet Physics-Doklady, 10(8):707–710, 1966. Cited on page 28. Chin-Yew Lin and Franz Josef Och. ORANGE: a method for evaluating automatic evaluation metrics for machine translation. In Proceedings of the 20th International Conference on Computational Linguistics (COLING), 2004a. Cited on page 29. Chin-Yew Lin and Franz Josef Och. Automatic evaluation of machine translation quality using longest common subsequence and skip-bigram statistics. In Proceedings of the 42nd Annual Meeting on Association for Computational Linguistics (ACL), 2004b. Cited on page 29. Ding Liu and Daniel Gildea. Syntactic features for evaluation of machine translation. In Proceedings of the Workshop on Intrinsic and Extrinsic Evaluation Measures for Machine Translation and/or Summarization (IEEvaluation@ACL), pages 25–32, 2005. Cited on page 30. Chi-kiu Lo. MEANT 2.0: Accurate semantic MT evaluation for any output language. In Proceedings of the Second Conference on Machine Translation (WMT), pages 589–597, 2017. Cited on pages 28 and 85. Chi-kiu Lo and Dekai Wu. MEANT: An inexpensive, high-accuracy, semi-automatic metric for evaluating translation utility based on semantic roles. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies (ACL-HLT), pages 220–229, 2011. Cited on pages 28 and 85. Chi-kiu Lo, Meriem Beloucif, Markus Saers, and Dekai Wu. XMEANT: Better semantic MT evaluation without reference translations. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (ACL) – Volume 2: Short Papers, pages 765–771, 2014. Cited on pages 28 and 85. Annie Louis and Bonnie Webber. Structured and unstructured cache models for SMT domain adaptation. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics (EACL), pages 155–163, 2014. Cited on page 21. Pranava Swaroop Madhyastha, Xavier Carreras, and Ariadna Quattoni. Learning task-specific bilexical embeddings. In Proceedings of the 25th International Conference on Computational Linguistics (COLING), pages 161–171, 2014. Cited on page 85.
Bibliography 97 Eva Martínez Garcia, Cristina España-Bonet, and Lluís Màrquez. Document-level machine translation as a re-translation process. Procesamiento del Lenguaje Natural (SEPLN), 53:103–110, 2014a. Cited on page 10. Eva Martínez Garcia, Cristina España-Bonet, and Lluís Màrquez. Experiments on document level machine translation. Technical Report LSI-14-11-R, Universitat Politècnica de Catalunya, Spain, 2014b. URL http://hdl.handle.net/2117/ 26965. Cited on page 10. Eva Martínez Garcia, Cristina España-Bonet, Jörg Tiedemann, and Lluís Màrquez. Word’s vector representations meet machine translation. In Proceedings of the 8th Workshop on Syntax, Semantics and Structure in Statistical Translation (SSST@EMNLP), pages 132–134, 2014c. Cited on page 10. Eva Martínez Garcia, Cristina España-Bonet, and Lluís Màrquez. Document-level machine translation with word vector models. In Proceedings of the 18th Annual Conference of the European Association for Machine Translation (EAMT), pages 59–66, 2015. Cited on page 10. Eva Martínez Garcia, Carles Creus, Cristina España-Bonet, and Lluís Màrquez. Using word embeddings to enforce document-level lexical consistency in machine translation. The Prague Bulletin of Mathematical Linguistics, 108:85–96, 2017. Cited on page 11. Sameen Maruf and Gholamreza Haffari. Document context neural machine translation with memory networks. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL) – Volume 1, pages 1275–1284, 2018. Cited on page 26. Ilya Dan Melamed, Ryan Green, and Joseph P. Turian. Precision and recall of machine translation. In Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics (HLTNAACL), pages 61–63, 2003. Cited on page 29. Tomas Mikolov, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. CoRR, abs/1301.3781, 2013a. URL http: //arxiv.org/abs/1301.3781. Cited on pages 17, 45, and 46. Tomas Mikolov, Quoc Viet Le, and Ilya Sutskever. Exploiting similarities among languages for machine translation. CoRR, abs/1309.4168, 2013b. URL http:// arxiv.org/abs/1309.4168. Cited on pages 45 and 50.
98 Bibliography Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems (NIPS), pages 3111–3119, 2013c. Cited on page 17. Sonja Nießen, Franz Josef Och, Gregor Leusch, and Hermann Ney. An evaluation tool for machine translation: Fast evaluation for MT research. In Proceedings of the 2nd International Conference on Language Resources and Evaluation (LREC), 2000. Cited on page 28. Franz Josef Och. Minimum error rate training in statistical machine translation. In Proceedings of the 41st Annual Meeting on Association for Computational Linguistics (ACL) – Volume 1, pages 160–167, 2003. Cited on pages 15, 37, 49, 51, and 114. Franz Josef Och and Hermann Ney. A systematic comparison of various statistical alignment models. Computational Linguistics, 29(1):19–51, 2003. Cited on pages 37 and 49. Franz Josef Och, Nicola Ueffing, and Hermann Ney. An efficient A* search algorithm for statistical machine translation. In Proceedings of the Workshop on Data-driven Methods in Machine Translation (DMMT) – Volume 14, pages 1–8, 2001. Cited on page 16. Karolina Owczarzak, Declan Groves, Josef van Genabith, and Andy Way. Contextual bitext-derived paraphrases in automatic MT evaluation. In Proceedings of the Workshop on Statistical Machine Translation (StatMT@NAACL), pages 86–93, 2006. Cited on page 28. Lluís Padró, Samuel Reese, Eneko Agirre, and Aitor Soroa. Semantic services in FreeLing 2.1: WordNet and UKB. In Principles, Construction, and Application of Multilingual Wordnets, pages 99–105, 2010. Cited on pages 32 and 35. Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting on Association for Computational Linguistics (ACL), pages 311–318, 2002. Cited on pages 29, 37, 49, 51, and 115. Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT) – Volume 1, pages 2227–2237, 2018. Cited on page 85.
Bibliography 99 John R. Pierce and John B. Carroll. Language and Machines: Computers in Translation and Linguistics. National Academy of Sciences/National Research Council, Washington, DC, USA, 1966. Cited on page 13. Martin Popel and Ondřej Bojar. Training tips for the Transformer model. The Prague Bulletin of Mathematical Linguistics, 110:43–70, 2018. Cited on page 19. Martin Popel, Dominik Macháček, Michal Auersperger, Ondřej Bojar, and Pavel Pecina. English-Czech systems in WMT19: Document-level transformer. In Proceedings of the Fourth Conference on Machine Translation (WMT) – Volume 2: Shared Task Papers, pages 541–547, 2019. Cited on page 27. Andrei Popescu-Belis. Context in neural machine translation: A review of models and evaluations. CoRR, abs/1901.09115, 2019. URL http://arxiv.org/abs/ 1901.09115. Cited on page 26. Cornelis Joost van Rijsbergen. Information Retrieval. Butterworth-Heinemann, 2nd edition, 1979. Cited on page 29. Grazia Russo-Lassner, Jimmy Lin, and Philip Resnik. A paraphrase-based approach to machine translation evaluation. Technical Report LAMP-TR-125/CSTR-4754/UMIACS-TR-2005-57, University of Maryland, College Park, 2005. Cited on page 28. Theodorus Johannes Maria Sanders and Henk L. W. Pander Maat. Cohesion and coherence: Linguistic approaches. In Encyclopedia of Language & Linguistics, pages 591–595. Elsevier, 2nd edition, 2006. Cited on page 8. Emili Sapena, Lluís Padró, and Jordi Turmo. A global relaxation labeling approach to coreference resolution. In Proceedings of the 23rd International Conference on Computational Linguistics: Posters (COLING), pages 1086–1094, 2010. Cited on page 32. Holger Schwenk, Daniel Déchelotte, and Jean-Luc Gauvain. Continuous space language models for statistical machine translation. In Proceedings of the 21st International Conference on Computational Linguistics and the 44th Annual Meeting of the Association for Computational Linguistics (COLING-ACL), pages 723–730, 2006. Cited on page 17. Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (ACL) – Volume 1, pages 1715–1725,
106 Appendix A. Decoding with Ants Algorithm 1 Decoding a sentence with ant colony optimization. Input: a source sentence S. (1) Generate graph Gfor the sentence S, initializing all pheromone values to the midpoint τmid := (τmin +τmax)/2. (2) Initialize trb, tbs as fictitious translations with score −∞. (3) Initialize bsUpdate to false and convergenceFactor to 0. (4) For ifrom 1to Ido: (a) Generate translation ti afor each ant a∈ {1, . . . , A}. (b) Set tib to be the translation with highest score among ti 1, . . . , ti A. Set trb to be the translation with highest score among ti 1, . . . , ti A, trb. Set tbs to be the translation with highest score among ti 1, . . . , ti A, tbs. (c) Update pheromone according to the translations tib, trb, tbs and the variables bsUpdate and convergenceFactor. (d) Set convergenceFactor to 1 |T | PTj∈T |τj−τmid| (τmax−τmin)/2. (e) If convergenceFactor > C do: (i) If bsUpdate is true, then perform a restart as follows: •Set all pheromone values to τmid. •Set trb to a fictitious translation with score −∞. (ii) Set bsUpdate to ¬bsUpdate. Output: translation tbs. word and pt is altered such that pt(sj) = {sj}. On the other hand, even though pt is a partial function, we assume that undefined entries are mapped to an empty set of translation options. So, for any phrase si. . . sjof S, with 1≤i≤j≤N, we assume pt(si. . . sj) = ∅when si. . . sj/∈dom(pt). From ACO we take the general optimization strategy, which is summarized in Algorithm 1. In this setting, a translation of Sis identified with a path that an ant has followed through the so-called construction graph (see Figure A.1). In our case, each node of the graph corresponds to a translation option from pt for a phrase si. . . sjof S, and thus, a path through the graph defines a sequence of translations of phrases of S. Not all paths are valid translations: they must satisfy that each source word siis translated by exactly one node of the path. The ants walk guided by a probability distribution, which is based on certain heuristic information and the amount of pheromone that the ants leave on the construction graph. The place where pheromone is deposited is formalized as the pheromone model T, which is a collection of pheromone trail parameters Ti, each with a value τi. A usual definition of Tis to have a parameter Tiassociated to either each edge of the construction graph or to each node. The general overview of the process is straightforward: a swarm with a given amount A > 0of ants is released onto the construction graph to obtain A translations, these translations are used to update the pheromone, and this process is repeated until reaching a termination criterion; the final output is the translation with highest score that has been constructed. Our implementation uses as termination
A.1. Decoding Method 107 smart ants want to become writers . 1 2 3 4 5 6 7 inteligentes inteligente listos astuto brillantes hormigas quieren queremos desean quiere deseamos desean convertirse en desean hacerse quieren convertirse en quieren ser aspiran a convertirse en quieren queremos quiere desean gustar´ıa a para que en al a convertirse en a ser para convertirse en para ser llegar a ser convertirse en ser convertido en se convierta en hacerse escritores los escritores autores los autores redactores escritores . . Figure A.1: Sketch of the construction graph for the source sentence “smart ants want to become writers.” (each of the Spanish phrases corresponds to a node of the graph; edges are omitted to avoid clutter) and path that an ant follows through it to form the translation “hormigas inteligente desean llegar a ser escritores.” with some gender and number disagreements. For each phrase of the source sentence we show up to 5translations, listed by decreasing probability. Note that only 3two-token phrases (“want to”, “to become”, and “writers .”) and 1three-token phrase (“want to become”) have translations. Also note that the nodes visited in the path translate each of the 7source tokens, and do it just once. criterion a given amount I > 0of iterations, although different criteria—such as, for example, a time budget—could be used. One of the most important aspects of ACO is the handling of pheromone. In our case, the value of each pheromone trail parameter is kept within a given range [τmin, τmax]throughout the process and it is initially set to the midpoint τmid := (τmin + τmax)/2. One of the benefits of having the value of each Tirestricted to [τmin, τmax]is that a convergence of the pheromone distribution can easily be identified. It suffices to compute a factor in [0,1] and compare it to a given threshold C∈[0,1), with 0corresponding to the initial, uniform distribution of pheromone and 1to the case where the value of each Tihas already reached either τmin or τmax. When convergence is detected, the algorithm escapes this situation by restarting itself, which consists in resetting the pheromone of each Tiback to its initial value τmid. Nevertheless, not all the obtained information is lost during the restart: the algorithm keeps track of the best translation found since the beginning of the process (called the best-so- far or bs) and uses it to bias the pheromone distribution during a few iterations
108 Appendix A. Decoding with Ants Variable Value when bsUpdate is false and convergenceFactor is in: Value when name [0,0.4) [0.4,0.6) [0.6,0.8) [0.8,1] bsUpdate is true κib 1 2/3 1/3 0 0 κrb 0 1/3 2/3 1 0 κbs 0 0 0 0 1 Table A.1: Value associated to the variables κib, κrb, κbs of the pheromone update. between the instant when convergence is detected and the instant when the restart is actually performed. In this way, both old and new information get combined when ants construct translations during convergence. In general, the pheromone update performed at the end of each iteration consists in, first, evaporating a given fraction ρ (called the learning rate) of the value of each pheromone trail parameter, and second, increasing the value of pheromone trail parameters involved in the construction of (at most) three translations: the best one found in the current iteration (called the iteration-best or ib), the best one found since the beginning of the process (i.e., the best-so-far or bs), and the best one found since the last time that the process was restarted (called the restart-best or rb). Resulting amounts of pheromone below τmin are increased to τmin and amounts above τmax are decreased to τmax. More precisely, for each pheromone trail parameter Ti∈ T , with ibeing an edge or node of the construction graph depending on the chosen definition, its new pheromone value is: max{τmin,min{τmax,(1 −ρ)·τi+ρ·(κ0 ib +κ0 rb +κ0 bs)}} where the term κ0 ib is 0when iis not part of the path followed to define the iterationbest translation and, otherwise, it is κib as detailed in Table A.1, analogously for the term κ0 rb corresponding to the restart-best translation and the term κ0 bs corresponding to the best-so-far translation. We have considered three distinct variants of the decoding method, which we denote as ACODec, ACODecmono indep, and ACODecmono share . In ACODec, the pheromone trail parameters are associated to each edge of the construction graph and ants are free to walk along the edges in any order, as long as the paths they follow correspond to valid translations. ACODecmono indep and ACODecmono share follow the same general scheme as ACODec, but modify it on two fronts. On the one hand, instead of having ants define full translations, they work incrementally: ants take their translations from the previous iteration, erase a part of each of them, and then fill in the holes. On the other hand, we simplify the problem by forcing ants to always walk in monotonic order, that is, the translations they create must keep the order of phrases from the source sentence. To be able to obtain arbitrarily-reordered translations, the phrases of each translation are later permuted with a local search like the one presented by Hardmeier et al. (2012). The main benefit of having ants advance in monotonic order is that we can easily shift the pheromone trail parameters from the edges to the nodes (thus, pheromone only models decisions concerning segmentation and translation, but not concerning reordering) and reduce the size of the construction graph (edges can be left implicit). The single difference between ACODecmono indep and ACODecmono share is that in the former each ant has an independent translation to work on, whereas in the latter all
A.1. Decoding Method 109 ants share a common translations to work on. The following sections detail for each approach the generation of the construction graph (step 1 of Algorithm 1) and the definition of the ant paths and their associated translations (step 4.a of Algorithm 1). As a final remark, note that we have assumed that ACODec, ACODecmono indep, and ACODecmono share start uninformed. Nevertheless, it is also possible to precompute a translation tas starting point for the process. In such case, step 2 of the algorithm initializes trb and tbs to t. Additionally, ACODecmono indep and ACODecmono share also set t0 1, . . . , t0 Ato t, such that in the very first iteration each ant already has a previous translation to work on. A.1.1 Detailed Steps of ACODec Step 1 – Graph Construction and Pheromone The directed graph G=hV, Eiis constructed as follows. Each node of Vcorresponds to a translation option of a single segment of the source sentence. To represent it, we use tuples of the form hi, j, tias nodes, where iand jsatisfy 1≤i≤j≤N and identify a segment of the source sentence and tis a target phrase that translates this segment. We use cover(hi, j, ti)to denote the set {i, . . . , j}and target(hi, j, ti) to denote t. Additionally, Vcontains one extra node used as the special starting point for the ants: start =h0,0, εi, where εis the empty sequence. Note that start identifies a fictitious segment of the source sentence, which is assumed to cover a single non-existing word at index 0. Overall, the set of nodes of Gis: V={start} ] {hi, j, ti | 1≤i≤j≤N∧t∈pt(si. . . sj)} The set Eof directed edges is a subset of V×V, not containing the following undesirable and useless edges. First, we do not need an edge connecting any two nodes whose segments overlap, as no ant is allowed to walk along such an edge since those nodes cannot appear together in a translation. We say that two nodes n, n0overlap, denoted by overlap(n, n0), when the source segments they specify overlap, i.e., when cover(n)∩cover(n0)is non-empty. Second, we omit those edges that exceed a given maximum distortion D≥0. The distortion is a measure on how much the source segments are reordered in the respective translation. It is computed as the amount of source words separating the end of one segment from the beginning of the next segment; formally: distortion(n, n0) = |min(cover(n0)) −(max(cover(n)) + 1)|. Note that, as expected, the distortion is 0when the segment of the second node starts just after the segment of the first node. Third, we also discard edges directed towards start, since such node is only used as starting point for the ants and should not be visited mid-sentence. Overall, the set of directed edges of Gis: E={hn, n0i ∈ V2| ¬overlap(n, n0)∧distortion(n, n0)≤D∧n06=start} Note that for edges of the form hstart, n0iwe also impose distortion(start, n0)≤D. This is because we also want the beginning of the sentence to respect the maximum distortion. We associate to each directed edge e∈Ea pheromone trail parameter Te, with its value τeinitialized to the amount τmid.
110 Appendix A. Decoding with Ants Step 4.a – Ant Paths and Associated Translations Apath through the graph Gis a sequence p=n0.n1. . . nmof nodes of V, with 0< m ≤N, satisfying these conditions: (i) it begins with start, i.e., n0=start, (ii) the nodes are pairwise non-overlapping, (iii) the directed edge hni, ni+1iis in Efor each i∈ {0, . . . , m −1}, and (iv) the nodes cover the whole sentence, i.e., cover(p) := cover(n0)]cover(n1)]. . . ]cover(nm)coincides with {0, . . . , N}. To construct such a path p, an ant proceeds by starting at start and then walking along edges while guaranteeing that the path conditions (i)-(iii) are met. The ant proceeds until (iv) is also met, at which point the followed path pstraightforwardly corresponds to a valid translation for the source sentence: target(n1). . . target(nm). The main difficulty of constructing a path is how an ant performs a step, in particular, how it chooses an out-edge among all the out-edges of the current node. Consider a partially constructed path p=n0.n1. . . nk, with 0≤k < N and satisfying (i)-(iii) but not (iv). To proceed, the ant has to choose one of the out-edges of node nk. Note that, possibly, not all out-edges in Eare valid, since some might lead to nodes overlapping with the nodes already in p, thus creating a conflict concerning (ii). Let E|pbe the out-edges of nkthat avoid such overlap, i.e.: E|p={hnk, ni ∈ E|cover(p)∩cover(n) = ∅} We further prune this set to preemptively avert paths that would lead the ant into a dead end. In particular, we do not want to reach a situation where the remaining untranslated parts of the sentence cannot be segmented or would require steps exceeding the maximum distortion D. For the latter goal, we use the same conservative method as in Moses: we do not allow a jump forward when the index immediately following the segment corresponding to the destination node of the jump is further than Dfrom any preceding untranslated word in the sentence. Formally, let ube the least index of a still-uncovered word, i.e., u= min({1, . . . , N} \ cover(p)), then the pruned set is: Ekp=hnk, ni ∈ E|p|∃¯ V⊆V:segmentation(¯ V , {1, . . . , N} \ cover(p.n))∧ u∈cover(n)∨(|u−(max(cover(n)) + 1)| ≤ D) where segmentation(¯ V , X)tests whether the given collection of nodes are pairwise non-overlapping and fully cover the given set of source word indexes, i.e.: segmentation(¯ V , X) = ∀¯n1,¯n2∈¯ V: (¯n16= ¯n2⇒ ¬overlap(¯n1,¯n2))∧ X=U¯n∈¯ Vcover(¯n) This concludes the identification of the candidate edges for the current step, but it still remains to assess their quality so that the ant can bias the selection towards the most promising ones. To this end, each edge e=hnk, ni ∈ Ekphas an associated weight wedefined as: we=α·τe+ (1 −α)·h(n, {1, . . . , N} \ cover(p)) where α∈[0,1] is a given constant and h(n, Y )∈[0,1] is a heuristic measure on the quality of choosing node nto extend the partial path when having the source words at
A.1. Decoding Method 111 the indexes of Ystill untranslated. This heuristic is based on the future cost of Koehn et al. (2003), which estimates the score attainable on the untranslated parts of the sentence. More precisely: h(n, Y ) = max(futures(Y, {n})) −min(futures(Y, ∅)) max(futures(Y, ∅)) −min(futures(Y, ∅)) where futures(Y, Z)is the following set of score estimates: P¯n∈¯ Vestimate(¯n)|Z⊆¯ V⊆V∧segmentation(¯ V , Y ) with estimate(¯n)measuring the score of using the translation option target(¯n)for the segment cover(¯n)of the source sentence. The function estimate is computed as an approximation of the models conforming our score function, except for the distortion model (Koehn et al., 2003). When the set futures has only one element, we assume h(n, Y )=1to avoid a division by 0. Finally, the probability of each edge e∈Ekpof being selected by the ant in the current step is: pe=we Pe0∈Ekpwe0 Nevertheless, the ant first decides whether the selection of an edge among all the candidates in Ekpis to be deterministic (the one with maximal weight we) or random (following the probabilities pe). The case is decided randomly: with a given probability q0(called the determinism rate) the deterministic decision is performed. Once an edge e∈Ekphas been chosen, the partial path pis extended with the destiny node of e. This extension clearly still satisfies (i)-(iii) due to how Ekphas been defined. A.1.2 Detailed Steps of ACODecmono indep and ACODecmono share Step 1 – Graph Construction and Pheromone Even though similar to the construction graph of ACODec, the one for ACODecmono indep and ACODecmono share is simpler. In particular, the set of nodes is the same except for the start node, which is now not needed. Also, the pheromone trail parameters in this case are associated to nodes instead of edges. Finally, the set of edges could, in principle, simply contain the edges of the form hhi, j, ti,hj+ 1, k, t0ii that are needed for monotonic steps. Nevertheless, since edges do not have any associated data and are not needed for any special purpose, we leave them implicit in our implementation. Step 4.a – Ant Paths and Associated Translations Apath through Gis, in this occasion, a sequence p=n1. . . nmof nodes of V, with 0< m ≤N, satisfying that (i) the nodes are pairwise non-overlapping and (ii) the nodes cover the whole sentence, i.e., cover(p) := cover(n1)]. . . ]cover(nm) coincides with {1, . . . , N}. To construct such a path, first, each ant atakes a path from the previous iteration (when available), erases a part of it, and fills it again with a new monotonic translation for the created hole. Second, the sequence of nodes
112 Appendix A. Decoding with Ants h2,2,hormigasi h1,1,inteligentei h3,3,deseani h4,5,llegar a seri h6,7,escritores .i h2,2,hormigasi h1,1,inteligentesi h3,4,gustar´ıai h5,5,hacersei h6,7,escritores .i source: p: p1.p0 2.p3: smart 1 ants 2 want 3 to 4 become 5 writers 6 . 7 p1 p0 2 p3 Figure A.2: Following the example in Figure A.1, the ant creates a hole of length `= 3 in the path pof the translation from the previous iteration (the hole is depicted as the stricken-through nodes). The affected source indexes for such hole are K={1,3,4,5}, which are partitioned into groups of serial indexes as K1={1}and K2={3,4,5}. For the first group K1, the ant fills the hole with the single node h1,1,inteligentesi. For the second group K2, it uses the two nodes h3,4,gustaríaiand h5,5,hacersei. In this latter case, according to the graph in Figure A.1 it would also have been possible to fill the hole with one single node (e.g., h3,5,aspiran a convertirse eni) or with three individual nodes. thus obtained by the ant ais permuted to produce a new (possibly non-monotonic) sequence. The permutation is performed by means of a local search like the one by Hardmeier et al. (2012), which runs for a pre-defined amount Rof steps. From the resulting permuted sequence we directly obtain the translation ti aassociated to the ant ain the current iteration i. It only remains to detail the tasks performed by the ant a. Its first task is to locate a previous path pto work on. In the case where trb is a fictitious translation with −∞ score, there is no such path because the process is either at the very first iteration or at an iteration immediately following a restart. Otherwise, in ACODecmono indep the ant auses as pthe path of its own translation ti−1 afrom the previous iteration, and in ACODecmono share the ant auses as pthe path of the translation with highest score among all the translations ti−1 1, . . . , ti−1 Afrom the previous iteration. From this point onward, ACODecmono indep and ACODecmono share behave identically. The second task of the ant is to create a hole in p(see Figure A.2). This consists in splitting the sequence pinto p1.p2.p3, where p1and p3are to be preserved whereas the source words at the set of indexes K=cover(p2)are to be monotonically retranslated. The split of pis performed randomly: the length `for the infix p2is the minimum between the length |p|of the whole sequence and a value chosen uniformly from a given range {`1, . . . , `2}, the length for the prefix p1is chosen uniformly from {0,...,|p| − `}, whereas the length of the suffix p3is univocally determined by the previous ones. In the special case where the ant has no previous path pto work on, we simply assume |p1|=|p3|= 0 and K={1, . . . , N}, i.e., as if the ant had created a hole covering the whole path. Third, let Kbe partitioned into maximal sets K1, . . . , Kkof serial indexes, i.e., the Kj’s are non-empty, pairwise disjoint subsets of K, their union coincides with K, and each of them is of the form {j0, . . . , j1}such that j0−1, j1+1 /∈K. Furthermore, we assume that they are ordered, i.e., max(Kj)<min(Kj+1). Intuitively, p2was a
A.2. Time Complexity 113 hole in the translation, whereas each Kjis a part of this hole when projected onto the source. Finally, to produce the desired path p1.p0 2.p3, the ant iteratively grows p0 2from an empty sequence of nodes by processing the Kj’s in order. For each Kj, it proceeds as follows: while the set P:= Kj\cover(p0 2)is non-empty, the ant appends to p0 2a node n∈Vchosen among those ones that cover only indexes of Pand cover at least min(P). The selection of the node nfollows the same ideas as to how an ant chooses an edge in ACODec. In particular, the set of candidate nodes V|Pis defined like: V|P={n∈V|min(P)∈cover(n)⊆P} and each node n∈V|Phas an associated weight wndefined as: wn=α·τn+ (1 −α)·h(n, P) where his the same heuristic as in ACODec, transformed into a probability as follows: pn=wn Pn0∈V|Pwn0 The ant chooses a node from V|Peither deterministically (the one with maximal weight wn) or randomly (following the probabilities pn), and which strategy to use is decided with a given probability q0(i.e., determinism rate) for the former. Note that, in contrast to ACODec, the ants ignore the maximum distortion D. This is not a problem in practice, since translations are usually quite monotonic, and thus, patching a hole monotonically has little chances of exceeding the limit D. Nevertheless, if it did happen, the hill-climbing reordering could correct the violation. A.2 Time Complexity For the asymptotic time complexity of ACODec, first note that the amount |V|of nodes in the graph Gis in O(N·L·T), where Lis the maximum length of a source phrase in pt, i.e., L= max{j−i+ 1 : 1 ≤i≤j≤N∧si. . . sj∈dom(pt)}, and Tis the maximum amount of translation options in pt for any source phrase, i.e., T= max{|pt(si. . . sj)|: 1 ≤i≤j≤N}. Second, the amount |E|of edges in Gis bounded by |V|2, but a tighter bound can be obtained by taking into account the maximum distortion Dthat restricts the connectivity of the graph. In particular, each node of Gis connected with out-edges to at most outdegree = (2 ·D+ 1) ·L·T other nodes. Thus, |E|is in O(|V| · outdegree) = O(N·L2·T2·D). This bound also holds for the size |G|of the graph, since |E|is the factor that dominates it. Clearly, the construction of the graph can be done with time linear in |G|. The time each iteration takes can be bounded as follows. For each ant, the time needed for constructing its path is proportional to the amount of source words and the maximum out-degree of the graph, so it is in O(N·outdegree ·H(N)), where H(.)denotes the time it takes to compute the heuristic information as a function of the source sentence length. Reconstructing a translation from a path is straightforward, but we also need to compute its associated score. We use F(.)to denote the time it takes to
114 Appendix A. Decoding with Ants compute the score as a function of the sentence length. This length must take into account the source and the produced target. Nevertheless, the size of the target can be bounded by the size of the source multiplied by a factor depending on pt, and since pt is part of the scoring, we assume that any increase in size in the target side is already handled by F. So, reconstructing a translation from a path and scoring it takes time in O(N+F(N)), which is equivalent to O(F(N)) since Fis at least linear. Since we use Aants, obtaining all the paths, reconstructing the associated translations, and scoring them takes time in O(A·(N·outdegree ·H(N) + F(N))). The time needed for updating the pheromone is not completely subsumed in the previous expression, as the whole graph must be traversed for the evaporation. Thus, the time each iteration takes is in O(A·(N·outdegree ·H(N) + F(N)) + |G|) = O(N·outdegree ·(A·H(N)+L·T)+A·F(N)). Since the process is iterated Itimes, the overall time complexity is O(I·(N·outdegree ·(A·H(N) + L·T) + A·F(N))). Assuming L, T, D to be fixed constants, this reduces to O(I·A·(N·H(N) +F(N))). A similar analysis can be made for ACODecmono indep and ACODecmono share . In this case, since we do not actually generate the edges of the graph, |G|is in O(N·L·T)and the same bound holds for the time complexity of generating G. The time each iteration takes can be bounded as follows. For each ant, the time needed for incrementally constructing its path is proportional to the amount of source words and the maximum amount of options for each step, so it is in O(N·L·T·H(N)). Obtaining the translation from that path, scoring it, and reordering it through Rsteps of hill climbing takes time in O(N+F(N) + R·F(N)) = O(R·F(N)). This is a very loose upper bound, as the scoring in hill climbing is optimized by doing incremental computations in each step, as proposed by Hardmeier et al. (2013). Since we use Aants, obtaining all the paths, reconstructing the associated translations, and scoring and reordering them takes time in O(A·(N·L·T·H(N) + R·F(N))). The time for updating the pheromone is completely subsumed in the previous expression. Since the process is iterated Itimes, the overall time complexity is O(I·A·(N·L·T·H(N)+R·F(N))), and assuming L, T to be fixed constants it reduces to O(I·A·(N·H(N)+R·F(N))). A.3 Experiments We perform English-to-Spanish translation experiments under settings comparable to the ones of Section 4.4.1, but with three modifications. First, since the size of the phrase table is crucial in the performance of our ACO approaches, we filter it to only retain for each source phrase, at most, the T= 30 target phrases with highest p(tgt|src)probability. We do not alter the value of other related parameters that also affect performance, such as the maximum length L= 7 of the source phrases of the phrase table or the maximum distortion D= 6 of the distortion model. Second, we reuse the baseline Moses system, but disabling its lexical reordering feature. The rationale for this modification is that the other systems do not implement an equivalent feature function, and we want to compare the systems when facing the exact same optimization problem (i.e., the problem of finding the best translation according to a scoring function shared by all the systems). We perform a new feature weight optimization for this Moses system variation, using MERT (Och, 2003) against the
A.3. Experiments 115 System q0C[τmin, τmax]α ACODec 0.8828125 0.999 [0.001,0.999] 0.671875 ACODecmono indep 0.8671875 0.99999 [0.0001,0.9999] 0.796875 ACODecmono share 0.7734375 0.99999 [0.0001,0.9999] 0.671875 Table A.2: Grid-tuned parameter values of the three ACO variants. System WER↓PER↓TER↓BLEU↑NIST↑METEORpa↑ULC↑ Moses 59.44 40.08 53.80 27.28 7.3262 49.97 53.12 Lehrer 61.71 41.31 56.10 24.78 7.0516 48.26 48.65 ACODec 62.30 43.48 57.41 21.99 6.8666 46.69 44.63 ACODecmono indep 60.46 41.85 55.19 24.73 7.1326 48.51 49.27 ACODecmono share 60.09 41.14 54.76 25.67 7.2125 48.95 50.67 Table A.3: Automatic evaluation of the systems working on sentences. The ULC is computed over the other metrics of the table. BLEU metric (Papineni et al., 2002) on the newsCommentary2009 development corpus. Third, we reuse the baseline Lehrer system, but initialized randomly instead of using precomputed Moses translations, with a maximum quota of 107steps instead of 105, and using the feature weights obtained with the MERT-tuning for Moses that we just mentioned. We still use newsCommentary2010 as test set. We consider three ACO systems, one for each of the decoding variants, and for all of them we use the same features and weights as the Moses system. Regarding the parameters specific to ACO, we have identified several non-problematic ones during preliminary experiments, and we have chosen for them values that are similar to the ones in the literature: 10 for the number Aof ants and 0.1for the learning rate ρ. We fix the number Iof iterations to 500 as a trade-off between the computation speed and the quality of the obtained results. For the monotonic variants, we fix a limit of R= 104steps for the hill-climbing reordering and {`1= 1, . . . , `2= 12}as the range for the length of the holes. We perform a grid search to tune the remaining parameters: for the determinism rate q0and the fraction αthat pheromone contributes to the weights we explore the range [0,1] at regularly-spaced values, whereas for the convergence threshold Cand the pheromone range [τmin, τmax]we just vary the amount of decimal places of their values (these variables are defined like C:= 1 −10−x,τmin := 10−y, τmax := 1 −10−y, and thus, it suffices to test possible values for the positive naturals xand y). Table A.2 shows the obtained values. Table A.3 shows the result of the automatic evaluation of the systems when translating the whole test set sentence by sentence. Moses obtains the best results in all the metrics and, of the remaining systems, ACODecmono share systematically outperforms the rest. Except for the pair Lehrer and ACODecmono indep, the differences between the systems are statistically significant.1Besides this automatic evaluation against the 1According to bootstrap resampling (Koehn, 2004) over BLEU and NIST metrics with a p-value of 0.05.