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 (MLE) 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)111This paper has been accepted by NAACL-HLT2018.. 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. 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=(x1,…,xm)𝑥subscript𝑥1…subscript𝑥𝑚x=(x_{1},\ldots,x_{m}) and calculates the forward sequence of hidden states (h1→,…,hm→)→subscriptℎ1…→subscriptℎ𝑚(\overrightarrow{h_{1}},\ldots,\overrightarrow{h_{m}}), and a backward sequence of hidden states (h1←,…,hm←)←subscriptℎ1…←subscriptℎ𝑚(\overleftarrow{h_{1}},\ldots,\overleftarrow{h_{m}}). The final annotation vector hjsubscriptℎ𝑗h_{j} is calculated by concatenating hj→→subscriptℎ𝑗\overrightarrow{h_{j}} and hj←←subscriptℎ𝑗\overleftarrow{h_{j}}. The decoder is a recurrent neural network that predicts a target sequence y=(y1,…,yn)𝑦subscript𝑦1…subscript𝑦𝑛y=(y_{1},\ldots,y_{n}). Each word yisubscript𝑦𝑖y_{i} is predicted on a recurrent hidden state sisubscript𝑠𝑖s_{i}, the previously predicted word yi−1subscript𝑦𝑖1y_{i-1} and a context vector cisubscript𝑐𝑖c_{i}. The cisubscript𝑐𝑖c_{i} is computed as a weighted sum of the encoded annotations hjsubscriptℎ𝑗h_{j}. The weight ai​jsubscript𝑎𝑖𝑗a_{ij} of each annotation hjsubscriptℎ𝑗h_{j} is computed by the attention mechanism, which models the alignment between yisubscript𝑦𝑖y_{i} and xjsubscript𝑥𝑗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 position-wise 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 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. 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. Resembling NMT models, the generator G defines the policy that generates the target sentence y𝑦y given the source sentence x𝑥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 222https://github.com/nyu-dl/dl4mt-tutorial and Transformer 333https://github.com/tensorflow/tensor2tensor. 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𝑇T, which is the maximum length set for the output of the generator. Given the source-language sequence x1,…,xTsubscript𝑥1…subscript𝑥𝑇x_{1},\ldots,x_{T} and target-language sequence y1,…,yTsubscript𝑦1…subscript𝑦𝑇y_{1},\ldots,y_{T}, we build the source matrix X1:Tsubscript𝑋:1𝑇X_{1:T} and target matrix Y1:Tsubscript𝑌:1𝑇Y_{1:T} respectively as:X1:T=x1;x2;…;xTsubscript𝑋:1𝑇subscript𝑥1subscript𝑥2…subscript𝑥𝑇X_{1:T}=x_{1};x_{2};\ldots;x_{T}(1)andY1:T=y1;y2;…;yTsubscript𝑌:1𝑇subscript𝑦1subscript𝑦2…subscript𝑦𝑇Y_{1:T}=y_{1};y_{2};\ldots;y_{T}(2)where xtsubscript𝑥𝑡x_{t}, yt∈Rksubscript𝑦𝑡superscript𝑅𝑘y_{t}\in R^{k} is the k𝑘k-dimensional word embedding and the semicolon is the concatenation operator. For the source matrix X1:Tsubscript𝑋:1𝑇X_{1:T}, a kernel wj∈Rl×ksubscript𝑤𝑗superscript𝑅𝑙𝑘{w_{j}}\in R^{l\times k} applies a convolutional operation to a window size of l𝑙l words to produce a series of feature maps:cj​i=ρ​(B​N​(wj⊗Xi:i+l−1+b))subscript𝑐𝑗𝑖𝜌𝐵𝑁tensor-productsubscript𝑤𝑗subscript𝑋:𝑖𝑖𝑙1𝑏c_{ji}=\rho(BN(w_{j}\otimes X_{i:i+l-1}+b))(3)where ⊗tensor-product\otimes operator is the summation of element-wise production and b𝑏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 (B​N𝐵𝑁BN in equation 3). To get the final feature with respect to kernel wjsubscript𝑤𝑗w_{j}, a max-over-time pooling operation is leveraged over the feature maps:c~j=m​a​x​{cj​1,…,cj​T−l+1}subscript~𝑐𝑗𝑚𝑎𝑥subscript𝑐𝑗1…subscript𝑐𝑗𝑇𝑙1\widetilde{c}_{j}=max\{c_{j1},\ldots,c_{j{T-l+1}}\}(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 cxsubscript𝑐𝑥c_{x}. Identically, the target-language sentence representation cysubscript𝑐𝑦c_{y} can be extracted from the target matrix Y1:Tsubscript𝑌:1𝑇Y_{1:T}. Finally, given the source-language sentence, the probability that the target-language sentence is being real can be computed as:p=σ​(V​[cx;cy])𝑝𝜎𝑉subscript𝑐𝑥subscript𝑐𝑦p=\sigma(V[c_{x};c_{y}])(5)where V𝑉V is the transform matrix which transforms the concatenation of cxsubscript𝑐𝑥c_{x} and cysubscript𝑐𝑦c_{y} into a 2-dimension embedding and σ𝜎\sigma is the logistic function. We apply the smoothed sentence-level BLEU as the specific objective for the generator. Given the generated sentence ygsubscript𝑦𝑔y_{g} and the the ground true sentence ydsubscript𝑦𝑑y_{d}, the objective Q𝑄Q calculates a reward Q​(yg,yd)𝑄subscript𝑦𝑔subscript𝑦𝑑Q(y_{g},y_{d}), which measures the n-gram precisions of the generated sentence ygsubscript𝑦𝑔y_{g}. Identical to the output of the discriminator, the Q​(yg,yd)𝑄subscript𝑦𝑔subscript𝑦𝑑Q(y_{g},y_{d}) also ranges from zero to one, which makes it easier to fuse Q𝑄Q and D𝐷D. Following Yu et al. (2016), the objective of the generator G𝐺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​(θ)=∑Y1:TGθ​(Y1:T|X)⋅RD,QGθ​(Y1:T−1,X,yT,Y∗)𝐽𝜃subscriptsubscript𝑌:1𝑇⋅subscript𝐺𝜃conditionalsubscript𝑌:1𝑇𝑋superscriptsubscript𝑅𝐷𝑄subscript𝐺𝜃subscript𝑌:1𝑇1𝑋subscript𝑦𝑇superscript𝑌J(\theta)=\sum\limits_{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𝐺G, Y1:T=y1,…,yTsubscript𝑌:1𝑇subscript𝑦1…subscript𝑦𝑇Y_{1:T}=y_{1},\ldots,y_{T} indicates the generated target sequence, X𝑋X is the source-language sentence, Y∗superscript𝑌Y^{*} represents the ground true target sentence.RD,QGθsuperscriptsubscript𝑅𝐷𝑄subscript𝐺𝜃R_{D,Q}^{G_{\theta}} is the action-value function of a target-language sentence given the source sentence X𝑋X, i.e. the expected accumulative reward starting from the state (Y1:T−1,X)subscript𝑌:1𝑇1𝑋(Y_{1:T-1},X), taking action yTsubscript𝑦𝑇y_{T}, and following the policy Gθsubscript𝐺𝜃G_{\theta}. To estimate the action-value function, we consider the estimated probability of being real by the discriminator D𝐷D and the output of the BLEU objective Q𝑄Q as the reward:RD,QGθ​(Y1:T−1,X,yT,Y∗)=λ​(D​(X,Y1:T)−b​(X,Y1:T))+(1−λ)​Q​(Y1:T,Y∗)missing-subexpressionsuperscriptsubscript𝑅𝐷𝑄subscript𝐺𝜃subscript𝑌:1𝑇1𝑋subscript𝑦𝑇superscript𝑌absentmissing-subexpression𝜆𝐷𝑋subscript𝑌:1𝑇𝑏𝑋subscript𝑌:1𝑇1𝜆𝑄subscript𝑌:1𝑇superscript𝑌\begin{aligned} &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^{*})\end{aligned}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𝐷D only provides a reward value for a finished target sequence. If Y1:Tsubscript𝑌:1𝑇Y_{1:T} is not a finished target sequence, the value of D​(X,Y1:T)𝐷𝑋subscript𝑌:1𝑇D(X,Y_{1:T}) makes no sense. Therefore, we cannot get the 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θsubscript𝐺𝜃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:{Y1:T11,…,Y1:TNN}=M​CGθ​((Y1:t,X),N)superscriptsubscript𝑌:1subscript𝑇11…superscriptsubscript𝑌:1subscript𝑇𝑁𝑁𝑀superscript𝐶subscript𝐺𝜃subscript𝑌:1𝑡𝑋𝑁\{Y_{1:T_{1}}^{1},\ldots,Y_{1:T_{N}}^{N}\}=MC^{G_{\theta}}((Y_{1:t},X),N)where Tisubscript𝑇𝑖T_{i} represents the length of the sentence sampled by the i𝑖i’th Monte Carlo search. (Y1:t,X)=(y1,…,yt,X)subscript𝑌:1𝑡𝑋subscript𝑦1…subscript𝑦𝑡𝑋(Y_{1:t},X)=(y_{1},\ldots,y_{t},X) is the current state and Yt+1:TNNsuperscriptsubscript𝑌:𝑡1subscript𝑇𝑁𝑁Y_{t+1:T_{N}}^{N} is sampled based on the policy Gθsubscript𝐺𝜃G_{\theta}. The discriminator provides N𝑁N rewards for the sampled N𝑁N sentences respectively. The final reward for the intermediate state is calculated as the average of the N𝑁N rewards. Hence, for the target sentence with the length T𝑇T, we compute the reward for ytsubscript𝑦𝑡y_{t} in the sentence level as:RD,QGθ​(Y1:t−1,X,yT,Y∗)={1N∑n=1Nλ(D(X,Y1:Tnn)−b(X,Y1:Tnn))+(1−λ)Q(Y1:Tn,Y∗)t