Venue: NAACL 2018

# Improving Neural Machine Translation with Conditional Sequence Generative Adversarial Nets

Zhen Yang\({}^{1,2}\), Wei Chen\({}^{1*}\), Feng Wang\({}^{1,2}\), Bo Xu\({}^{1}\)

\({}^{1}\)Institute of Automation, Chinese Academy of Sciences

\({}^{2}\)University of Chinese Academy of Sciences

{yangzhen2014, wei.chen.media, feng.wang, xubo}@ia.ac.cn

###### Abstract

This paper proposes an approach for applying GANs to NMT. We build a conditional sequence generative adversarial net which comprises of two adversarial sub models, a generator and a discriminator. The generator aims to generate sentences which are hard to be discriminated from human-translated sentences ( i.e., the golden target sentences); And the discriminator makes efforts to discriminate the machine-generated sentences from human-translated ones. The two sub models play a mini-max game and achieve the win-win situation when they reach a Nash Equilibrium. Additionally, the static sentence-level BLEU is utilized as the reinforced objective for the generator, which biases the generation towards high BLEU points. During training, both the dynamic discriminator and the static BLEU objective are employed to evaluate the generated sentences and feedback the evaluations to guide the learning of the generator. Experimental results show that the proposed model consistently outperforms the traditional RNNSearch and the newly emerged state-of-the-art Transformer on English-German and Chinese-English translation tasks.

## 1 Introduction

Neural machine translation Kalchbrenner and Blunsom (2013); Sutskever et al. (2014); Cho et al. (2014); Bahdanau et al. (2014) which directly leverages a single neural network to transform the source sentence into the target sentence, has drawn more and more attention in both academia and industry Shen et al. (2015); Wu et al. (2016); Johnson et al. (2016); Gehring et al. (2017); Vaswani et al. (2017). This end-to-end NMT typically consists of two sub neural networks. The encoder network reads and encodes the source sentence into the context vector representation; and the decoder network generates the target sentence word by word based on the context vector. To dynamically generate a context vector for a target word being generated, the attention mechanism which enables the model to focus on the relevant words in the source-side sentence is usually deployed. Under the encoder-decoder framework, many variants of the model structure, such as convolutional neural network (CNN) and recurrent neural network (RNN) are proposed Bahdanau et al. (2014); Gehring et al. (2017). Recently, Gehring et al. (2017) propose the Transformer, the first sequence transduction model based entirely on attention, achieving state-of-the-art performance on the English-German and English-French translation tasks. Despite its success, the Transformer, similar to traditional NMT models, is still optimized to maximize the likelihood estimation of the ground word (M-LE) at each time step. Such an objective poses a hidden danger to NMT models. That is, the model may generate the best candidate word for the current time step yet a bad component of the whole sentence in the long run. Minimum risk training (MRT) Shen et al. (2015) is proposed to alleviate such a limitation by adopting the sequence level objective, i.e., the sentence-level BLEU, for traditional NMT models. Yet somewhat improved, this objective still does not guarantee the translation results to be natural and sufficient. Since the BLEU point is computed as the geometric mean of the modified n-gram precisions Papineni et al. (2002), almost all of the existing objectives essentially train NMT models to generate sentences with n-gram precisions as high as possible (MLE can be viewed to generate sentences with high 1-gram precisions). While n-gram precisions largely tell the good sentence apart from the bad one, it is widely acknowledged that higher n-gram precisions do not guarantee better sentences Callison-Burch and Osborne (2006); Chatterjee et al. (2007). Additionally, the manually defined objective, i.e.,

the n-gram precision, is unable to cover all crucial aspects of the data distribution and NMT models may be trained to generate suboptimal sentences Luc et al. (2016).

In this paper, to address the limitation mentioned above, we borrow the idea of generative adversarial training from computer vision Goodfellow et al. (2014); Denton et al. (2015) to directly train the NMT model generating sentences which are hard to be discriminated from human translations. The motivation behind is that while we can not manually define the data distribution of golden sentences comprehensively, we are able to utilize a discriminative network to learn automatically what the golden sentences look like. Following this motivation, we build a conditional sequence generative adversarial net where we jointly train two sub adversarial models: A generator generates the target-language sentence based on the input source-language sentence; And a discriminator, conditioned on the source-language sentence, predicts the probability of the target-language sentence being a human-generated one. During the training process, the generator aims to fool the discriminator into believing that its output is a human-generated sentence, and the discriminator makes efforts not to be fooled by improving its ability to distinguish the machine-generated sentence from the human-generated one. This kind of adversarial training achieves a win-win situation when the generator and discriminator reach a Nash Equilibrium Zhao et al. (2016); Arora et al. (2017); Guimaraes et al. (2017). Besides generating the desired distribution, we also want to directly guide the generator with a static and specific objective, such as generating sentences with high BLEU points. To this end, the smoothed sentence-level BLEU Nakov et al. (2012) is utilized as the reinforced objective for the generator. During training, we employ both the dynamic discriminator and the static BLEU objective to evaluate the generated sentences and feedback the evaluations to guide the learning of the generator. In summary, we mainly make the following contributions:

