Full text
Escola Tècnica Superior d’Enginyeria Informàtica Universitat Politècnica de València Translation Rescoring through Recurrent Neural Network Language Models Proyecto Final de Carrera Ingeniería Informática Autor: Álvaro Peris Abril Director: Francisco Casacuberta Nolla Codirector: Daniel Ortíz Martinez September 3, 2014
Abstract This work is framed into the Statistical Machine Translation field, more specifically into the language modeling challenge. In this area, have classically predominated the n-gram approach, but, in the latest years, different approaches have arisen in order to tackle this problem. One of this approaches is the use of artificial recurrent neural networks, which are supposed to outperform the n-gram language models. The aim of this work is to test empirically these new language models. For doing that, the translation rescoring of three tasks of different complexity has been performed: in first place, the translation problem has been solved by means of the classic n-gram language models. Next, the different translation hypotheses have been rescored through the language models based on neural networks and the results have been compared. This comparison shows that the translations produced by the neural network language models have a better quality in all the experiments: the perplexity of the language models has been lowered and the BLEU score of the translations outputted by the system has yielded higher values with the neural network language model than with the classical n-gram language model. Keywords: Recurrent Neural Networks, Statistical Machine Translation, n-gram Language Model, BLEU. 2
Contents List of Tables 5 List of Figures 6 1. Introduction 7 1.1. Natural Language Processing . . . . . . . . . . . . . . . . . . 7 1.2. Machine Translation . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.1. Rule-Based Systems . . . . . . . . . . . . . . . . . . . 8 1.2.2. Corpus-Based Systems . . . . . . . . . . . . . . . . . . 9 1.3. Statistical Machine Translation . . . . . . . . . . . . . . . . . 10 2. Statistical Models for Machine Translation 15 2.1. LanguageModels......................... 15 2.1.1. n-gramModels ...................... 15 2.1.2. Smoothing......................... 17 2.1.3. Neural Network Language Models . . . . . . . . . . . . 20 2.2. Translation Models . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.1. Single-Word Alignment Models . . . . . . . . . . . . . 28 2.2.2. Multi-Word Alignment Models . . . . . . . . . . . . . . 31 2.3. Evaluation............................. 32 2.3.1. Perplexity......................... 33 2.3.2. BLEU ........................... 34 2.3.3. Other evaluation measures . . . . . . . . . . . . . . . . 35 2.4. Parameter Estimation . . . . . . . . . . . . . . . . . . . . . . 36 2.4.1. Expectation-Maximization algorithm . . . . . . . . . . 36 2.4.2. Backpropagation Through Time . . . . . . . . . . . . . 38 2.4.3. Downhill Simplex . . . . . . . . . . . . . . . . . . . . . 42 3. Experiments 43 3.1. Experimentation Framework . . . . . . . . . . . . . . . . . . . 43 3.1.1. Software.......................... 43 3
3.1.2. Developed Experiment . . . . . . . . . . . . . . . . . . 48 3.2. Touristtask............................ 52 3.2.1. Overview ......................... 52 3.2.2. Results........................... 52 3.3. Xeroxtask............................. 56 3.3.1. Overview ......................... 56 3.3.2. Results........................... 56 3.4. Europarltask ........................... 62 3.4.1. Overview ......................... 62 3.4.2. Results........................... 62 4. Conclusions and Future Work 66 4.1. Conclusions ............................ 66 4.2. Futurework............................ 67 4.2.1. Integration with Thot . . . . . . . . . . . . . . . . . . 67 4.2.2. Parallelization of the Recurrent Neural Network Toolkit 67 4.2.3. Bidirectional Recurrent Neural Networks . . . . . . . . 68 5. Bibliography 69 4
List of Tables 3.1. Tourist corpora statistics . . . . . . . . . . . . . . . . . . . . . 52 3.2. Tourist task perplexities . . . . . . . . . . . . . . . . . . . . . 53 3.3. Tourist task BLEU scores . . . . . . . . . . . . . . . . . . . . 54 3.4. Xerox corpora statistics . . . . . . . . . . . . . . . . . . . . . 56 3.5. Xerox task perplexities . . . . . . . . . . . . . . . . . . . . . . 57 3.6. Xerox task BLEU scores . . . . . . . . . . . . . . . . . . . . . 59 3.7. Europarl corpora statistics . . . . . . . . . . . . . . . . . . . . 62 3.8. Europarl task perplexities . . . . . . . . . . . . . . . . . . . . 63 3.9. Europarl task BLEU scores . . . . . . . . . . . . . . . . . . . 64 5
List of Figures 1.1. Architecture of the translation process based on the Bayes rule. 13 2.1. General recurrent neural network architecture . . . . . . . . . 23 2.2. Elman recurrent neural network architecture . . . . . . . . . . 24 2.3. Recurrent neural network language model scheme. . . . . . . . 25 2.4. Alignments between an English and a Spanish sentence. . . . . 29 2.5. Recurrent neural network unfolded in time. . . . . . . . . . . . 39 3.1. Word graph example. . . . . . . . . . . . . . . . . . . . . . . . 46 3.2. Schema of the performed experimentation. . . . . . . . . . . . 48 3.3. Tourist task BLEU with larger contexts . . . . . . . . . . . . . 55 3.4. Perplexity of the Xerox task variating the smoothing technique. 58 3.5. BLEU of the Xerox task variating the smoothing technique. . 60 3.6. Xerox task BLEU with larger contexts . . . . . . . . . . . . . 61 3.7. Europarl task BLEU scores . . . . . . . . . . . . . . . . . . . 65 6
Chapter 1 Introduction 1.1. Natural Language Processing Natural Language Processing (NLP) is a knowledge field of Artificial Intelligence and Computational Linguistics, concerned with the formulation and investigation of efficient methods for generating and understanding interactions between computers and human natural languages, both oral or written. A natural language is a language written or speeched by humans for general communication purposes with each other. NLP is a very wide knowledge field, where there are two main focuses, namely language processing and language generation. The first focus involves language analysis with the goal of generating a meaningful representation for computers. The latter, refers to the computerized language production from a representation. There is a wide range of applications referred to Natural Language Processing, such as automatic summarization, discourse analysis, machine translation, morphological segmentation, natural language generation and understanding, speech recognition, topic segmentation and recognition, information retrieval, dialog systems, question answering, etc. 1.2. Machine Translation The field of Machine Translation (MT) researches the use of software with the aim of translating text or speech from a source natural language to another target natural language. This research area arose in 1949, from Warren Weaver’s idea of apply some of the Information Theory ideas from Claude Shannon. During the 1950s and 1960s, there was a general optimism regarding the machine translation [Hut95]. Main researches were polarized 7
1.2. Machine Translation Chapter 1 between the empirical (which use statistical methods) and the theoretical approaches. There was spent much effort to improve the hardware of that time and to achieve effective programming methods, able to deal with the problem. However, the results were not satisfactory. The ALPAC (Automatic Language Processing Advisory Committee) report, released in 1966, concluded that the machine translation was not worth and there was no sign of a feasible future. From here, the research decreased, though some approaches for tackling the MT problem were developed. But 10 years later than the ALPAC report, the Machine Translations prospects improved, and the research and translation systems acquired importance once again. Until the late 1980s, the main approach was the Rule-Based approach (see next section). Nevertheless, since 1989, the hegemony of theses systems has been broken by the irruption of the so-called corpus-based systems. During these more than 60 years of research, different main strategies have been applied to tackle this problem. These strategies can be categorized under different criteria [OM11]: According to the input type: speech or text. According the type of the application which uses the translations: applications that translate the input into a database query; applications that generate an approximated translation for its later correction by the user, in a post-edition translation stage; applications that perform an user-interactive translation; and fully automated translation systems. According to the translation technology. There are two main strategies: Rule-Based Systems and Corpus-Based Systems. Furthermore, there are approaches that combine both strategies and compose the so-called Hybrid Machine Translation approach. 1.2.1. Rule-Based Systems Rule-Based Machine Translation (RBMT) was one of the firsts approaches used in machine translation (the first RBMT system was developed in the early 1970s), therefore, it is a relatively mature area. This paradigm is based on the extraction of linguistic information from dictionaries and grammars, and on the creation of translation rules by human translators, in order to generate the translations. These systems are usually split in three stages: analysis step, transference step and generation step. First, the analysis step extracts information from 8
Chapter 1 1.2. Machine Translation the source text. The transference step is an optional stage, where the result of the analysis is transformed into an abstract representation. Finally, the generation step produces the target text. RBMT systems have the following advantages: No bilingual texts are required: it is possible to develop translation systems for languages with no texts in common or with no digitalized data. Rules are domain independent: most of the rules are written in a domain independent way, thus they work in every domain. There is no quality top: each error, even it is very unusual, can be treated and corrected with an specific rule. In Statistical Machine Translation, this is not possible. Total control: rules are handwritten, thereby the system is easily debuggable, in order to watch exactly systems errors. The main disadvantage of these systems is their cost: the development of the rules is expensive and it needs expert knowledge from human linguistics, both in source language and in target language. Moreover, some linguistic information must be manually set and it is hard to deal with rule interaction in big systems, with ambiguity and idiomatic expressions. 1.2.2. Corpus-Based Systems Corpus-Based systems use sets of translation examples (also known as corpora or parallel texts) from one language to another. These translation examples are used to deduce the translation of the source text. We can establish the following classification of the corpus-based systems: Example-Based Machine Translation (EBMT): this approach uses a set of translation examples as its knowledge base and it works by means of analogies. The translation process is divided into two steps, namely, comparison and recombination steps. First, the comparison step is carried out. Here, a set of hypotheses that are similar to the source text are extracted from the whole corpus. Second, at the recombination step, the hypotheses are combined in order to generate the final translation of the source text. 9
2.1. Language Models Chapter 2 Let the sentence eI 1be composed of the words e1e2...eI. We can denote, without loss of generality, Pr(eI 1)as: Pr(eI 1) = p(e1)·p(e2|e1)·p(e3|e1e2)·... ·p(eI|e1...eI−1) = I Y i=1 p(ei|e1...ei−1) (2.1) In bigram models, since n= 2, the probability of a word depends solely on the preceding word: Pr(e) = I Y i=1 p(ei|e1...ei−1)≈ I Y i=1 p(ei|ei−1)(2.2) To estimate the probability p(ei|ei−1), that is, the probability of eigiven the previous word ei−1we count the number of occurrences of the bigram ei−1eiin the training text and normalize. This matches with a ML estimator: p(ei|ei−1) = c(ei−1ei) Peic(ei−1ei)(2.3) Where c(ei)corresponds to the number of occurrences of the word eiin the source text. In other words, we just divide the number of times we see the string eiei−1by the number of times we see the word ei−1. The extension to n-gram is natural: instead of computing the probability of the word based only on the preceding word, that probability is computed according the last n−1words: p(eI 1) = I−1 Y i=1 p(ei|ei−n+1...ei−2ei−1)(2.4) The n-gram probability estimation is an extension of bigram estimation (equation 2.3). Let us use the following notation: ei−1 i−n+1 represents the segment of source sentence which starts at the (i−n+ 1)’th word and finishes at the (i−1)’th word. Thus, n-gram probabilities estimation is given by the expression: p(ei|ei−1 i−n+1) = c(ei−1 i−n+1) Peic(ei i−n+1)(2.5) Words ei−1 i−n+1 are called history of the n-gram and the value of nis called order of the n-gram. Usually, the order of n-grams fluctuate between 2 and 5. 16
Chapter 2 2.1. Language Models 2.1.2. Smoothing As seen above, n-gram language models count occurrences of words, but what happens when, in test phase, they see new n-grams that they have never seen before? N-gram models by themselves cannot assign non-zero probabilities to sentences that have not been seen during the training stage. Thus, if they find a sentence eI 1such that p(eI 1) = 0, the whole system would fail. In order to prevent this failure, we use the so-called smoothing. This term describes techniques for adjusting the maximum likelihood estimate of probabilities to produce more accurate and softer probabilities. These techniques tend to produce more uniform distribution, increasing low probabilities (zero or almost equal to zero) and decreasing high probabilities (one or almost equal to one). Besides preventing zero probabilities, smoothing methods also improve the performance of the model significantly. In [CG98] is performed a study of the main smoothing techniques developed. In the following sections, we will briefly explain some smoothing techniques related with this work and used to carry out our experiments. To introduce the smoothing techniques, we will begin with an extremely simple technique: the so-called additive smoothing, which pretends that each n-gram happens δtimes more than it actually does: p(ei|ei−1 i−n+1) = δ+c(ei−1 i−n+1) Peiδ+c(ei i−n+1)=δ+c(ei−1 i−n+1) δ· |V|+Peic(ei i−n+1)(2.6) Where Vis the vocabulary, the set of all words considered. This is a very simple method, but it has a poor performance in general. From here, many other smoothing techniques have been developed. In the next section, we will take a brief look to these methods. Good-Turing Estimate The Good-Turing Estimate fixes the basis of many smoothing techniques. It proposes that, for any n-gram that occurs rtimes, the estimate pretends that it occurs r∗times, where: r∗= (r+ 1) ·nr+1 nr being nrthe number of n-grams that occur exactly rtimes in the training data. We must convert this count into a probability, hence we have to normalize: let αbe an n-gram that occurs rtimes, and N=P∞ r=0 nrr∗, the 17
2.1. Language Models Chapter 2 Good-Turing estimate states that: pGT (α) = r∗ N In practice, this smoothing method is not used for n-gram smoothing, but, as told above, it is used as central tool in other techniques. Jelinek-Mercer Smoothing In general, it is useful to interpolate higher order n-grams with lower order n-grams, because when there is insufficient information for the higher order n-gram, the information provided by the lower order n-gram is mostly helpful. Jelinek-Mercer described a general class of interpolated models and in [BPP+92] is given a recursive way of executing this interpolation: pinterp(ei|ei−1 i−n+1) = λei−1 i−n+1 ·pML(ei|ei−1 i−n+1) + (1 −λei−1 i−n+1 )·pinterp(ei|ei−1 i−n+2) (2.7) That means that the nth-order smoothed model (pinterp(ei|ei−1 i−n+1)), is defined recursively as the linear interpolation between the nth-order maximum likelihood order model (pML(ei|ei−1 i−n+1)) and the (n−1)th-order smoothed model (pinterp(ei|ei−1 i−n+2)). As base case of the recursion, it is used the smoothed 1st-order model to be the maximum likelihood distribution or the smoothed 0th-order model to be the uniform distribution punif (ei) = 1 |V|. To estimate the value of λei−1 i−n+1 that maximizes the probability of the data, it is performed an efficient search, based on different information extracted from the data used to train the language model. In our experiments, we used the Downhill Simplex method (see Section 2.4.3) in order to lower the perplexity of the language model of the different tasks (see Section 3.1.2). Witten-Bell Smoothing Witten-Bell smoothing is an instance of Jelinek-Mercer smoothing. Starting with a definition similar to equation 2.7: pW B(ei|ei−1 i−n+1) = λei−1 i−n+1 ·pML(ei|ei−1 i−n+1)+(1−λei−1 i−n+1 )·pW B(ei|ei−1 i−n+2)(2.8) The idea behind Witten-Bell smoothing is to use the higher order model if the corresponding n-gram occurs in the training data. If not, we will back off to the lower order model. For that purpose, we will set the term (1−λei−1 i−n+1 ) 18
Chapter 2 2.1. Language Models to the probability that a word not observed after the history ei−1 i−n+1 in the training data occurs after that history. To model that, we must redefine the way these interpolation parameters λei−1 i−n+1 are estimated. Here, we define N1+(ei−1 i−n+1•)as the number of unique words that follow the history ei−1 i−n+1. The parameters λei−1 i−n+1 are estimated according: 1−λei−1 i−n+1 =N1+(ei−1 i−n+1•) N1+(ei−1 i−n+1•) + Peic(ei i−n+1)(2.9) Substituting on Equation 2.8 we arrive to the Witten-Bell smoothing equation: pW B(ei|ei−1 i−n+1) = c(ei i−n+1) + N1+(ei−1 i−n+1•)·pW B(ei|ei−1 i−n+2) Peic(ei i−n+1) + N1+(ei−1 i−n+1•)(2.10) Proceeding in this way, we will accomplish our goal: we will use the higher order model with probability λei−1 i−n+1 and the lower order model with probability (1 −λei−1 i−n+1 ). Kneser-Ney smoothing Kneser-Ney Smoothing is an extension of the so-called Absolute Discounting method. The Absolute Discounting method is similar to the Jelinek- Mercer smoothing, involves the interpolation of higher-order and lower-order models; but instead of interpolating them with a factor λei−1 i−n+1 , in Absolute Discounting, the higher-order distribution is created by reserving a probability mass from each nonzero count, that is, we subtract to each count a fixed discount D < 1. The extension introduced in the Kneser-Ney smoothing is the combination of the lower-order model with the higher-order model. So far, lower-order distributions were smoothed versions of the lower-order maximum likelihood distributions. But this is an important factor in the combined model in the case when few or no counts are present in the higher-order distribution. Thus, if there are not many counts in the training data, we are going to waste an important part of the power of the higher order-model, using the lower-order models. The idea of Kneser-Ney smoothing is to optimize the lower-order distributions in order to have a good performance in this situation. Kneser and Ney proposed the following smoothing equation: 19
2.1. Language Models Chapter 2 pKN (ei|ei−1 i−n+1) = max{c(ei i−n+1)−D,0} Peic(ei i−n+1)if c(ei i−n+1)> 0 γ(ei−1 i−n+1)·pKN (ei|ei−1 i−n+2),if c(ei i−n+1)= 0 (2.11) where γ(ei−1 i−n+1)is chosen to make the sum of the probability for all possible event equal to 1. Therefore, they interpolate the lower-order distribution with all words, not only with the words with zero counts in the higher order distribution. 2.1.3. Neural Network Language Models So far, we have studied the n-gram language model which computes conditional probabilities for the next word based on a big number of contexts, i.e. combinations of the last n−1words. Those models were able to tackle the non-seen sample problem using an smaller context size and generalizing the acquaintance obtained from the samples seen in the training phase to new test samples. However, there are two main issues that decrease the performance of n-gram models [BDVC03]: 1. Restricting context to few words: typically, the order of an n-gram model is set to 3. Sometimes it can be increased until 5. That means it usually takes into account 2 words, 4 at most. That is a small number if we deal with complex sentences from large corpora, where we have more information avaliable which is not exploited by the n-grams. 2. Not considering similarity between words: since n-gram models are merely based on word counts, they cannot extract semantic and grammatical information from vocabulary. For example, we have seen on the training phase the sentence "A car is crossing the road" and then in the test phase we see the sentence "The truck was driving on the highway". Then it is clear that we should be able to tag the test sentence as likely, because the words involved in both sentences have similar grammatical and semantic roles: "A"↔"The","car"↔"truck","road"↔"highway", etc. But if we use n-gram models, we are unable to extract that information. For the purpose of tackling these problems, many approaches have been developed. A family of them belongs to the so-called connectionist approach to the MT and is based on the use of Artificial Neural Networks in order to 20
Chapter 2 2.1. Language Models generate a language model [BDVC03]. As seen above, the goal of a language model is to learn the joint probability of a sequence of words in a language. That implies to model the joint distribution of many discrete random variables and generalize this model. The use of continuous variables (like multi-layer neural networks) helps to perform an easier generalization, because the function to learn is expected to have some local smoothness properties. More formally, let us define the training set as a sequence e1...eIof words ei∈V, where V⊆ E∗is a finite vocabulary set from the target language. Our goal is to learn a model: f(ei, ..., ei−n+1) = ˆ P(ei|ei−1 1)(2.12) which produces a low perplexity. Because we are working with distribution probabilities, we must add the following constraint to our model: for any choice of ei−1 1we must ensure that P|V| j=1 f(j, ei−1, ..., ei−n+1) = 1with f > 0. We can decompose this model (f(ei, ..., ei−n+1) = ˆ P(ei|ei−1 1)) in two parts: 1. A mapping for each word index of the vocabulary to a real distributed feature vector, i.e. a function C:N→Rmfrom any element ifrom V to a real vector C(i)∈Rm, where mis the size of the feature vector. This mapping Cis represented by a |V|×mmatrix of free parameters. 2. A probability function over words, expressed by means of the previous mapping C: we define a function g:N×Rm 1×... ×Rm n−1→RIwhich maps, for the next word ei, expressed by its index in the vocabulary vector, and an input sequence of feature vectors for words in context (C(ei−n+1), ..., C(ei−1)), to a conditional probability distribution over words in V. The output of gis a vector whose jth element estimates the probability ˆ P(ei=j|ei−1 1). The model function f:N1×... ×Nn→RIis a composition of these two functions: it receives an element from V,ei, represented by its index in the vocabulary, j=ei, and the context of this word, ei−1, ..., ei−n+1, and outputs the vector computed by g, where the ith element is the conditional probability for the input word and its context: f(ei, ei−1, ..., ei−n+1) = g(j, C(ei−1), ..., C(ei−n+1)) (2.13) Each one of these two functions has associated a set of parameters: 21
2.1. Language Models Chapter 2 1. Parameters of mapping C: feature vectors of the words. They are represented by a matrix C, of size |C|=|V| × m, where each row icorresponds to the feature vector C(i)for the word i. It should be noted that this matrix is shared by all the words in the context. 2. Parameters of function g: this function is implemented by means of a neural network with parameters ω. We can include those sets into an overall parameter set ΘLM = (C, ω). These parameters are estimated according the maximum likelihood estimator (see equation 1.5) for the training corpus, adding a regularization term R(ΘLM ): ˆ ΘLM = arg max ΘLM (1 IX i log f(ei, ei−1, ..., ei−n+1; ΘLM ) + R(ΘLM ))(2.14) Feed-Forward Networks The neural network language models gained attention after the publication of [BDVC03], although previous work on this area was done earlier. In this publication, the neural network used was a feed-forward neural network. Although these neural networks are able to address the n-gram problems of similarity between words and smoothing, they are still not free from the limitation history: their predictions for the next word are only based on the previous state of the hidden layer. With these neural networks, the problem is not solved and it is necesary to use other type of neural network. Recurrent Neural Network Language Model Because of the problem of representing the history, Thomas Mikolov proposed to use a recurrent neural network instead of a feed-forward network for modeling the previous function g[Mik12]. In general, a recurrent neural network is a class of artificial neural network where the connections between units form a directed cycle. This creates an internal state of the network which allows it to model temporal behaviours. From here, subindex iwill refer to the current state of the network, while subindex (i−1) will refer to the previous network state and so on. The network is composed by a set Y={yi,1, ..., yi,dY}of dYunits and a set W={wi,1, ..., wi,dW}of dWinputs [Cas14]. These connections are weighted by the sets of weights ωW(for the weights between input and output units) 22
Chapter 2 2.1. Language Models and ωY(for the weights between the output units of the previous state and the current output units). ωWcontains, for each input unit, connections to each output unit, hence, |ωW|=dX×dY. On its part, ωYcontains, for each output unit, the connections to all the output unit of the previous state, thereby, |ωY|=dy×dY. The system gets as input samples wi∈RdWand it outputs yi∈RdY,(i=i0, i0+ 1, i0+ 2, ...). Figure 2.1 shows the general architecture of a recurrent neural network. wi,1wi,2yi−1,1yi−1,2yi−1,3 Y1Y2Y3 yi,1yi,2yi,3 ωW ωY Figure 2.1: General recurrent neural network architecture. Here, dY= 3 and dW= 2. The approach presented by Mikolov makes use of the so-called Elman Networks. This is a neural network architecture which belongs to the group of augmented neural networks. This group of neural networks are distinguished by being the composition of a recurrent neural network with a feed-forward neural network. In Elman networks, the feed-forward neural network has only one layer, thus the network consists of a set W={wi,1, ..., wi,dW}of input units, a set S={si,1, ..., si,dH}hidden units and a set Y={yi,1, ..., yi,dY} of output units. As before, the connections are weighted by sets of weights. Since here is one more layer, we have one more set. Thus, the three sets are: the set of weights between the input layer and the hidden layer, ωW, of size dW×dH; the set of weights between the current hidden layer and the previous steps hidden layer, ωS, of size dH×dH×T, where Tis the number of times 23
2.1. Language Models Chapter 2 that the hidden layer state is stored; and finally, the set ωY,|ωY|=dH×dY, of weights between the hidden layer and the output layer. Figure 2.2 shows the general architecture of an Elman network. wi,1wi,2si−1,1si−1,2si−1,3 si,3 si,2 si,1 yi,1yi,2 ωW ωY ωS Figure 2.2: Elman recurrent neural network architecture, with dW= 2, dS = 3 and dY= 2. The notation used in the next sections is as follows: matrices are represented by uppercase letters, while a vector of the matrix is represented by the lowercase letter of the matrix, together with its index. When we tackle the language modeling problem, we have a vocabulary Vand a sequence of words eI 1=e1, ..., eI. These words enter to the network in a sequential way, from 1to Iand are all included in the vocabulary (eI 1(i)∈V, ∀i: 1 ≤i≤I). We can encode all the words of the sequence eI 1from 1to |V|with a binary vector of size |V|, where all the elements are equal to 0except the index that represents the word ei, which is equal to 1. Hence, the whole sequence of words is encoded through a 2-dimensional matrix of size I× |V|where the row iof the matrix contains a vector w(i) which represents the current word ei. This vector is the input layer to the network, thereby, |w(i)|≡|V|,∀i: 1 ≤i≤I, i.e. the input layer has the size of the vocabulary. 24
Chapter 2 2.1. Language Models Each layer of the network has associated its corresponding weight matrices, namely U(between input and hidden layer), W(between previous-step hidden layer and current hidden layer) and V(between hidden and output layer). For a schematic overview of the network, see Figure 2.3. w(i) s(i) y(i) s(i - 1) W U V Figure 2.3: Recurrent neural network language model scheme. Let us define the vector sas the output values in the hidden layer. Thereby s(i)are the hidden layer values of the current step and s(i−1) are the hidden layer values of the previous step. The output layer is represented by the vector y(i)and it expresses the value of ˆ P(ei+ 1|ei,s(i−1)), that, as shown in equation 2.12 is the probability that we are looking for. According to Elman networks, we compute the output values of the hidden layer, for 1≤h≤dHas: sh(i) = f |V| X j wj(i)·uhj + dH X l sl(i−1) ·whl (2.15) where dHis the number of units of the hidden layer and fis the sigmoid activation function: f(z) = 1 1+e−z. 25
2.3. Evaluation Chapter 2 Pr(fJ 1|eI 1) = α(eI 1)X B K Y k=1 p(e fk|e ek)(2.25) where p(e fk|e ek)is the phrase translation probability. It is estimated through relative frequencies: p(e f|e e) = N(e f, e e) N(e e)(2.26) where N(e e)is the count of the phrase e e, and N(e f, e e)is the count of the event that e fhas been seen as a translation of e ein the training corpus. If during the test phase appears an unknown word, this is translated by itself. It should be noted that the monotony constraint can lead to many translation errors in languages with different phrase order, for example, English- German. If monotonic alignments are not assumed, previous Equation 2.25 can be rewritten as [OM11]: Pr(fJ 1|eI 1) = X eaK 1 K Y k=1 p(e ak|e ak−1 1)·p(e fk|e eeak)(2.27) The search problem is tackled via the maximum approximation: ˆeI 1= arg max eI 1 Pr(eI 1)·α(eI 1)·X B Pr(e fK 1, B|e eK 1)≈ ≈arg max eI 1,B Pr(eI 1)·α(eI 1)max K,B ·Pr(e fK 1, B|e eK 1)(2.28) If only monotonic translations are allowed, this search can be efficiently computed through dynamic programming techniques. Otherwise, other techniques must be used, such as using a reordering graph and pruning [ZON02]. 2.3. Evaluation Up to now, we have some models to produce automatic translations. We are now interested in measure the quality of these translations. We are evaluating the output of the machine translation system, instead of its performance or usability. The output metrics can be categorized into two main categories: human evaluation and automatic evaluation. Human evaluation follows adequacy and fluency criteria. The adequacy criterion represents 32
Chapter 2 2.3. Evaluation how much of the meaning expressed in the source sentence is expressed in the target sentence and the fluency criterion measures how well-formed is a sentence, if it contains correct spellings, if it is an acceptable sentence in the target language, etc. These two criteria have an analogy with the aim of the translation models and language models, respectively; in the sense that a good language model will produce fluent outputs and a good translation model will produce adequate sentences. The human evaluation is very accurate and produces high quality metrics, but on the other hand, it is expensive and slow. It requires the establishment by human linguists of assessments of adequacy and fluency criteria. Then, human judges evaluate fluency and adequacy of the system translations [Fed08]. But MT researchers must receive a daily response from their systems. With human translation that is not possible, therefore, exist automatic MT metrics. They try to follow a similarity with human evaluation. They are inexpensive and fast, but the quality of these measures is lower than the human checking. Automatic metrics must be objective, informative, efficient and cheap. These methods compare the output of the system with highquality human translations, called references. In the next sections, we are reviewing some of the main automatic metrics for SMT. 2.3.1. Perplexity In the first place, we want to evaluate the quality of a language model, that means, how similar our estimation of the model distribution given by ΘLM is with respect of the real probability distribution (but unknown) Pr(eI 1). For that purpose, we can obtain an empirical estimation of the cross entropy of those distributions: let X={e1, e2, ..., eN}be the set of test samples and ΘLM is the set of language model parameters, the cross entropy is defined as: H(Pr;p(·|ΘLM )) = − N X i=1 Pr(ei)·log2p(ei|ΘLM )(2.29) The most extended metric in evaluation of statistical language models is the Perplexity. It is computed as: PPL(Pr;p(·|ΘLM )) = 2H(P r;p(·|ΘLM )) (2.30) The perplexity of a language model can be interpreted as the ability of a language model of predicting a sample. It also can be understood as the geometric average of the branching factor of the given language with respect 33
2.3. Evaluation Chapter 2 the model. It measures either the model performance and the language complexity. Of course, the lower the perplexity a model have, the better it is. 2.3.2. BLEU BLEU (BiLingual Evaluation Understudy) tries to model the correspondence between the output from a MT system and the one produced by a human. For BLEU score, the closer a machine translation is to a professional human translation, the better it is. This metric is applied to individual sentences, comparing them to their reference sentences. BLEU score is based on the idea of modified n-gram precision [PRWZ02]. This concept relies on the n-gram precision, which counts up the number of candidate words (unigrams) from the system translation which appear in the reference sentence, and divides this count by the total number of words of the translation from the system. The problem is that the system can generate too many reasonable words. For example, if we have the system translation “The the the the the the the.” and the reference translation is “The truck was driving on the highway.”, unigram precision will be 7/7. Obviously, this is absolutely not correct. Because of that, modified n-gram precision was defined as an extension of this procedure: first, the maximum number of times that a word happens in any reference translation is counted. Next, the count of each word in the sentence from the system is clipped by its maximum count. Clipped count operation is defined as: Countclip = min(Count, Max_Ref_Count). Back to our example, the system translation would obtain an unigram modified precision of 2/7, because counts of word the in the reference translation (2) represent an upper bound for the count of this word in system translation (7). This concept is extended to n-gram in a similar way: all candidate ngram counts are computed and clipped by their corresponding value, added and normalized by the total number of candidate n-gram. If we move our example to bigrams, the n-gram modified precision of the system translation is 0, since counts of the bigram the the on reference sentence is 0. The modified n-gram precision captures two important criteria of translation scoring, above mentioned: fluency and adequacy. A translation using the same words as in the reference sentence (unigram modified precision) will satisfy the adequacy criterion and a translation with longer n-grams will tend to achieve a high fluency [PRWZ02]. 34
Chapter 2 2.3. Evaluation BLEU score uses as basic computation unit a sentence and extends the computation to the whole test corpus, so, finally, an unique modified precision score for the entire corpus is generated by 1.computing the n-gram matches sentence by sentence and 2.adding the clipped n-gram counts for all these candidate sentences. Finally, this result is divided by the number of candidate n-grams in the test corpus: pn=PC∈{Candidates}Pn−gram∈C Countclip(n−gram) PC0∈{Candidates}Pn−gram0∈C0Countclip(n−gram0)(2.31) In addition, it is obvious that a translated sentence should be neither excessively long or short, therefore this must be reflected on the metric. System translations longer than references are naturally penalized by modified n-gram precision, but for shorter translations, it is introduced the so-called brevity penalty (BP) factor: a penalty factor which penalizes short translations in the following way: BP = 1,if c> r e1−r c,if c≤r (2.32) where cis the length of the system translation and ris the length of the corpus reference sentence. BLEU score uses a weighted geometric mean of the n-grams for combining them. Each n-gram has a weight wnsuch that PN n=1 wn= 1, but typically, this weight is set to wn=1 N. Hence, the final BLEU score of a test corpus is computed as: BLEU =BP ·exp N X n=1 wnlog pn!(2.33) 2.3.3. Other evaluation measures There are many other criteria for the evaluation of the output of a Machine Translation system. Here are four more automatic evaluation measures: WER (word error rate): this score is based on the Levenshtein distance, but it works at word level. WER is the minimum number of substitution, insertion and deletions operations that need to be performed to convert the system translation into the target sentence. 35
2.4. Parameter Estimation Chapter 2 PER (position-independent WER): is a metric derived from WER. While WER requires a perfect word order, PER compares the words in both sentences ignoring the order. SER (sentence error rate): SER is computed as the number of times that the sentence generated by the system corresponds exactly to one of the reference translations. TER (translation edit rate): TER computes the amount of edit operations needed to convert a translation hypothesis of the system into one of the reference sentences, normalized by the average length of the references [SDS+06]. 2.4. Parameter Estimation Now that the statistical models involved in the MT translation have been defined, it is time to estimate their sets of parameters. This task belongs to the training problem of machine learning. Standard techniques are used to estimate these parameters. In this section, the main techniques used in this work will be explained. 2.4.1. Expectation-Maximization algorithm The expectation-maximization algorithm (EM), also known as estimationmaximization, is used to find the maximum likelihood parameters of a statistical model where it depends on unobserved hidden variables. There are two main problems of statistical models for which EM algorithm is applied are: 1. These models involve latent variables, unknown parameters and a limited set of known data observations, i.e. usually there are missing values among the data. 2. Typically, finding the optimal maximum likelihood solutions implies the derivation of the likelihood function with respect all the unknown variables and solving the resulting equations. Usually, is not possible to carry this out analytically, due to the intractability of the likelihood function. Instead of this, likelihood function can be simplified by assuming the existence of additional hidden parameters. More formally, given a statistical model, EM algorithm assume that data Xis observed and generated by a distribution which has the set of parameters 36
Chapter 2 2.4. Parameter Estimation Θ. There is a complementary set of unobserved data Y, which, together with Xcompose the set of complete data Z= (X,Y). Finally, a probability density function is assumed for the complete data set: p(z|Θ) = p(x,y|Θ) = p(y|x,Θ) ·p(x|Θ) (2.34) From this equation, a new expression of the log-likelihood function is defined: L(Θ,z) = L(Θ,x,y). This function is known as complete data loglikelihood function while the original log-likelihood function L(Θ,x)is known as the incomplete data log-likelihood function. EM algorithm attempts to find the maximum likelihood estimator applying the following two steps: 1. Find the expected value (E) of the complete data log-likelihood function, log p(x,y|Θ), with respect the conditional distribution of the hidden data and the previous estimation of the model parameters: Q(Θ,Θt−1) = E[log p(x,y|Θ)|xΘt−1](2.35) Where Θt−1are the current estimated parameters, Θis are the new parameters that are being optimized to increase Q. 2. Find the set of parameters Θthat maximizes the quantity value, Q, computed at the previous step: Q(Θ,Θt−1) = arg max Θ Q(Θ,Θt−1)(2.36) This process is carried out iteratively, starting from initial parameter values, e.g. uniform parameter values. At each iteration of the algorithm, both steps are executed. Each iteration improves the log-likelihood of the incomplete data L(Θ,x)or leaves it unchanged. For most models, the EM algorithm reaches a local maximum of L(Θ,x). 37
2.4. Parameter Estimation Chapter 2 2.4.2. Backpropagation Through Time This is the training algorithm for the recurrent neural networks that are used in language modeling (see Section 2.1.3). Although typical Backpropagation algorithm can be used too in these networks, it does not take advantage of the capabilities of recurrent neural networks. With normal Backpropagation, the network tries to optimize its prediction of the next word based only on the previous word and the previous state of the hidden layer, but it does not store effectively valuable information for the future. In order to manage this capability of recurrent neural networks, it is necessary to extend the learning algorithm. This extension is known as Backpropagation through time algorithm. The idea of the algorithm is as follows: an Elman recurrent network, with one hidden layer which is used for Ntime steps, can be seen as a feedforward network with Nhidden layers (see Figure 2.5). This pseudo feedforward network can be trained by the normal gradient descent process: errors are propagated from the current hidden layer s(i)to the previous step hidden layer s(i−1) and the recurrent weight matrix Wis updated. Weight matrices U,Vand Ware initialized with small random numbers. The training of the network for one epoch is performed following Algorithm 20 [Mik12]. 38
Chapter 2 2.4. Parameter Estimation w(i) s(i) y(i) s(i - 1) W U V w(i-1) s(i - 2) W U w(i-2) s(i - 3) W U Figure 2.5: Recurrent neural network seen as a feedforward neural network unfolded 3 steps in time [Mik12]. 39
2.4. Parameter Estimation Chapter 2 Algorithm 1: Pseudocode for the backpropagation through time training algorithm. Input:X={e1, ..., en}(training corpus), pRNNLM (e)= { w(input layer), s(hidden layer), y(output layer)} (neural network), α(learning rate), T(steps back in time to propagate) Output:pRNNLM (e)= { w(input layer), s(hidden layer), y(output layer), vho (weights between sand y), ujh (weights between wand s), wlh (recurrent weights)} (trained neural network) 1Auxiliar: i(Time counter), 2δhj(e, i) = esj(i)(1 −sj(i)), 3d(i)(target vector to be predicted) 4begin 5i= 0 ;// Time counter initialization 6s(i) = 1 ;// Initialization of the hidden units 7foreach ei∈ X do 8i=i+ 1; 9w(i)←ei;// Present current word to the input layer 10 w(i) = s(i−1) ;// Copy the state of the previous hidden layer to the input layer // Compute output values of the hidden and output layer computation 11 sh(i) = fP|E| jwj(i)·uhj +PdH lsl(i−1) ·whl; 12 yo(i) = gPdH hsh(i)·voh; // Compute error gradient in the output layer 13 EO(t) = d(i)−y(i); 14 vho(i+ 1) = vho(i) + sh(i)·Eo(i)·α;// Weights update // Error gradient in the hidden layer 15 EH(i−τ−1) = δh(EH(i−τ)TW, i −τ−1); 16 if weight update necessary then // Weights update 17 ujh(i+ 1) = ujh(i) + PT z=0 wj(i−z)·Eh(i−z)·α; 18 wlh(i+ 1) = wlh(i) + PT z=0 sl(i−z−1) ·Eh(i−z)·α; 19 end 20 end 40
Chapter 2 2.4. Parameter Estimation If the update of the recurrent weight matrices is done at each training step, it would lead to a large computational complexity of the updating process: O(T×W), where Tis the number of steps back in time that are taken into account and Wis the number of training words. This can be solved by performing an offline training, updating the matrices after processing all the training samples. With a batch training the complexity is lower, but the performance of the network also worsens [Mik12]. The best solution is to choose a compromise: the weight update will be performed in mini-batches, after processing 10-20 training samples). This can effectively remove the term T in the previous expression. Each training step has a computational complexity O(dH×dH+dH×|V|), where dHis the size of the hidden layer and |V|is the size of the training vocabulary. Thus, the complexity of the complete training of the model is proportional to O(I×W×(dH×dH+dH× |V|)), where Iis the number of epochs performed before reaching to convergence and Wis the number of sentences in the training corpus. It is possible to lower this complexity by reducing the different factors involved in the training algorithm: training epochs, number of training sentences, vocabulary size (see Section 2.1.3) or size of the hidden layer. However, not all reductions are good: the reduction of the training corpus or choosing a small hidden layer size can lead to the degradation of the neural network and therefore, bad results. Both other speedups do not degrade that much the network, hence it is worth to use them [MDP+11]. 41
3.1. Experimentation Framework Chapter 3 3.1.2. Developed Experiment We carried out 3 different tasks of increasing complexity: Tourist, Xerox and Europarl. Each one of this tasks has 3 separate corpora, namely training, development and test. For each one of the tasks, we followed a common procedure of machine learning: first, we trained our models with the training corpus. Next we adjusted their parameters for the development set and, finally, with this parameters, we tested their performance on the test corpus. Figure 3.2 shows a diagram of the executed experimentation. TRAIN CORPUS WORD GRAPH DEVELOP. CORPUS N-BEST LIST THOT TRANS. MODEL THOT LANGUAGE MODEL THOT RESCORED CORPUS RNNLM LANGUAGE MODEL RNNLM RESCORED CORPUS RNNLM RESCORED CORPUS SRILM LANGUAGE MODEL THOT THOT THOT THOT THOT THOT THOT RNNLM RNNLM RNNLM +SRILMSRILM + SRILM Figure 3.2: Schema for the performed experimentation. The labels on the edges indicate the toolkit used to generate the target element. In this work, Thot has been used as baseline system. Since we are interested in the language model, we used the translation model provided by Thot for generating the word graphs and N-best lists for the development corpus. The rescoring of such sentences is performed by means of the recurrent neural network language model and its interpolation with the n-gram language model provided by SRILM. We use as main quality measure the BLEU score and all the weight adjustment task of the rescoring process is driven by this measure. Algorithm 2 shows the followed experimentation steps, for each task. This algorithm makes use of some auxiliary functions: 48
Chapter 3 3.1. Experimentation Framework T(C): training of an n-gram language model for corpus C. TBPTT(C): training of a recurrent neural network language model with BPTT algorithm for corpus C. Tt(p(e), w, C): training of a translation model for corpus Cusing the language model p(e)with weights w. word_graph((fi, ei), p(e), p(f|e)): obtains the word graph for the pair of sentences (fi, ei), according the language model p(e)and the translation model p(f|e). N−best_list(wg): obtains from the word graph wg its corresponding N-best list, as it is explained in Section 3.1.1. dhs(f, p): applies for the function fand parameters pthe downhill simplex optimization method, returning the optimal set of parameters. Reconstruct(NBL, w): from the set NBL of N-best lists and the set of weights w, obtains the highest ranked sentence for each N-best list. Finally, all the best sentences are collected and form a new rescored corpus of size |NBL|. BLEU(C,Cref ): computes the BLEU score for the corpora Cand Cref . PPL(p(e),C): computes the perplexity for the language model p(e)and the corpus C. 49
3.1. Experimentation Framework Chapter 3 Algorithm 2: Pseudocode for the experimentation process. Input:X={(f1, e1), ..., (fn, en)}(training corpus), D={(f0 1, e0 1), ..., (f0 n0, e0 n0)}(development corpus), T={(f00 1, e00 1), ..., (f00 n00 , e00 n00 )}(test corpus) Output:BLEUn(D),BLEURNNLM(D),BLEUinter(D), BLEUn(T),BLEURNNLM(T),BLEUinter(T) 1Auxiliar: pn(e)(n-gram language model), 2pRNNLM(e)(RNN language model), 3pinter(e)(interpolation of language models), 4p(f|e)(translation model), 5wm(parameters of model m), 6λ(interpolation weight) 7begin 8pn(e):= T(X); 9pRNNLM(e):= TBPTT(X); 10 pinter(e):= λ·pRNNLM(e) + (1 −λ)·pn(e); 11 wn:= dhs(PPL(pn(e),D), wpn); 12 p(f|e):= Tt(pn(e), wn,X); 13 foreach corpus ∈ {D,T } do 14 foreach (fi, ei)∈corpus do 15 wgi:= word_graph ((fi, ei),pn(e),p(f|e)); 16 nbli:= N-best_list(wgi); 17 foreach lm ∈ {n, RNNLM,inter}do 18 NBL := ∅; 19 foreach nblido 20 forall the sentence ∈nblido 21 p(e):= plm(sentence);// Sentence rescoring 22 NBL := NBL ∪p(e); 23 if corpus =Dthen 24 while (dhs((1 −BLEUplm (D0,D)), wplm )6=convergence) do 25 D0:= Reconstruct(NBL, wplm ); 26 wplm := dhs((1 −BLEUplm (D0,D)), wplm ); 27 BLEUlm(D):= BLEUplm (D0,D) 28 else 29 T0:= Reconstruct(NBL, wplm ); 30 BLEUlm(T):= BLEUlm(T0,T) 31 end 50
Chapter 3 3.1. Experimentation Framework For each task, we are going to present three main results: perplexity of the different estimated models, BLEU score for the development corpus and BLEU score for the test corpus. We performed a sampling between different size of the context which each language model handles. We collected results from 2-word contexts up to 5-word contexts. The n-gram models provided by Thot implement the Jelinek-Mercer smoothing technique (see 2.7). According to [CG98], the smoothing technique which offers a best performance is Kneser-Ney smoothing technique (see 2.11), hence, by default we used this technique in our experiments. However, in [CG98] is shown that Witten-Bell smoothing technique has a good performance if the training corpus is larger, therefore we tested it too. Kneser-Ney smoothing performed better than the Witten-Bell smoothing in two of the three tasks, nevertheless, in the Xerox task, Witten-Bell smoothing obtained better results (see Section 3.3.2). The results shown in the following sections make use of the Kneser-Ney smoothing technique, unless otherwise stated. To obtain the best network architecture, we tested many combinations of the network hyperparameters for each task, setting the backpropagation through time steps to 3. We computed perplexity for each one of the networks and we performed the interpolation between the neural network language model and a trigram language model. We selected as best network architecture that with a minimum perplexity. Then, we varied the backpropagation through time steps, from 2 up to 5. The default interpolation performed in the experiments was between language models with the same order, i.e. we interpolated bigrams with recurrent neural networks trained with 2 steps back in time, trigrams with networks with 3 steps back in time, etc. Interpolations of higher order models were performed too: we enlarged the steps back in time with which the network was trained and we interpolated these new networks with the n-gram language model that achieved the best result for each task. The interpolation weight λis task-dependent: for each task, we executed a scanning of this parameter, the perplexity of the resulting model for the λvalue was evaluated and we selected the λvalue which offered the lowest perplexity. 51
3.2. Tourist task Chapter 3 3.2. Tourist task 3.2.1. Overview This was a toy task which contained sentences typically said by a tourist at the reception of a hotel. It is a very simple and small corpus used to build the rescoring system and test it easily. In this experiment, we used Spanish as source language, and we want to translate it to English. Training, development and test partitions were carried out by extracting randomly sentences from the corpus. Table 3.1 shows the different partitions size. Spanish English Training Sentences 9 900 Running words 96 172 98 304 Vocabulary 690 517 Development Sentences 100 Running words 959 988 Test Sentences 2 996 Running words 35 023 35 590 Table 3.1: Tourist corpora statistics: number of sentences, words and vocabulary size for each one of the three corpora: training, development and test, for both languages. 3.2.2. Results We found that the best network architecture for this task had 50 hidden layer units and we set the number of classes to 200. We tested different number of classes, but the network accuracy did not improve, even using no classes. Since there were no improvements and the training and usage complexity was higher, we decided to set the classes parameter to 200. Perplexity Since this was a toy task, the perplexity was very low. Table 3.2 shows the perplexity values obtained by the difrerent language models, with different context sizes. As told above, the models involved in the interpolation had the same order. It is also reported the perplexity variation and variation percentage regarding the n-gram language model, which represents our baseline system. This variation is simply computed as: 52
Chapter 3 3.2. Tourist task V ar(PPL1, PPL22) = PPL2−PPL1(3.1) The variation percentage is computed as: %V ar(PPL1, PPL2) = 100 ·PPL2−PPL1 PPL1 (3.2) In all cases, we set as PPL1the value of the n-gram language model and as PPL2the value of the recurrent neural network language model. Language model Order Perplexity Variation % Variation N-gram 2 5.2 - - 3 3.5 - - 4 3.5 - - 5 3.5 - - 2 2.72 -2.48 -47.7 Recurrent 3 2.73 -0.77 -22 neural network 4 2.72 -0.78 -22.3 5 2.36 -1.14 -33.6 2 3.00 -2.2 -42.3 Interpolation 3 2.80 -0.7 -20 of models 4 2.76 -0.74 -21.1 52.07 -1.43 -40.9 Table 3.2: Tourist task perplexities for the development and test corpora, variations and variation percentages regarding the n-gram baseline system with the same context size. As we can see, even though the perplexity was very low, the neural networks language models were able to reduce it from a 22% up to a 47%. The interpolation between models had a similar performance than the solely use of neural networks. The interpolation factor was set to λ= 0.7. Such models reached a perplexity reduction greater than 40%. BLEU The BLEU scores of this task were extremely high: they were all over 86. Anyway, the recurrent neural network language model was able to overcome those results. It reached a top BLEU score for the development corpus of 91.68 and for the test corpus of 91.04. The neural network model improved 53
3.2. Tourist task Chapter 3 the score of the n-gram language model in almost all scenarios - there is only one case where the BLEU remained constant. The results are shown in Table 3.3, where it is reported the BLEU score for each context size, the variations of the recurrent neural network language models regarding their corresponding n-gram language model and the variation percentage. These values are computed in a similar way than before, using now the BLEU score: V ar(BLEU1, BLEU2) = BLEU2−BLEU1(3.3) %V ar(BLEU1, BLEU2) = 100 ·BLEU2−BLEU1 BLEU1 (3.4) As before, we set as BLEU1the one provided by the n-gram language model and as BLEU2that provided by the neural network language model or the interpolation between models. Development Test Language model Order BLEU Var. %Var. BLEU Var. %Var. N-gram 2 89.64 - - 86.98 - - 3 90.11 - - 88.27 - - 4 91.01 - - 89.39 - - 5 91.01 - - 89.36 - - 2 91.19 1.55 1.73 91.04 4.06 4.67 Recurrent 3 91.23 1.12 1.24 89.57 1.3 1.47 neural network 4 91.01 0 0 89.85 0.46 0.38 5 91.36 0.35 - 90.79 0.46 0.51 2 90.25 0.61 0.68 90.20 3.22 3.70 Interpolation 3 91.11 1.00 1.11 89.40 1.13 1.28 of models 4 91.34 0.33 0.36 90.61 1.22 1.36 591.68 0.67 0.73 90.28 0.92 1.03 Table 3.3: Tourist task BLEU scores for each language model and both corpora. It is also reported the variations of the neural-network-based language models with regard their corresponding n-gram language model, with the same context size. Once we confirmed that the n-gram model interpolation with the RNNLM outperformed the baseline system, we decided to enlarge the size of the context computed by the neural network. For doing that, we rescored once again the best set of sentences (provided in this case by the 5-gram language model), variating the backpropagation through time steps. The results are 54
Chapter 3 3.2. Tourist task shown in Figure 3.3. The best scores were provided by a context of 7 words. From here, if the context size is increased, the BLEU score is slightly reduced. 89 89.5 90 90.5 91 91.5 92 92.5 5 6 7 8 9 10 20 BLEU BPTT steps BLEU of development corpus from Tourist task Interpolated model 5−gram baseline model 89 89.5 90 90.5 91 91.5 92 92.5 5 6 7 8 9 10 20 BLEU BPTT steps BLEU of test corpus from Tourist task Interpolated model 5−gram baseline model Figure 3.3: BLEU of the Tourist task, for development and test corpora, with larger contexts of the recurrent neural network language models. The interpolation was performed between the 5-gram language model and the neural network trained with the shown backpropagation through time steps. 55
3.3. Xerox task Chapter 3 3.3. Xerox task 3.3.1. Overview This task consisted in the translation of sentences extracted from the user manuals of Xerox printers. The partitions were created in a similar way to the partitions of the tourist task. We translated from English to Spanish. Although it still consisted in a small task, it was much larger than the previous one. Table 3.4 shows the information related to the partitions. Spanish English Training Sentences 55 675 Running words 746 955 661 639 Vocabulary 17 148 14 510 Development Sentences 1 012 Running words 15 952 14 279 Test Sentences 1 125 Running words 10 084 8 348 Table 3.4: Xerox corpora statistics: number of sentences, words and vocabulary size for each one of the three corpora, training, development and test, and for both languages. 3.3.2. Results We found that the best network architecture had 400 hidden layer units and 200 classes. Here the class clustering of the words was not indispensable: it was possible to train the network with no classes, although it was a really slow process and, as before, there was no significant improvement with respect to the use of classes. Perplexity Table 3.5 shows the perplexity of the different language models for this task, with different context sizes. As before, it is reported the variation of the perplexity with regard to the n-gram baseline system and the variation percentage, computed according Equations 3.1 and 3.2. As we can see, there was a big difference between the use of bigrams and higher order ngram models. Anyway, the improvement of higher order n-grams reached a maximum with trigrams and neither 4-grams nor 5-grams were capable 56
Chapter 3 3.3. Xerox task to reduce this perplexity. Meanwhile, recurrent neural network language models by themselves could only enhance the perplexity of contexts of size 2. If they gazed at more words, their perplexities were worse than the ngram models ones. The greater perplexity reduction was reached by the interpolation between models: we found that the best result was obtained with an interpolation factor λ= 0.3175. With this technique, the perplexity of the task was reduced between a 21% and a 52%. Language model Order Perplexity Variation % Variation N-gram 2 46.9 - - 3 21.7 - - 4 21.7 - - 5 21.7 - - 2 38.59 -8.31 -17.71 Recurrent 3 36.08 14.38 +66.26 neural network 4 34.75 13.05 +60.01 5 32.01 10.31 +47.51 Interpolation of models 2 33.32 -13.58 -28.96 3 16.96 -4.74 -21.84 4 12.15 -9.55 -42.40 510.41 -11.29 -52.03 Table 3.5: Xerox task perplexities for the development and test corpora and the variation percentages with respect the n-gram baseline system with the same context size. It is remarkable that the best perplexity scores were obtained using the Witten-Bell smoothing technique on the n-grams which are interpolated with the network. The differences in the perplexities of the models with both different smoothing techniques are shown in Figure 3.4 and they were around the 15% of the perplexity value. 57
3.4. Europarl task Chapter 3 BLEU scores were lower than in the previous experiments but the improvements provided by the recurrent neural network language model were similar (between 1 and 2 points), in this experiment the improvement percentages were greater: they rose up to 8.25% for the development corpus and up to 8.99% for the test set. The results of the experimentation are shown in Table 3.9. It is reported the BLEU score obtained by the different language models and the BLEU variation of the neural network language models with respect the n-gram laguage models and the percentage that this variation represents with respect the n-gram language model. As in previous sections, these results are computed following Equations 3.3 and 3.4. Development Test Language model Order BLEU Var. %Var. BLEU Var. %Var. N-gram 2 18.62 - - 15.59 - - 3 22.14 - - 18.75 - - 4 22.27 - - 18.83 - - 5 22.07 - - 18.57 - - 2 19.53 0.91 4.88 16.35 0.76 4.87 Recurrent 3 22.86 0.72 3.25 19.53 0.78 4.16 neural network 4 23.69 1.42 6.37 20.08 1.25 6.64 5 23.81 1.74 7.88 20.11 1.54 8.29 2 19.42 0.80 4.29 16.36 0.77 4.94 Interpolation 3 23.26 1.12 5.06 19.93 1.18 6.29 of models 4 23.97 1.70 7.63 20.35 1.52 8.07 5 23.89 1.82 8.25 20.24 1.67 8.99 Table 3.9: Europarl task BLEU scores for each language model and both corpora. It is also reported the variations of the neural-network-based language models with respect their corresponding n-gram language model, with the same context size. As we increased the size of the context, we could see no further improvements. As Figure 3.7 shows, for the development set, there was a minimum rise of the BLEU for 8 steps back in time. The result for the test set, with 8 steps back in time, was lower than the result of a context of 4 steps. The best test result was obtained with 7 steps, but in this case, the performance for the development set fell from the best result. In conclusion, we could determine that the best context size for this task is 4 steps back in time. It should be mentioned that, as before, these results were computed based on the best previous result, i.e. using the recurrent netural network language model interpolated with a 4-gram language model. 64
Chapter 3 3.4. Europarl task 21.5 22 22.5 23 23.5 24 24.5 25 4 6 7 8 9 10 20 BLEU BPTT steps BLEU of development corpus from Europarl task Interpolated model 5−gram baseline model 18 18.5 19 19.5 20 20.5 21 4 6 7 8 9 10 20 BLEU BPTT steps BLEU of test corpus from Europarl task Interpolated model 5−gram baseline model Figure 3.7: Europarl task BLEU scores for each language model and both corpora. It is also reported the variations of the neural-network-based language models with regard their corresponding n-gram language model, with the same context size. 65
Chapter 4 Conclusions and Future Work 4.1. Conclusions We carried out a rescoring experimentation with satisfactory results: using the recurrent neural network language model solely, occurred a significant improvement in two of the three tasks, Tourist and Europarl. These models overcome the n-gram language models and offer, in these two tasks an average improvement of the BLEU score of 1.18 points. In the medium sized task, Xerox, this model lowered its performance, being unable to generally reduce the perplexity and increase the BLEU of the task. The results of the interpolation between this model and n-gram language models were even better: BLEU and per plexity were enhanced in all cases, yielding the maximum improvements reached in this experimentation. Excepting the first task, where the BLEU score is extremely high (using both n-gram and recurrent neural network models) and the improvements were not excessively large, the enhancements of the interpolation between models were greater than 2.5 points in the case of the Xerox task and greater than 1.5 in the Europarl task. We also tested the enlargement of the size of the context of the neural network language models. The results were similar to the shown in [Mik12], where the perplexity is compared. Although in this work the main metric used is BLEU, we can appreciate a relationship between both results. Our best results were achieved using contexts of 4-5 words. The system could enhance a little its performance using contexts of 7-8 words, but, from there, no further improvements were obtained. It can be concluded that context of 4-5 words should be enough to obtain good results. 66
Chapter 4 4.2. Future work It is remarkable that the improvements, since we used contexts of the same size for our experiments, are mostly due to the capability of the network to capture similarity between words. However, the neural network language model is able to manage larger contexts. We could have taken advantage of that if the N-best lists used in the rescoring process, were generated using higher order models. It is likely that this could lead to even better results. In spite of that, the theoretical advantages of the neural network language models were confirmed empirically with these experiments; giving to the future researches done in this field more guarantees. 4.2. Future work 4.2.1. Integration with Thot The experiments carried out, showed that the neural network language models improved the quality of the translations provided by Thot. Hence, the next natural step would be to integrate this language model into the Thot decoder. In this work, we performed the integration via N-best lists rescoring. In the future, the neural network language model should be coupled into the Thot decoder, offering its features in translation runtime. In addition, it should preserve the Thot feature of estimating its models incrementally. It is planned to develop the integration in a near future. 4.2.2. Parallelization of the Recurrent Neural Network Toolkit The training of the recurrent neural network is very costly, for instance, the training of the network used in the Europarl task with 8 steps back in time lasted for almost 160 hours. As it is pointed in [Mik12], it is necessary to parallelize the implementation of the neural network toolkit. Bengio et al. proposed a parallel implementation for their feedforward neural network model [BDVC03], hence the future work would consist in extending this parallel training to the recurrent neural network architecture and the backpropagation through time learning algorithm. 67
4.2. Future work Chapter 4 4.2.3. Bidirectional Recurrent Neural Networks The bidirectional recurrent neural networks are an extension of recurrent neural networks, which try to take advantage of all available input data, both past and future information [SP97]. For achieving this goal, the state neurons of the recurrent neural network are split in two parts: one which is responsible of the positive time direction and another which is responsible of the negative time direction. The training algorithms of these networks are the same as the regular RNN, with minor modifications. Thus, the idea of this approach is to predict the next word based on previous words and the next words to come. The utility of this bidirectional recurrent neural networks has been proved in the handwritten text recognition taks [GLF+09], where this approach overcomes the performance of classical approaches, such as Hidden Markov Models. It seems reasonable to think that this result could be extended to the machine translation task: if the predictions of the language model are based both in past and future history, it is likely that these predictions become more accurate than the ones which are based only on the past history. 68
Chapter 5 Bibliography [BDVC03] Y. Bengio, R. Ducharme, P. Vincent, and C.Jauvin. A neural probabilistic language model. Machine Learning Research, 3:1137–1155, February 2003. [BM00] E. Brill and R. C. Moore. An improved error model for noisy channel spelling correction. In Proceedings of the 38th Annual Meeting of the Association for Computational Linguistics, Hong Kong, 2000. [BPP+92] P. F. Brown, S. A. Della Pietra, V. J. Della Pietra, J. C. Lai, and R. L. Mercer. An estimate of an upper bound for the entropy of english. Comput. Linguist., 18(1):31–40, March 1992. [BPPM93] P. F. Brown, S. A. Della Pietra, V. J. Della Pietra, and R. L. Mercer. The mathematics of statistical machine translation: Parameter estimation. Computational Linguistics, 19(2):263– 311, 1993. [Cas14] F. Casacuberta. Advances in neural networks: Recurrent neural networks. University lecture: http://users.dsic.upv.es/~fcn/Students/ann/t3ann2p.pdf, 2014. [CG98] F. Chen and J. Goodman. An empirical study of smoothing techniques for language modeling. Technical Report TR-10-98, Computer Science Group, Harvard U., Cambridge, MA, 1998. [Fed08] M. Federico. Statistical machine translation. part iv: Mt evaluation. University lecture: 69
Chapter 5 http://medialab.di.unipi.it/web/SMT/SMT-0508-part-4- pp.pdf, 2008. [GLF+09] A. Graves, M. Liwicki, S. Fern’andez, R. Bertolami, H. Bunke, and J. Schmidhuber. A novel connectionist system for unconstrained handwriting recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 31(5):855–868, May 2009. [Goo01] J. Goodman. Classes for fast maximum entropy training. In Proceedings ICASSP, pages 561–564, 2001. [Hut95] W.J. Hutchins. Concise history of the language sciences: from the Sumerians to the cognitivists, chapter Machine Translation: A brief history, pages 431–445. Oxford: Pergamon Press, 1995. [Kni99] K. Knight. A Statistical MT Tutorial Workbook. Unpublished, 1999. [MDP+11] T. Mikolov, A. Deoras, D. Povey, L. Burget, and J. Èernocký. Strategies for training large scale neural network language models. In Proceedings of the Automatic Speech Recognition and Understanding: Language Modeling and ASR Systems, pages 196–201, Waikoloa, HI, 2011. [Mik12] T. Mikolov. Statistical Language Models based on Neural Networks. PhD thesis, Brno University of Technology, 2012. [MKB+11] T. Mikolov, S. Kombrink, L. Burget, J. Èernocký, and S. Khudanpur. Extensions of recurrent neural network language model. In Proceedings of the 2011 IEEE International Conference on Acoustics, Speech, and Signal Processing, pages 5528–5531, Prague, Czech Republic, 2011. [MKD+11a] T. Mikolov, S. Kombrink, A. Deoras, L. Burget, and J. Èernocký. Empirical evaluation and combination of advanced language modeling techniques. In Proceedings of the 12th Annual Conference of the International Speech Communication Association, pages 612–615, Florence, Italy, 2011. [MKD+11b] T. Mikolov, S. Kombrink, A. Deoras, L. Burget, and J. Èernocký. Rnnlm - recurrent neural network language modeling toolkit. In Automatic Speech Recognition and Understanding: Demo Session, Waikoloa, HI, 2011. 70
Chapter 5 [NM65] J. A. Nelder and R. Mead. A simplex method for function minimization. The Computer Journal, 7(4):308–313, January 1965. [OM11] D. Ortiz-Martínez. Advances in Fully-Automatic and Interactive Phrase-Based Statistical Machine Translation. PhD thesis, Universidad Politécnica de Valencia, 2011. [OMC14] D. Ortiz-Martínez and F. Casacuberta. The new thot toolkit for fully automatic and interactive statistical machine translation. In 14th Annual Meeting of the European Association for Computational Linguistics: System Demonstrations, Gothenburg, Sweden, April 2014. [PRWZ02] K. Papieni, S. Roukos, T. Ward, and W. Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311–318, Philadelphia, PE, July 2002. [SDS+06] M. Snover, B. Derr, R. Schwartz, L. Micciulla, and J. Makhoul. A study of translation edit rate with targeted human annotation. In Conferences of the Association for Machine Translation in the Americas, pages 223–231, Cambridge, MA, 2006. [SP97] M. Schuster and K. K. Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, November 1997. [Sto02] Andreas Stolcke. Srilm - an extensible language modeling toolkit. pages 901–904, 2002. [ZON02] R. Zens, F. J. Och, and H. Ney. Phrase-based statistical machine translation. In Advances in artificial intelligence. 25. Annual German Conference on AI, volume 2479 of LNCS, pages 18–32. Springer Verlag, September 2002. 71