* To the best of our knowledge, this work is among the first endeavors to introduce the generative adversarial training into NMT. We directly train the NMT model to generate sentences which are hard to be discriminated from human translations. The proposed model can be applied to any end-to-end NMT systems.
* We conduct extensive experiments on English-German and Chinese-English translation tasks and we test two different NMT models, the traditional RNNSearch Bahdanau et al. (2014) and the state-of-the-art Transformer. Experimental results show that the proposed approach consistently achieves great success.
* Last but not least, we propose the smoothed sentence-level BLEU as the static and specific objective for the generator which biases the generation towards achieving high BLEU points. We show that the proposed approach is a weighted combination of the naive GAN and MRT.

## 2 Background and Related Work

### RNNSearch and Transformer

The RNNsearch is the traditional NMT model which has been widely explored. We follow the de facto standard implementation by Bahdanau et al. (2014). The encoder is a bidirectional gated recurrent units that encodes the input sequence \(x=(x_{1},\ldots,x_{m})\) and calculates the forward sequence of hidden states \((\overrightarrow{h_{1}},\ldots,\overrightarrow{h_{m}})\), and a backward sequence of hidden states \((\overleftarrow{h_{1}},\ldots,\overleftarrow{h_{m}})\). The final annotation vector \(h_{j}\) is calculated by concatenating \(\overrightarrow{h_{j}}\) and \(\overleftarrow{h_{j}}\). The decoder is a recurrent-t neural network that predicts a target sequence \(y=(y_{1},\dots,y_{n})\). Each word \(y_{i}\) is predicted on a recurrent hidden state \(s_{i}\), the previously predicted word \(y_{i-1}\) and a context vector \(c_{i}\). The \(c_{i}\) is computed as a weighted sum of the encoded annotations \(h_{j}\). The weight \(a_{ij}\) of each annotation \(h_{j}\) is computed by the attention mechanism, which models the alignment between \(y_{i}\) and \(x_{j}\).

The Transformer, recently proposed by Vaswani et al. (2017), achieves state-of-the-art results on both WMT2014 English-German and WMT2014 English-French translation tasks. The encoder of Transformer is composed of a stack of six identical layers. Each layer consists of a multi-head self-attention and a simple positionwise fully connected feed-forward network. The decoder is also composed of a stack of six identical layers. In addition to the two sub-layers in each encoder layer, the decoder inserts a third 

sub-layer, which performs multi-head attention over the output of the encoder stack. The Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers since it allows for significantly more parallelization.

### Generative adversarial nets

Generative adversarial network, has enjoyed great success in computer vision and has been widely applied to image generation (Zhu et al., 2017; Radford et al., 2015). The conditional generative adversarial nets (Gauthier, 2014) apply an extension of generative adversarial network to a conditional setting, which enables the networks to condition on some arbitrary external data. Some recent works have begun to apply the generative adversarial training into the NLP area: (Chen et al., 2016) apply the idea of generative adversarial training to sentiment analysis and (Zhang et al., 2017) use the idea to domain adaptation tasks. For sequence generation problem, (Yu et al., 2016) leverage policy gradient reinforcement learning to back-propagate the reward from the discriminator, showing presentable results for poem generation, speech language generation and music generation. Similarly, (Zhang et al., 2016) generate the text from random noise via adversarial training. A striking difference from the works mentioned above is that, our work is in the conditional setting where the target-language sentence is generated conditioned on the source-language one. In parallel to our work, (Li et al., 2017) propose a similar conditional sequence generative adversarial training for dialogue generation. They use a hierarchical long-short term memory (LSTM) architecture for the discriminator. In contrast to their approach, we apply the CNN-based discriminator for the machine translation task. Furthermore, we propose to utilize the sentence-level BLEU as the specific objective for the generator. Detailed training strategies for the proposed model and extensive quantitative results are reported. We noticed that (Wu et al., 2017) is exploring the potential of GAN in NMT too. There are some differences in training strategies and experimental settings between (Wu et al., 2017) and this work. And the most significant difference is that we propose a novel BLEU-reinforced GAN for NMT 1.

Footnote 1: The previous presentation of this work can be found at [https://arxiv.org/abs/1703.04887](https://arxiv.org/abs/1703.04887)

## 3 The Approach

### Model overview

In this section, we describe the architecture of the proposed BLEU reinforced conditional sequence generative adversarial net (referred to as BR-CSGAN) in detail. The sentence generation process is viewed as a sequence of actions that are taken according to a policy regulated by the generator. In this work, we take the policy gradient training strategies following (Yu et al., 2016). The whole architecture of the proposed model is depicted in figure 1. The model mainly consists of three sub modules:

**Generator** Based on the source-language sentences, the generator \(G\) aims to generate target-language sentences indistinguishable from human translations.

**Discriminator** The discriminator \(D\), conditioned on the source-language sentences, tries to distinguish the machine-generated sentences from human translations. \(D\) can be viewed as a dynamic objective since it is updated synchronously with G.

**BLEU objective** The sentence-level BLEU \(Q\) serves as the reinforced objective, guiding the generation towards high BLEU points. \(Q\) is a static function which will not be updated during training.

### Generator

Resembling NMT models, the generator \(G\) defines the policy that generates the target sentence \(y\) given the source sentence \(x\). The generator takes exactly the same architecture with NMT models. Note that we do not assume the specific architecture of the generator. To verify the effectiveness of the proposed method, we take two different architectures for the generator, the RNNSearch 2 and Transformer 3.

Footnote 2: [https://github.com/nyu-dl/dld4mt-tutorial](https://github.com/nyu-dl/dld4mt-tutorial)

Footnote 3: [https://github.com/tensorflow/tensor2lensor](https://github.com/tensorflow/tensor2lensor)

### Discriminator

Recently, the deep discriminative models such as the CNN and RNN have shown a high performance in complicated sequence classification tasks. Here, the discriminator is implemented based on the CNN architecture.

Since sentences generated by the generator have variable lengths, the CNN padding is used to transform the sentences to sequences with fixed length 

\(T\), which is the maximum length set for the output of the generator. Given the source-language sequence \(x_{1},\ldots,x_{T}\) and target-language sequence \(y_{1},\ldots,y_{T}\), we build the source matrix \(X_{1:T}\) and target matrix \(Y_{1:T}\) respectively as:

\[X_{1:T}=x_{1};x_{2};\dots;x_{T} \tag{1}\]

and

\[Y_{1:T}=y_{1};y_{2};\dots;y_{T} \tag{2}\]

where \(x_{t}\), \(y_{t}\in R^{k}\) is the \(k\)-dimensional word embedding and the semicolon is the concatenation operator. For the source matrix \(X_{1:T}\), a kernel \(w_{j}\in R^{l\times k}\) applies a convolutional operation to a window size of \(l\) words to produce a series of feature maps:

\[c_{ji}=\rho(BN(w_{j}\otimes X_{i:i+l-1}+b)) \tag{3}\]

where \(\otimes\) operator is the summation of element-wise production and \(b\) is a bias term. \(\rho\) is a non-linear activation function which is implemented as ReLu in this paper. Note that the batch normalization Ioffe and Szegedy (2015) which accelerates the training significantly, is applied to the input of the activation function (\(BN\) in equation 3). To get the final feature with respect to kernel \(w_{j}\), a max-over-time pooling operation is leveraged over the feature maps:

\[\widetilde{c}_{j}=max\{c_{j1},\ldots,c_{jT-l+1}\} \tag{4}\]

We use various numbers of kernels with different window sizes to extract different features, which are then concatenated to form the source-language sentence representation \(c_{x}\). Identically, the target-language sentence representation \(c_{y}\) can be extracted from the target matrix \(Y_{1:T}\). Finally, given the source-language sentence, the probability that the target-language sentence is being real can be computed as:

\[p=\sigma(V[c_{x};c_{y}]) \tag{5}\]

where \(V\) is the transform matrix which transforms the concatenation of \(c_{x}\) and \(c_{y}\) into a 2-dimension embedding and \(\sigma\) is the logistic function.

### BLEU objective

We apply the smoothed sentence-level BLEU as the specific objective for the generator. Given the generated sentence \(y_{g}\) and the the ground true sentence \(y_{d}\), the objective \(Q\) calculates a reward \(Q(y_{g},y_{d})\), which measures the n-gram precisions of the generated sentence \(y_{g}\). Identical to the output of the discriminator, the \(Q(y_{g},y_{d})\) also ranges from zero to one, which makes it easier to fuse \(Q\) and \(D\).

### Policy Gradient Training

Following Yu et al. (2016), the objective of the generator \(G\) is defined as to generate a sequence from the start state to maximize its expected end reward. Formally, the objective function is computed as:

\[J(\theta)=\sum_{Y_{1:T}}G_{\theta}(Y_{1:T}|X)\cdot R_{D,Q}^{G_{\theta}}(Y_{1: T-1},X,y_{T},Y^{*})\]

where \(\theta\) represents the parameters in \(G\), \(Y_{1:T}=y_{1},\ldots,y_{T}\) indicates the generated target sequence, \(X\) is the source-language sentence, \(Y^{*}\) represents the ground true target sentence. \(R_{D,Q}^{G_{\theta}}\) is the action-value function of a target-language sentence given the source sentence \(X\), i.e. the expected accumulative reward starting from the state \((Y_{1:T-1},X)\), taking action \(y_{T}\), and following the policy \(G_{\theta}\). To estimate the action-value function, we consider the estimated probability of being real by the discriminator \(D\) and the output of the BLEU objective \(Q\) as the reward:

\[R_{D,Q}^{G_{\theta}}(Y_{1:T-1},X,y_{T},Y^{*})=\] \[\lambda(D(X,Y_{1:T})-b(X,Y_{1:T}))+(1-\lambda)Q(Y_{1:T},Y^{*})\]

where b(X,Y) denotes the baseline value to reduce the variance of the reward. Practically, we take b(X,Y) as a constant, 0.5 for simplicity. And the \(\lambda\) is a hyper-parameter. The question is that, given the source sequence, \(D\) only provides a reward value for a finished target sequence. If \(Y_{1:T}\) is not a finished target sequence, the value of \(D(X,Y_{1:T})\) makes no sense. Therefore, we cannot get the

Figure 1: The Illustration of the proposed BR-CSGAN. Left: D is trained over the real sentence pairs translated by the human and the generated sentence pairs by G. Note that D is a conditional discriminator. Right: G is trained by police gradient where the final reward is provided by D and Q.

 

action-value for an intermediate state directly. To evaluate the action-value for an intermediate state, the Monte Carlo search under the policy of \(G_{\theta}\) is applied to sample the unknown tokens. Each search ends until the end of sentence token is sampled or the sampled sentence reaches the maximum length. To obtain more stable reward and reduce the variance, we represent an N-time Monte Carlo search as:

\[\{Y^{1}_{1:T_{1}},\ldots,Y^{N}_{i:T_{N}}\}=MC^{G_{\theta}}((Y_{1:t},X),N)\]

where \(T_{i}\) represents the length of the sentence sampled by the \(i\)'th Monte Carlo search. \((Y_{1:t},X)=(y_{1},\ldots,y_{t},X)\) is the current state and \(Y^{N}_{t+1:T_{N}}\) is sampled based on the policy \(G_{\theta}\). The discriminator provides \(N\) rewards for the sampled \(N\) sentences respectively. The final reward for the intermediate state is calculated as the average of the \(N\) rewards. Hence, for the target sentence with the length \(T\), we compute the reward for \(y_{t}\) in the sentence level as:

Using the discriminator as a reward function can further improve the generator iteratively by dynamically updating the discriminator. Once we get more realistic generated sequences, we re-train the discriminator as:

After updating the discriminator, we are ready to re-train the generator. The gradient of the objective function \(J(\theta)\) w.r.t the generator's parameter \(\theta\) is calculated as:

### Training strategies

GANs are widely criticized for its unstable training since the generator and discriminator need to be carefully synchronized. To make this work easier to reproduce, this paper gives detailed strategies for training the proposed model.

Firstly, we use the maximum likelihood estimation to pre-train the generator on the parallel training set until the best translation performance is achieved. Then, generate the machine-generated sentences by using the generator to decode the training data. We simply use the greedy sampling method instead of the beam search method for decoding. Next, pre-train the discriminator on the combination of the true parallel data and the machine-generated data until the classification accuracy achieves at \(\xi\). Finally, we jointly train the generator and discriminator. The generator is trained with the policy gradient training method. However, in our practice, we find that updating the generator only with the simple policy gradient training leads to unstableness. To alleviate this issue, we adopt the teacher forcing approach which is similar to Lamb et al. (2016); Li et al. (2017). We directly make the discriminator to automatically assign a reward of 1 to the golden target-language sentence and the generator uses this reward to update itself on the true parallel example. We run the teacher forcing training for one time once the generator is updated by the policy gradient training. After the generator gets updated, we use the new stronger generator to generate \(\eta\) more realistic sentences, which are then used to train the discriminator. Following Arjovsky et al. (2017), we clamp the weights of the discriminator to a fixed box ( [\(-\epsilon\),\(\epsilon\)] ) after each gradient update. We perform one optimization step for the discriminator for each step of the generator. In our practice, we set \(\xi\) as 0.82, \(\eta\) as 5000, \(\epsilon\) as 1.0 and the \(N\) for Monte Carlo search as 20.

## 4 Experiments and Results

We evaluate our BR-CSGAN on English-German and Chinese-English translation tasks and we test two different architectures for the generator, the traditional RNNSearch and the newly emerged state-of-the-art Transformer.

### Data sets and preprocessing

English-German: For English-German translation, we conduct our experiments on the publicly available corpora used extensively as benchmark for N-MT systems, WMT'14 En-De. This data set contains 4.5M sentence pairs 4. Sentences are encoded using byte-pair encoding Sennrich et al. (2015), which has a shared source-target vocabulary of about 37000 tokens. We report results on newstest2014. The newstest2013 is used as validation.

 

Chinese-English: For Chinese-English translation, our training data consists of 1.6M sentence pairs randomly extracted from LDC corpora 5. Both the source and target sentences are encoded with byte-pair encoding and the tokens in the source and target vocabulary is about 38000 and 34000 respectively 6. We choose the NIST02 as the development set. For testing, we use NIST03, NIST04 and NIST05 data sets.

Footnote 5: LDC2002L27, LDC2002T01, LDC2002E18, LDC2003E07, LDC2004T08, LDC2004E12, LDC2005T10

Footnote 6: When doing BPE for Chinese, we need to do word segmentation first and the following steps are the same with BPE for English.

To speed up the training procedure, sentences of length over 50 words are removed when we conduct experiments on the RNNSearch model. This is widely used by previous works Ranzato et al. (2015); Shen et al. (2015); Yang et al. (2016).

### Model parameters and evaluation

For the Transformer, following the base model in Vaswani et al. (2017), we set the dimension of word embedding as 512, dropout rate as 0.1 and the head number as 8. The encoder and decoder both have a stack of 6 layers. We use beam search with a beam size of 4 and length penalty \(\alpha=0.6\). For the RNNSearch, following Bahdanau et al. (2014), We set the hidden units for both encoders and decoders as 512. The dimension of the word embedding is also set as 512. We do not apply dropout for training the RNNSearch. During testing, we use beam search with a beam size of 10 and length penalty is not applied.

All models are implemented in TensorFlow Abadi et al. (2015) and trained on up to four K80 GPUs synchronously in a multi-GPU setup on a single machine 7. We stop training when the model achieves no improvement for the tenth evaluation on the development set. BLEU Papineni et al. (2002) is utilized as the evaluation metric. We apply the script _mteval-v1lb.pl_ to evaluate the Chinese-English translation and utilize the script _multi-belt.pl_ for English-German translation 8.

Footnote 7: The code we used to train and evaluate our models can be found at [https://github.com/ZhenYangIACAS/NMT_GAN](https://github.com/ZhenYangIACAS/NMT_GAN)

Footnote 8: [https://github.com/mooses-smt/mossedecoder/blob/617e8c8/scripts/generic/multi-bleu.perl](https://github.com/mooses-smt/mossedecoder/blob/617e8c8/scripts/generic/multi-bleu.perl);mteval-v11b.pl

### Main results

The model of RNNSearch is optimized with the mini-batch of 64 examples. It takes about 30 hours to pre-train the RNNSearch on the Chinese-English data set and 46 hours on the English-German data set. During generative adversarial training, it takes about 35 hours on the Chinese-English data set and about 50 hours on the English-German data set. For the Transformer, each training batch contains a set of sentence pairs containing approximately 25000 source tokens and 25000 target tokens. On the Chinese-English data set, it takes about 15 hours to do pre-training and 20 hours to do generative adversarial training. On the English-German data set, it takes about 35 hours for the pre-training and 40 hours for the generative adversarial training.

Table 1 shows the BLEU score on Chinese-English and English-German test sets. On the RNNsearch model, the naive GAN (i.e., the line of RNNSearch+BR-CSGAN (\(\lambda\)=1) in table 1) achieves improvement up to +1.11 BLEU points averagely on Chinese-English test sets and +0.9 BLEU points on English-German test set. Armed

\begin{table}
\begin{tabular}{p{71.1pt}|p{34.1pt} p{34.1pt} p{34.1pt} p{34.1pt}|p{34.1pt}} \hline \hline Model & \multicolumn{4}{c|}{Chinese-English} & \multicolumn{1}{p{34.1pt}}{English-German} \\  & NIST03 & NIST04 & NIST05 & average & newstest2014 \\ \hline RNNSearch Bahdanau et al. (2014) & 33.93 & 35.67 & 32.24 & 33.94 & 21.2 \\ Transformer Vaswani et al. (2017) & 42.23 & 42.17 & 41.02 & 41.80 & 27.30 \\ \hline \hline RNNSearch+BR-CSGAN(\(\lambda=1.0\)) & 35.21 & 36.51 & 33.45 & 35.05 & 22.1 \\ RNNSearch+BR-CSGAN(\(\lambda=0.7\)) & 35.97 & 37.32 & 34.03 & **35.77** & **22.89** \\ RNNSearch+BR-CSGAN(\(\lambda=0\)) & 34.57 & 35.93 & 33.07 & 34.52 & 21.75 \\ \hline Transformer+BR-CSGAN(\(\lambda=1.0\)) & 42.67 & 42.79 & 41.54 & 42.30 & 27.75 \\ Transformer+BR-CSGAN(\(\lambda=0.8\)) & 43.01 & 42.96 & 41.86 & **42.61** & **27.92** \\ Transformer+BR-CSGAN(\(\lambda=0\)) & 42.41 & 42.74 & 41.29 & 42.14 & 27.49 \\ \hline \hline \end{tabular}
\end{table}
Table 1: BLEU score on Chinese-English and English-German translation tasks. The hyper-parameter \(\lambda\) is selected according to the development set. For the Transformer, following Vaswani et al. (2017), we report the result of a single model obtained by averaging the 5 checkpoints around the best model selected on the development set.

 

with the BLEU objective, the BR-CSGAN (the line of RNNSearch+BR-CSGAN (\(\lambda\)=0.7)) leads to more significant improvements, +1.83 BLEU points averagely on Chinese-English translation and +1.69 BLEU points on English-German translation. We also test the translation performance when the RNNSearch is only guided by the static BLEU objective (the line of RNNsearch+BR-CSGAN (\(\lambda\)=0)), and we only get +0.58 BLEU points improvement on Chinese-English translation and +0.55 BLEU points improvement on English-German. Experiments on the Transformer show the same trends. While the Transformer has achieved state-of-the-art translation performances, our approach still achieves +0.81 BLEU points improvement on Chinese-English translation and +0.62 BLEU points improvement on English-German.

These results indicate that the proposed BR-CSGAN consistently outperforms the baselines and it shows better translation performance than the naive GAN and the model guided only by the BLEU objective.

## 5 Analysis

### Compared with MRT

We show that MRT [4] is an extreme case of our approach. Considering a sentence pair \((x,y)\), the training objective of MRT is calculated as

\[\widehat{J}(\theta^{\prime})=\sum_{y^{s}\in S(x)}p(y^{s}|x;\theta^{\prime}) \Delta(y^{s},y)\]

where \(\Delta(y^{s},y)\) is a loss function (i.e., the sentence-level BLEU used in this paper) that measures the discrepancy between a predicted translation \(y^{s}\) and the training example \(y\), \(S(x)\) represents the set which contains all of the predictions given the input \(x\), and \(\theta^{\prime}\) is the parameters of the N-MT model. Unfortunately, this objective is usually intractable due to the exponential search space. To alleviate this problem, a subset of the search space is sampled to approximate this objective. In this paper, when we set \(\lambda\) as zero, the objective for the proposed BR-CSGAN comes to

\[J(\theta)_{\lambda=0}=\sum_{Y_{1:T}}G_{\theta}(Y_{1:T}|X)\cdot Q(Y_{1:T},Y^{*})\]

where the \(Q(Y_{1:T},Y^{*})\) is also a loss function between the predicted translation \(Y_{1:T}\) and the training example \(Y^{*}\). It is easy to be found that, under this condition (i.e., \(\lambda\) set as zero), the proposed BR-CSGAN optimizes almost the same objective with MRT. The only difference is that the reinforcement learning procedure is utilized in BR-CSGAN to maximize the total reward and M-RT instead applies random sampling to approximate the risk. Actually, the BR-CSGAN is a weighted sum of the naive GAN (\(\lambda\)=1) and MRT (\(\lambda\)=0), and it incorporates the advantages of the t-wo approaches. Specifically, compared to naive GAN which is trained without specific objective guidance, BR-CSGAN utilizes the BLEU objective to guide the generator to generate sentences with higher BLEU points. And compared to M-RT which is trained only with the static objective, the BR-CSGAN applies a dynamic discriminator which updates synchronously with the generator, to feedback the dynamic rewards for the generator. Table 2 compares the translation performance between the MRT and BR-CSGAN on Chinese-English and English-German translation tasks. We only conduct experiments on the RNNSearch because we only get the open-source implementation of MRT on the RNNSearch 9. Results show that the proposed BR-CSGAN consistently outperforms the MRT on the Chinese-English and English-German translations.

Footnote 9: The open-source implementation can be found at: [http://github.com/EdinburghNLP/nematus](http://github.com/EdinburghNLP/nematus)

### When to stop pre-training

The initial accuracy \(\xi\) of the discriminator which is viewed as a hyper-parameter, can be set carefully during the process of pre-training. A natural question is that when shall we end the pre-training. Do we need to pre-train the discriminator with the highest accuracy? To answer this question, we test the impact of the initial accuracy of the discriminator. We pre-train five discriminators which have the accuracy as 0.6, 0.7, 0.8, 0.9 and 0.95 respectively. With the five discriminators, we train five different BR-CSGAN models (with the generator as RNNSearch and \(\lambda\) set as 0.7) and test

\begin{table}
\begin{tabular}{c|c|c} \hline \multirow{2}{*}{Model} & Chinese-English & English-German \\  & average & newstest2014 \\ \hline RNNSearch & 33.94 & 21.2 \\ MRT [4] & 34.64 & 21.6 \\ BR-CSGAN(\(\lambda=0.7\)) & 35.77 & 22.89 \\ \hline \end{tabular}
\end{table}
Table 2: BLEU score on Chinese-English and English-German translation tasks for MRT and BR-CSGAN.

 

their translation performances on the development set at regular intervals. Figure 2 reports the results and we can find that the initial accuracy of the discriminator shows great impacts on the translation performance of the proposed BR-CSGAN. From figure 2, we show that the initial accuracy of the discriminator needs to be set carefully and either it is too high (0.9 and 0.95) or too low (0.6 and 0.7), the model performs badly 10. This suggests that it is important for the generator and discriminator to keep a balanced relationship at the beginning of the generative adversarial training. If the discriminator is too strong, the generator is always penalized for its bad predictions and gets no idea about right predictions. Hence, the generator is discouraged all the time and the performance gets worse and worse. On the other hand, if the discriminator is too weak, the discriminator is unable to give right guidance for the generator, i.e. the gradient direction for updating the generator is random. Empirically, we pre-train the discriminator until its accuracy reaches around 0.8.

Footnote 10: To make the illustration simple and clear, we only depict the results when the RNNSearch acts as the generator.

### Sample times for Monto Carol search

We are also curious about how the sample times \(N\) for Monte Carlo search affects the translation performance. Intuitively, if \(N\) is set as a small number, the intermediate reward for each word may be incorrect since there is a large variance for the Monto Carol search when the sample time is too small. And if otherwise, the computation shall be very time consuming because we need to do much more sampling. Therefore, there is a trade-off between the accuracy and computation complexity here. We investigate this problem on the Chinese-English translation task. Table 3 presents the translation performance of the BR-CSGAN on the test sets when the \(N\) are set from 5 to 30 with interval 5. From table 3, the proposed model achieves no improvement than the baseline (i.e., the pre-trained generator) when \(N\) are set less than 15 and the BLEU scores are not reported on the table. As a matter of fact, the translation performance of the model gets worse and worse. We conjecture that the approximated reward is far from the expected reward due to the large variance when \(N\) is set too small, and gives wrong gradient directions for model updating. Since the training for GAN is not stable, the wrong gradient direction exacerbates the unstableness and results in the BLEU getting worse and worse. With the increasing of \(N\), the translation performance of the model gets improved. However, with \(N\) set larger than 20, we get little improvement than the model with \(N\) set as 20 and the training time exceeds our expectation.

## 6 Conclusion and Future Work

In this work, we propose the BR-CSGAN which leverages the BLEU reinforced generative adversarial net to improve the NMT. We show that the proposed approach is a weighted combination of the naive GAN and MRT. To verify the effectiveness of our approach, we test two different architectures for the generator, the traditional RNNSearch and the state-of-the-art Transformer.

Figure 2: BLEU score on the development set for the BR-CSGAN where the discriminators have differentiated initial accuracy. ”0.6-acc” means the initial accuracy is 0.6. We report the results on the Chinese-English translation tasks. RNNSearch is taken as the generator.

 

Extensive experiments on Chinese-English and English-German translation tasks show that our approach consistently achieves significant improvements. In the future, we would like to try multi-adversarial framework which consists of multi discriminators and generators for GAN.

## Acknowledgements

This work is supported by the National Key Research and Development Program of China under Grant No. 2017YFB1002102, and Beijing Engineering Research Center under Grant No. Z171100002217015. We would like to thank X-u Shuang for her preparing data used in this work. Additionally, we also want to thank Chen Zhiheng, Wang Wenfu and Zhao Yuanyuan for their invaluable discussions on this work.

## References

* Abadi et al. (2015) Martin Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Vu, and Xiaoqiang Zheng. 2015. TensorFlow: Large-scale machine learning on heterogeneous systems .
* Arjovsky et al. (2017) Martin Arjovsky, Soumith Chintala, and Leon Bottou. 2017. Wasserstein gan. _arXiv preprint arXiv:1701.07875_ .
* Arora et al. (2017) Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. 2017. Generalization and equilibrium in generative adversarial nets. _ICML_ .
* Bahdanau et al. (2014) Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. _arXiv preprint arXiv:1409.0473_ .
* Callison-Burch and Osborne (2006) Chris Callison-Burch and Miles Osborne. 2006. Reevaluating the role of bleu in machine translation research .
* Chatterjee et al. (2007) Niladri Chatterjee, Anish Johnson, and Madhav Krishna. 2007. Some improvements over the bleu metric for measuring translation quality for hindi. In _Computing: Theory and Applications, 2007. ICCTA'07. International Conference on_. IEEE, pages 485-490.
* Chen et al. (2016) Xilun Chen, Yu Sun, Ben Athiwaratchun, Claire Cardiie, and Kilian Weinberger. 2016. Adversarial deep averaging networks for cross-lingual sentiment classification. _arXiv preprint arXiv:1606.01614_ .
* Cho et al. (2014) Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using rnn encoder-decoder for statistical machine translation. _arXiv preprint arXiv:1406.1078_ .
* Denton et al. (2015) Emily L Denton, Soumith Chintala, Rob Fergus, et al. 2015. Deep generative image models using a? laplacian pyramid of adversarial networks. In _Advances in neural information processing systems_. pages 1486-1494.
* Gauthier (2014) Jon Gauthier. 2014. Conditional generative adversarial nets for convolutional face generation. _Class Project for Stanford CS231N: Convolutional Neural Networks for Visual Recognition, Winter semester_ 2014(5):2.
* Gehring et al. (2017) Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. 2017. Convolutional sequence to sequence learning .
* Goodfellow et al. (2014) Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjl Ozair, Aaron Courville, and Yoshua Bengio. 2014. Generative adversarial nets. In _Advances in neural information processing systems_. pages 2672-2680.
* Guimaraes et al. (2017) Gabriel Lima Guimaraes, Benjamin Sanchez-Lengeling, Pedro Luis Cunha Farias, and Alan Aspuru-Guzik. 2017. Objective-reinforced generative adversarial networks (organ) for sequence generation models. _arXiv preprint arXiv:1705.10843_ .
* Ioffe and Szegedy (2015) Sergey Ioffe and Christian Szegedy. 2015. Batch normalization: Accelerating deep network training by reducing internal covariate shift. _arXiv preprint arXiv:1502.03167_ .
* Johnson et al. (2016) Melvin Johnson, Mike Schuster, Quoc V Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda Viegas, Martin Wattenberg, Greg Corrado, et al. 2016. Google's multilingual neural machine translation system: Enabling zero-shot translation. _arXiv preprint arXiv:1611.04558_ .
* Kalchbrenner and Blunsom (2013) Nal Kalchbrenner and Phil Blunsom. 2013. Recurrent continuous translation models. _EMNLP_ pages 1700-1709.
* Lamb et al. (2016) Alex Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron Courville, and Yoshua Bengio. 2016. Professor forcing: A new algorithm for training recurrent networks. _Advances In Neural Information Processing Systems_ pages 4601-4609.
* Li et al. (2017) Jiwei Li, Will Monroe, Tianlin Shi, Alan Ritter, and Dan Jurafsky. 2017. Adversarial learning for neural dialogue generation. _arXiv preprint arXiv:1701.06547_ .

 

Pauline Luc, Camille Couprie, Soumith Chintala, and Jakob Verbeek. 2016. Semantic segmentation using adversarial networks. _arXiv preprint arXiv:1611.08408_ .
* Nakov et al. (2012) Preslav Nakov, Francisco Guzman, and Stephan Vogel. 2012. Optimizing for sentence-level bleu+ 1 yields short translations. In _COLING_. volume 12, pages 1979-1994.
* Papineni et al. (2002) Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. _Association for Computational Linguistics_ pages 311-318.
* Radford et al. (2015) Alec Radford, Luke Metz, and Soumith Chintala. 2015. Unsupervised representation learning with deep convolutional generative adversarial networks. _arXiv preprint arXiv:1511.06434_ .
* Ranzato et al. (2015) Marc'Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. 2015. Sequence level training with recurrent neural networks. _arXiv preprint arXiv:1511.06732_ .
* Sennrich et al. (2015) Rico Sennrich, Barry Haddow, and Alexandra Birch. 2015. Neural machine translation of rare words with subword units. _Computer Science_ .
* Shen et al. (2015) Shiqi Shen, Yong Cheng, Zhongjun He, Wei He, Hua Wu, Maosong Sun, and Yang Liu. 2015. Minimum risk training for neural machine translation. _arXiv preprint arXiv:1512.02433_ .
* Sutskever et al. (2014) Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. 2014. Sequence to sequence learning with neural networks. _Advances in neural information processing systems_ pages 3104-3112.
* Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need .
* Wu et al. (2017) Lijun Wu, Yingce Xia, Li Zhao, Fei Tian, Tao Qin, Jianhuang Lai, and Tie-Yan Liu. 2017. Adversarial neural machine translation. _arXiv preprint arXiv:1704.06933_ .
* Wu et al. (2016) Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. _arXiv preprint arXiv:1609.08144_ .
* Yang et al. (2016) Zhen Yang, Wei Chen, Feng Wang, and Bo Xu. 2016. A character-aware encoder for neural machine translation. In _COLING_.
* Yu et al. (2016) Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. 2016. Seqgan: Sequence generative adversarial nets with policy gradient. _The Association for the Advancement of Artificial Intelligence 2017_ .
* Zhang et al. (2016) Yizhe Zhang, Zhe Gan, and Lawrence Carin. 2016. Generating text via adversarial training. _NIPS_ .
* Zhang et al. (2017) Yuan Zhang, Regina Barzilay, and Tommi Jaakko-la. 2017. Aspect-augmented adversarial networks for domain adaptation. _arXiv preprint arXiv:1701.00188_ .
* Zhao et al. (2016) Junbo Zhao, Michael Mathieu, and Yann LeCun. 2016. Energy-based generative adversarial network. _arXiv preprint arXiv:1609.03126_ .
* Zhu et al. (2017) Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. 2017. Unpaired image-to-image translation using cycle-consistent adversarial networks. _arXiv preprint arXiv:1703.10593_ .