I MPROVING S EQUENCE - TO -S EQUENCE L EARNING VIA O PTIMAL T RANSPORT
A BSTRACT
Sequence-to-sequence models are commonly trained via maximum likelihood estimation (MLE).
However, standard MLE training considers a word-level objective, predicting the next word given the previous ground-truth partial sentence.
This procedure focuses on modeling local syntactic patterns, and may fail to capture long-range semantic structure.
We present a novel solution to alleviate these issues.
Our approach imposes global sequence-level guidance via new supervision based on optimal transport, enabling the overall characterization and preservation of semantic features.
We further show that this method can be understood as a
Wasserstein gradient ﬂow trying to match our model to the ground truth sequence distribution.
Extensive experiments are conducted to validate the utility of the proposed approach, showing consistent improvements over a wide variety of NLP tasks, including machine translation, abstractive text summarization, and image captioning.
I NTRODUCTION
Sequence-to-sequence (Seq2Seq) models are widely used in various natural language processing tasks, such as machine translation (Bahdanau et al., 2015; Cho et al., 2014; Sutskever et al., 2014), text summarization (Chopra et al., 2016; Rush et al., 2015) and image captioning (Vinyals et al., 2015; Xu et al., 2015).
Typically, Seq2Seq models are based on an encoder-decoder architecture, with an encoder mapping a source sequence into a latent vector and a decoder translating the latent vector into a target sequence.
The goal of a Seq2Seq model is to optimize this encoder-decoder network to generate sequences close to the target.
Therefore, a proper measure of the distance between sequences is crucial for model training.
Maximum likelihood estimation (MLE) is often used as the training paradigm in existing Seq2Seq models (Goodfellow et al., 2016; Lamb et al., 2016).
The MLE-based approach maximizes the likelihood of the next word conditioned on its previous ground-truth words.
Such an approach adopts cross-entropy loss as the objective, essentially measuring the word difference at each position of the target sequence (assuming truth for the preceding words).
That is, MLE only provides a word-level training loss (Ranzato et al., 2016).
Consequently, MLE-based methods suffer from the so-called exposure bias problem (Bengio et al., 2015; Ranzato et al., 2016), i.e. , the discrepancy between training and inference stages.
During inference, each word is generated sequentially based on previously generated words.
However, ground-truth words are used in each timestep during training (Huszr, 2015; Wiseman & Rush, 2016).
Such discrepancy in training and testing leads to accumulated errors along the sequence-generation trajectory, and may therefore produce unstable results in practice.
Further, commonly used metrics for evaluating the generated sentences at test time are sequence-level, such as BLEU (Papineni et al., 2002) and ROUGE (Lin, 2004).
This also indicates a mismatch of the training loss and test-time evaluation metrics.
Attempts have been made to alleviate the above issues, via a sequence-level training loss that enables comparisons between the entire generated and reference sequences.
Such efforts roughly fall into two categories: ( i ) reinforcement-learning-based (RL) methods (Bahdanau et al., 2017; Ranzato et al., 2016) and ( ii ) adversarial-learning-based methods (Yu et al., 2017; Zhang et al., 2017).
These methods overcome the exposure bias issue through criticizing model output during training; however, both schemes have their own vulnerabilities.
RL methods often suffer from large variance [Figure] on policy-gradient estimation, and control variates and carefully designed baselines (such as a selfcritic) are needed to make RL training more robust (Liu et al., 2018; Rennie et al., 2017).
Further, the rewards used by RL training are often criticized as a bad proxy for human evaluation, as they are usually highly biased towards certain particular aspects (Wang et al., 2018b).
On the other hand, adversarial supervision relies on the delicate balance of a mini-max game, which can be easily undermined by mode-trapping and gradient-vanishing problems (Arjovsky et al., 2017; Zhang et al., 2017).
Sophisticated tuning is often desired for successful adversarial training.
We present a novel Seq2Seq learning scheme that leverages optimal transport (OT) to construct sequence-level loss.
Speciﬁcally, the OT objective aims to ﬁnd an optimal matching of similar words/phrases between two sequences, providing a way to promote their semantic similarity (Kusner et al., 2015).
Compared with the above RL and adversarial schemes, our approach has: ( i ) semanticinvariance, allowing better preservation of sequence-level semantic information; and ( ii ) improved robustness, since neither the reinforce gradient nor the mini-max game is involved.
The OT loss allows end-to-end supervised training and acts as an effective sequence-level regularization to the
MLE loss.
Another novel strategy distinguishing our model from previous approaches is that during training we consider not only the OT distance between the generated sentence and ground-truth references, but also the OT distance between the generated sentence and its corresponding input.
This enables our model to simultaneously match the generated output sentence with both the source sentence(s) and target reference sentence, thus enforcing the generator to leverage information contained in the input sentence(s) during generation.
The main contributions of this paper are summarized as follows.
( i )
A new sequence-level training algorithm based on optimal transport is proposed for Seq2Seq learning.
In practice, the OT distance is introduced as a regularization term to the MLE training loss.
( ii )
Our model can be interpreted as approximate Wasserstein gradient ﬂows, learning to approximately match the sequence distribution induced by the generator and a target data distribution.
( iii )
In order to demonstrate the versatility of the proposed method, we conduct extensive empirical evaluations on three tasks: machine translation, text summarization, and image captioning.
S EMANTIC M ATCHING WITH O PTIMAL T RANSPORT
We consider two components of a sentence: its syntactic and semantic parts.
In a Seq2Seq model, it is often desirable to keep the semantic meaning while the syntactic part can be more ﬂexible.
Conventional training schemes, such as MLE, are known to be well-suited for capturing the syntactic structure.
As such, we focus on the semantic part.
An intuitive way to assess semantic similarity is to directly match the “key words” between the synthesized and the reference sequences.
Consider the respective sequences as sets A and B , with vocabularies as their elements.
Then the matching can be evaluated by | A ∩ B | , where | · | is the counting measure for sets.
We call this hard matching , as it seeks to exactly match words from both sequences.
For language models, the above hard matching could be an over simpliﬁcation.
This is because words have semantic meaning, and two different words can be close to each other in the semantic space.
To account for such ambiguity, we can relax the hard matching to soft bipartite matching (SBM).
More speciﬁcally, assuming all sequences have the same length n , we pair w i k ∈ A and w (cid:48)
j k ∈ B for k ∈ [1 , K ] , such that K ≤ n , { i k } , { j k } are unique and L SBM =
(cid:80)
k c ( w i k , w (cid:48)
j k ) is minimized.
Here c ( w , w (cid:48) ) is a cost function measuring the semantic dissimilarity between the two words.
For instance, the cosine distance c ( x , y ) = 1 − x (cid:62) y
(cid:107) x (cid:107) 2 (cid:107) y (cid:107) 2 between two word embedding vec- tors x
and y is a popular choice (Pennington et al., 2014).
This minimization can be solved exactly, [Figure] e.g. , via the Hungarian algorithm (Kuhn, 1955).
Unfortunately, its O ( n 3 ) complexity scales badly for common NLP tasks, and the objective is also non-differentiable wrt model parameters.
As such, end-to-end supervised training is not feasible with the Hungarian matching scheme.
To overcome this difﬁculty, we propose to further relax the matching criteria while keeping the favorable features of a semantic bipartite matching.
OT arises as a natural candidate.
2. O PTIMAL TRANSPORT AND W ASSERSTEIN DISTANCE
We ﬁrst provide a brief review of optimal transport, which deﬁnes distances between probability measures on a domain X (the sequence space in our setting).
The optimal transport distance for two probability measures µ and ν is deﬁned as (Peyr ´ e et al., 2017):
[Equation]
where Π( µ, ν ) denotes the set of all joint distributions γ ( x , y ) with marginals µ ( x ) and ν ( y ) ;
c ( x , y ) :
X × X
→ R is the cost function for moving x to y , e.g. , the Euclidean or cosine distance.
Intuitively, the optimal transport distance is the minimum cost that γ induces in order to transport from µ to ν .
When c ( x , y ) is a metric on X , D c ( µ, ν ) induces a proper metric on the space of probability distributions supported on X , commonly known as the Wasserstein distance (Villani, 2008).
One of the most popular choices is the 2 − Wasserstein distance W 22 ( µ, ν ) where the squared
Euclidean distance c ( x , y )
= (cid:107) x − y (cid:107) 2 is used as cost.
OT distance on discrete domains We mainly focus on applying the OT distance on textual data.
Therefore, we only consider OT between discrete distributions.
Speciﬁcally, consider two discrete distributions µ , ν ∈ P ( X ) , which can be written as µ = (cid:80) ni
=1 u i δ x i and ν = (cid:80) mj
=1 v j δ y j with δ x the Dirac function centered on x .
The weight vectors u = { u i } ni =1 ∈ ∆ n and v = { v i } mi =1 ∈ ∆ m respectively belong to the n and m -dimensional simplex, i.e. , (cid:80) ni
=1 u i =
(cid:80) mj
=1 v j = 1 , as both µ and ν are probability distributions.
Under such a setting, computing the OT distance as deﬁned in (1) is equivalent to solving the following network-ﬂow problem (Luise et al., 2018):
[Equation]
where Π( u , v )
= { T ∈ R n × m + | T1 m = u , T (cid:62) 1 n = v } , 1 n denotes an n -dimensional all-one vector, C is the cost matrix given by C ij =
c ( x i , y j ) and (cid:104) T , C (cid:105) =
Tr ( T (cid:62) C ) represents the
Frobenius dot-product.
We refer to the minimizer T ∗ of (2) as OT matching .
Comparing the two objectives, one can readily recognize that soft bipartite matching represents a special constrained solution to (2), where T can only take values in Γ =
{ T | max i {(cid:107)
Te i (cid:107) 0 , (cid:107) e Ti T (cid:107) 0 } ≤ 1 , T ij ∈ { 0 , 1 } , (cid:107) T (cid:107)
= K } instead of Π( u , v ) ; here (cid:107) · (cid:107) 0 is the L 0 norm and e i is the unit vector along i -th axis.
As such, OT matching can be regarded as a relaxed version of soft bipartite matching.
In
Figure 1 we illustrate the three matching schemes discussed above.
The IPOT algorithm Unfortunately, the exact minimization over T is in general computational intractable (Arjovsky et al., 2017; Genevay et al., 2018; Salimans et al., 2018).
To overcome such intractability, we consider an efﬁcient iterative approach to approximate the OT distance.
We propose to use the recently introduced Inexact Proximal point method for Optimal Transport (IPOT) algorithm to compute the OT matrix T ∗ , thus also the OT distance (Xie et al., 2018).
IPOT provides a solution to the original OT problem speciﬁed in (2).
Speciﬁcally, IPOT iteratively solves the following optimization problem using the proximal point method (Boyd & Vandenberghe, 2004):
[Equation]
where the proximity metric term B ( T , T ( t ) ) penalizes solutions that are too distant from the latest approximation, and 1 β is understood as the generalized stepsize.
This renders a tractable iterative scheme towards the exact OT solution.
In this work, we employ the generalized KL Bregman divergence B ( T , T ( t ) )
=
(cid:80) i,j T ij log T ij T ( t ) ij − (cid:80) i,j T ij + (cid:80) i,j T ( t ) ij as the proximity metric.
Algorithm 1 describes the implementation details for IPOT.
1: Input: Feature vectors S = { z i } n 1 , S (cid:48) = { z (cid:48) j } mand generalized stepsize 1 /β , 2:
[Table]
[Table] [Table]
do
[Table]
[Table]
[Table]
product
[Table] [Table] [Table] [Table]
: end for 9:
[Table] [Table] [Table] : end for
[Table]
Return (cid:104)
[Table]
, C (cid:105)
Note that the Sinkhorn algorithm (Cuturi, 2013) can also be used to compute the OT matrix.
Speciﬁcally, the
Sinkhorn algorithm tries to solve the entropy regularized optimization problem: ˆ
[Equation]
[Equation]
, v
[Equation]
(cid:104) T , [Equation] (cid:105) − 1 (
cid:15) H ( T ) , where H ( T )
= − (cid:80)
i,j T ij (log( T ij ) − 1) is the entropy regularization term and (cid:15) > 0 is the regularization strength.
However, in our experiments, we empirically found that the numerical stability and performance of the
Sinkhorn algorithm is quite sensitive to the choice of the hyper-parameter (cid:15) , thus only
IPOT is considered in our model training.
2. O PTIMAL TRANSPORT DISTANCE AS A SEQUENCE LEVEL LOSS
Figure 2 illustrates how OT is computed to construct the sequence-level loss.
Given two sentences, we can construct their word-level or phrase-level embedding matrices S and S (cid:48) , where S = { z i } is usually recognized as the reference sequence embedding and S (cid:48)
= { z (cid:48)
j } for the model output sequence embedding.
The cost matrix C is then computed by C ij =
c
( z i , z (cid:48) j ) and passed on to the
IPOT algorithm to get the OT distance.
Our full algorithm is summarized in Algorithm 2, and more detailed model speciﬁcations are given below.
Encoding model belief with a differentiable sequence generator We ﬁrst describe how to design a differentiable sequence generator so that the gradients can be backpropagated from the OT losses to update the model belief.
The Long Short-Term Memory (LSTM) recurrent neural network (Hochreiter & Schmidhuber, 1997) is used as our sequence model.
At each timestep t , the
LSTM decoder outputs a logit vector v t for the vocabularies, based on its context.
Directly sampling from the multinomial distribution ˆ w t ∼ Softmax ( v t ) is a non-differentiable operation 1 , so we consider the following differentiable alternatives:
• Soft-argmax : ˆ w SAt =
Softmax ( v t /τ ) , where τ ∈ (0 , 1) is the annealing parameter (Zhang et al., 2017).
This approximates the deterministic sampling scheme ˆ w max t
[Equation]
• Gumbel-softmax (GS): ˆ w GSt =
Softmax (( v
t + ξ t ) /τ ) , where ξ t are iid Gumbel random variables for each of the vocabulary.
It is also known as the Concrete distribution (Jang et al., 2016; Maddison et al., 2017).
Unstable training and sub-optimal solutions have been observed for the GS-based scheme for the Seq2Seq tasks we considered (see Appendix G, Table 11), possibly due to the extra uncertainty introduced.
As such, we will assume the use of soft-argmax to encode model belief in ˆ w t unless otherwise speciﬁed.
Note ˆ w t is a normalized non-negative vector that sums up to one.
Sequence-level OT-matching loss To pass on the model belief to the OT loss, we use the mean word embedding predicted by the model, given by ˆ z t =
E T ˆ w t ,
where
E ∈ R V
×
d is the word embedding matrix, V is the vocabulary size and d is the dimension for the embedding vector.
We collect the predicted sequence embeddings into S g
= { ˆ z t } Lt =1 , where L is the length of sequence.
Similarly we denote the reference sequence embeddings as S r = { z t } Lt =1 , using ground truth one-
hot input token sequence { w t } .
Based on the sequence embeddings S r and S g , we can compute the sequence-level OT loss between ground-truth and model prediction using the IPOT algorithm described above for different Seq2Seq tasks:
[Equation]
Soft-copying mechanism We additionally consider feature matching using the OT criteria between the source and target.
Intuitively, it will encourage the global semantic meaning to be preserved from source to target.
This is related to the copy network (Gu et al., 2016).
However, in our framework, the copying mechanism can be understood as a soft optimal-transport-based copying, instead of the original hard retrieved-based copying used by Gu et al.
This soft copying mechanism considers semantic similarity in the embedding space, and thus presumably delivers smoother transformation of information.
In the case where the source and target sequences do not share vocabulary ( e.g. , machine translation), this objective can still be applied by sharing the word embedding space between source and target.
Ideally, the embedding for the same concept in different languages will automatically be aligned by optimizing such loss, making available a cosinesimilarity-based cost matrix.
This is also related to bilingual skip-gram (Luong et al., 2015b).
We denote this loss as L copy (cid:44) IPOT ( S g , S s ) , where S s represents the source sequence embeddings.
Complementing MLE training with OT regularization OT training objectives discussed above can not train a proper language model on its own, as they do not explicitly consider word ordering, i.e. , the syntactic strucuture of a language model.
To overcome this issue, we propose to combine the OT loss with the de facto likelihood loss L MLE , which gives us the ﬁnal training objective:
L = L MLE + γ L seq , where γ > 0 is a hyper-parameter to be tuned.
For tasks with both input and output sentences, such as machine translation and text summarization,
L copy can be applied, in which case the ﬁnal objective can be written as
[Equation]
I NTERPRETATION AS A PPROXIMATE W ASSERSTEIN G RADIENT F LOWS
To further justify the use of our approach (minimizing the loss {L MLE + γ L ot } , where L ot denotes the Wasserstein loss), we now explain how our model approximately learns to match the ground-truth sequence distribution.
Our derivation is based on the theory of Wasserstein gradient ﬂows (WGF) (Villani, 2008).
In WGF, the Wasserstein distance describes the local geometry of a trajectory in the space of probability measures converging to a target distribution (Ambrosio et al., 2005).
In the following, we show that the proposed method learns to approximately match the data distribution, from the perspective of WGF.
For simplicity we only discuss the continuous case, while a similar argument also holds for the discrete case (Li & Montufar, 2018).
We denote the induced distribution of the sequences generated from the decoder at the l -th iteration as µ l .
Assume the sequence data distribution is given by p d ( x ) .
Intuitively, the optimal generator in a Seq2Seq model learns a distribution µ ∗ ( x ) that matches p d ( x ) .
Based on Craig (2014), this can be achieved by composing a sequence of discretized WGFs given by:
[Equation]
with J h ( · ) deﬁned as
[Equation]
where λ = 1 / (2 h ) is a regularization parameter ( h is the generalized learning rate); W 22 ( µ, ν ) denotes the 2 -Wasserstein distance between µ and ν ; P s is the space of distributions with ﬁnite 2nd-order moments; and D KL ( ν (cid:107) p d ) =
E x ∼ ν [log ν ( x ) − log p d ( x )] is the Kullback-Leibler (KL) divergence.
It is not difﬁcult to see that discreteized WGF is essentially optimizing the KL divergence with a proximal descent scheme, using the 2 -Wasserstein distance as the proximity metric.
We denote µ ∗ h
= lim l →∞ µ l with generalized learning rate h .
It is well known that lim h → 0 µ ∗ h
= p d (Chen et al., 2018a), that is to say the induced model distribution µ l asymptotically converges to the data distribution p d .
In our case, instead of using L WGF ( µ, ν ) as the loss function, we deﬁne a surrogate loss using its upper bound L WGF ( µ, ν ) ≤ L WGF ( p d , ν ) , where the inequality holds because (6) converges to p d .
When our model distribution µ is parameterized by θ , µ l can be solved with stochastic updates on θ based on the following equation with stepsize η :
[Equation]
Unfortunately, (7) is an infeasible update as we do not know p d .
However, we argue that this update is still locally valid when current model approximation µ l − 1 is close to p d .
To see this, recall that the KL-divergence is a natural Riemannian metric on the space of probability measures (Amari, 1985), therefore it is locally symmetric.
So we can safely replace the D KL ( µ (cid:107) p d ) term with
D KL ( p d (cid:107) µ ) when µ is close to p d .
This recovers the loss function L MLE + γ L seq derived in Section 2.2 as D
[Equation]
p d (cid:107) µ ) =
L MLE + H ( p d ) , where H ( p d ) is the entropy of p d , independent of µ , and
[Equation]
, µ ) .
This justiﬁes the use of our proposed scheme in a model-reﬁnement stage, where model distribution µ is sufﬁciently close to p d .
Empirically, we have observed that our scheme also improves training even when µ is distant from p d .
While the above justiﬁcation is developed based on Euclidean transport, other non-Euclidean costs such as cosine distance usually yield better empirical performance as they are more adjusted to the geometry of sequence data.
R ELATED W ORK AND D ISCUSSION
Optimal transport in NLP Although widely used in other ﬁelds such as computer vision (Rubner et al., 2000), OT has only been applied in NLP recently.
Pioneered by the work of Kusner et al.
(2015) on word mover’s distance (WMD), existing literature primarily considers OT either on a macroscopic level like topic modeling (Huang et al., 2016), or a microscopic level such as word embedding (Xu et al., 2018).
Euclidean distance, instead of other more general distance, is often used as the transportation cost, in order to approximate the OT distance with the KantorovichRubinstein duality (Gulrajani et al., 2017) or a more efﬁcient yet less accurate lower bound (Kusner et al., 2015).
Our work employs OT for mesoscopic sequence-to-sequence models, presenting an efﬁcient IPOT-based implementation to enable end-to-end learning for general cost functions.
The proposed OT not only reﬁnes the word embedding matrix but also improves the Seq2Seq model (see
Appendix H for details).
RL for sequence generation A commonly employed strategy for sequence-level training is via reinforcement learning (RL).
Typically, this type of method employs RL by considering the evaluation metrics as the reward to guide the generation (Bahdanau et al., 2017; Huang et al., 2018; Ranzato et al., 2016; Rennie et al., 2017; Zhang et al., 2018a).
However, these approaches often introduce procedures that may yield large-variance gradients, resulting in unstable training.
Moreover, it has been recognized that these automatic metrics may have poor correlation with human judgments in many scenarios (Wang et al., 2018b).
As such, reinforcing the evaluation metrics can potentially boost the quantitative scores but not necessarily improve the generation quality, as such metrics usually encourage exact text snippets overlapping rather than semantic similarity.
Some nonstandard metrics like SPICE (Anderson et al., 2016) also consider semantic similarity, however they also can not learn a good model on their own (Liu et al., 2017).
Unlike RL methods, our method requires no human-deﬁned rewards, thus preventing the model from over-ﬁtting to one speciﬁc metric.
As a concrete example, the two semantically similar sentences “do you want to have lunch with us ” and “would you like to join us for lunch” would be considered as a bad match based on automatic metrics like BLEU, however, be rated as reasonable match in OT objective.
GAN for sequence generation Another type of method adopts the framework of generative adversarial networks (GANs) (Goodfellow et al., 2014), by providing sequence-level guidance based on a learned discriminator (or, critic).
To construct such a loss, Fedus et al. ; Guo et al.
Lin et al.
Yu et al.
(2017) combine the policy-gradient algorithm with the original GAN training procedure, while Chen et al. (2018b) ; Zhang et al.
(2017) uses a so-called feature mover distance and maximum mean discrepancy (MMD) to match features of real and generated sentences, respectively. [Table]
[Table]
However
[Table]
mode-collapse and gradient-vanishing problems make the training of these methods challenging.
Unlike GAN methods, since no min-max games are involved
[Table]
the training of our model is more robust.
Moreover
[Table]
compared with GAN [Table] no additional critic is introduced in our model
[Table]
which makes the model complexity comparable to MLE and less demanding to tune.
E XPERIMENTS
We consider a wide range of NLP tasks to experimentally validate the proposed model
[Table]
and benchmark it with other strong baselines.
All experiments are implemented with Tensorﬂow and run on a single NVIDIA TITAN X GPU.
Code for our experiments are available from https: //github.com/LiqunChen0606/Seq2Seq-OT .
5. N EURAL MACHINE TRANSLATION
We test our model on two datasets: ( i ) a small-scale English-Vietnamese parallel corpus of TEDtalks, which has 133 K sentence pairs from the IWSLT Evaluation Campaign (Cettolo et al., 2015); and ( ii ) a large-scale English-German parallel corpus with 4.5M sentence pairs, from the WMT
Evaluation Campaign (Vaswani et al., 2017).
We used Google’s Neural Machine Translation (GMNT) model (Wu et al., 2016) as our baseline, following the architecture and hyper-parameter settings from the GNMT repository 2 to make a fair comparison.
For the English-Vietnamese ( i.e. ,
VI-EN and EN-VI) tasks, a 2-layer LSTM with 512 units in each layer is adopted as the decoder, with a 1-layer bidirectional-LSTM adopted as the encoder; the word embedding dimension is set to 512.
Attention proposed in Luong et al.
(2015a) is used together with a dropout rate of 0 . 2 .
For the
English-German ( i.e. , DE-EN and EN-DE) tasks, we train a 4-layer LSTM decoder with 1024 units in each layer.
A 2-layer bidirectional-LSTM is used as the encoder, and we adopt the attention used in Wu et al.
The word embedding dimension is set to 1024.
Standard stochastic gradient descent is used for training with a decreasing learning rate, and we set β = 0 .
5 for the IPOT algorithm.
More training details are provided in Appendix A.
In terms of wall-clock time, our model only slightly increases training time.
For the German-English task, it took roughly 5.5 days to train the GNMT model, and 6 days to train our proposed model from scratch, which only amounts to a roughly 10% increase.
We apply different combinations of L copy and L seq to ﬁne-tune the pre-trained GNMT model (Luong et al., 2018) and the results are summarized in Table 1 and 2. .
Additional results for training from scratch are provided in
Appendix B.
The proposed OT approach consistently improves upon MLE training in all experimental setups.
We additionally tested our model with a more expressive 8 -layer LSTM model on the EN-DE task.
The BLEU score of our method is 28 . 0 on NT2015.
For reference, the GNMT model (same architecture) and a Transformer model (Vaswani et al., 2017) respectively report a score of 27 . 6 and 27 . 3 .
Our method outperforms both baselines, and it is also competitive to the state-of-the-art BLEU score 28 . 4 reported by Vaswani et al.
(2017) using a highly sophisticated model design.
The German-to-English translation examples are provided in Table 3 for qualitative assessment.
The main differences among the reference translation, our translation and the GNMT translation are highlighted in blue and red.
Our OT-augmented translations are more faithful to the reference than its MLE-trained counterpart.
The soft-copying mechanism introduced by OT successfully maintains the key semantic content from the reference.
Presumably, the OT loss helps reﬁne the word embedding matrices, and promotes matching between words with similar semantic meanings.
Vanilla
[Table]
[Table]
[Table]
a UN-controlled nomination committee .
Ours:
The Chinese leadership presented Sunday ’ s decision as a democratic breakthrough because it gives the citizens of Hong Kong a direct right to vote , but the decision also makes it clear that the Chinese leadership keeps the process ﬁrmly in the hands of a government-controlled Nomination Committee .
[Table]
[Table]
GNMT translations, on the other hand, ignores or misinterprets some of the key terms.
More examples are provided in Appendix E.
We also test the robustness of our method wrt the hyper-parameter γ .
Results are summarized in
Appendix C. Our OT-augmented model is robust to the choice of γ .
The test BLEU scores are consistently higher than the baseline for γ ∈ (0 , 1] .
5. A BSTRACTIVE TEXT SUMMARIZATION
We consider two datasets for abstractive text summarization.
The ﬁrst one is the Gigaword corpus (Graff et al., 2003), which has around 3 .
8 M training samples, 190 K validation samples, and 1951 test samples.
The input pairs consist of the ﬁrst sentence and the headline of an article.
We also evaluate our model on the DUC-2004 test set (Over et al., 2007), which consists of 500 news articles.
Our implementation of the Seq2Seq model adopts a simple architecture, which consists of a bidirectional
GRU encoder and a GRU decoder with attention mechanism (Bahdanau et al., 2015) 3 .
Results are summarized in Tables 4 and 5.
Our OT-regularized model outperforms respective baselines.
The state-of-the-art ROUGE result for the Gigawords dataset is 36 .
92 reported by Wang et al.
(2018a).
However, much more complex architectures are used to achieve that score.
We use a relatively simple Seq2Seq model in our experiments to demonstrate the versatility of the proposed
OT method.
Applying it for ( i ) more complicated models and ( ii ) more recent datasets such as
CNN/DailyMail (See et al., 2017) will be interesting future work.
Summarization examples are provided in Appendix D. Similar to the machine translation task, our proposed method captures the key semantic information in both the source and reference sentences.
5. I MAGE CAPTIONING
We also consider an image captioning task using the COCO dataset (Lin et al., 2014), which contains 123,287 images in total and each image is annotated with at least 5 captions.
Following Karpathy’s
[Table]
split (Karpathy & Fei-Fei, 2015), 113,287 images are used for training and 5,000 images are used for validation and testing.
We follow the implementation of the Show, Attend (Xu et al., 2015) 4 , and use Resnet-152 (He et al., 2016), image tagging (Gan et al., 2017), and FastRCNN (Anderson et al., 2018) as the image feature extractor (encoder), and a one-layer LSTM with 1024 units as the decoder.
The word embedding dimension is set to 512.
Note that in this task, the input are images instead of sequences, therefore L copy cannot be applied.
We report BLEU-
k ( k from 1 to 4) (Papineni et al., 2002), CIDEr (Vedantam et al., 2015), and
METEOR (Banerjee & Lavie, 2005) scores and the results with different settings are shown in
Table 6.
Consistent across-the-board improvements are observed with the introduction of the OT loss, in contrast to the RL-based methods where drastic improvements can only be observed for the optimized evaluation metric (Rennie et al., 2017).
Consequently, the OT loss is a more reliable method to improve the quality of generated captions when compared with RL methods that aim to optimize and therefore potentially overﬁt one speciﬁc metric.
Examples of generated captions are provided in Appendix F.
C ONCLUSION
This work is motivated by the major deﬁciency in training Seq2Seq models: that the MLE training loss does not operate at sequence-level.
Inspired by soft bipartite matching, we propose the usage of optimal transport as a sequence-level loss to improve Seq2Seq learning.
By applying this new method to machine translation, text summarization, and image captioning, we demonstrate that our proposed model can be used to help improve the performance compared to strong baselines.
We believe the proposed method is a general framework, and will be useful to other sequence generation tasks as well, such as conversational response generation (Li et al., 2017; Zhang et al., 2018c), which is left as future work.
A PPENDIX A T RAINING D ETAILS FOR NMT TASK
The following training details are basically the same as the intructions from the Tensorﬂow/nmt github repository:
EN-VI 2 -layer LSTMs of units with bidirectional encoder ( i.e. , 1 bidirectional layer for the encoder), embedding dim is 512.
LuongAttention (Luong et al., 2015a)
(scale=True) is used together with dropout keep-prob= 0 .
All parameters are uniformly initialized.
We use SGD with learning rate 1 . 0 as follows: train for 12 K steps (around 12 epochs); after 8 K steps, we start halving learning rate every 1 K step.
DE-EN The training hyperparameters are similar to the EN-VI experiments except for the following details.
The data is split into subword units using BPE (32K operations).
We train 4layer LSTMs of 1024 units with bidirectional encoder ( i.e. , 2 bidirectional layers for the encoder), embedding dimension is 1024 .
We train for 350 K steps (around 10 epochs); after 170 K steps, we start halving learning rate every 17 K step.
B E ND - TO -E ND NEURAL MACHINE TRANSLATION
[Table]
[Table]
Table 7 and 8 show the quantitative comparison for training from random initialization.
C BLEU SCORE FOR DIFFERENT HYPER - PARAMETERS
We tested different γ for the OT loss term and summarized the results in Figure 3.
γ = 0 .
1 gave the best performance for the EN-VI experiment.
The results are robust wrt the choice of γ ≤ 1 . 0 .
[Figure]
D S UMMARIZATION EXAMPLES
[Table]
Examples for abstract summarization are provided in Table 9.
E N EURAL MACHINE TRANSLATION EXAMPLES
In Table 10, we show more examples for comparison.
From these examples, sentences generated from our model are more faithful to the reference sentences
. F I MAGE C APTION EXAMPLES
Table 4 shows the comparison of our model with other baselines
. G E NCODING MODEL BELIEF WITH S OFTMAX AND G UMBEL - SOFTMAX
[Figure]
[Table]
To ﬁnd out the best differentiable sequence generating mechanism [Table] we also experimented with
Softmax and Gumbel-softmax (a.k.a.
concrete distribution).
Detailed results are summarized in Table 11.
We can see Softmax and Gumbelsoftmax based OT model provide less signiﬁcant gains in terms of BLEU score compared with the baseline MLE model.
In some situation, the performance even degenerate.
We hypothesized that this is because Softmax encodes more ambiguity and Gumbel-softmax has a larger variance due to the extra random variable involved.
These in turn hurts the learning.
More involved variance reduction scheme might offset such negative impacts for Gumbel-softmax, which is left as our future work.
H OT IMPROVES BOTH MODEL AND WORD EMBEDDING MATRIX
[Table]
To identify the source of performance gains, we designed a toy sequence-to-sequence experiment to show that OT help to reﬁne the language model and word embedding matrix.
We use the English corpus from WMT dataset (from our machine translation task) and trained an auto-encoder (Seq2Seq model) on this dataset.
We evaluated the reconstruction quality with the BLEU score.
In Case 1, we stop the OT gradient from ﬂowing back to the sequence model ( only affecting the word embedding matrix); while in Case 2, the gradient from
OT can affect the entire model.
Detailed results are shown in Table G.
We can see that Case 1 is better than the baseline model, which means OT helps to reﬁne the word embedding matrix.
Caseachieves the highest BLEU, which implies OT also helps to improve the language model.
[Table] [Table]
[Table] [Table]
Control your
[Table] [Table]
leaders presented the
[Table]
ruling as a democratic breakthrough because it gives Hong Kongers a direct vote, but the decision also makes clear that Chinese leaders would retain a ﬁrm hold on the process through a nominating committee tightly controlled by Beijing.
[Table]
The Chinese leadership presented Sunday s decision as a democratic breakthrough because it gives the citizens of Hong Kong a direct right to vote , but the decision also makes it clear that the Chinese leadership keeps the process ﬁrmly in the hands of a government-controlled Nomination Committee .
[Table]
The Chinese leadership presented Sunday s decision as a democratic breakthrough , because Hong Kong s citizens have a direct right to vote , but the decision also makes it clear that the Chinese leadership is ﬁrmly in control of the process through a UN-controlled nomination committee .
[Table]
Her mother arrived at Mount Sinai Hospital Thursday after an emergency call that she was in cardiac arrest at an Upper East Side clinic, Yorkville Endoscopy, sources said.
[Table]
According to sources , her mother was sent to Mount Sinai on Thursday after an emergency due to heart failure in a clinic at the Upper East Side , Yorkville Endoscopy .
[Table]
According to sources , her mother was sent to Mount Sinai hospital on Thursday after an emergency due to heart closure in a clinic at the Upper East Side , Yorkville Endoscopy .
[Table]
had
[Table]
withdraw from
[Table]
two
[Table]
and
[Table]
the
[Table]
separatists ,
[Table]
Andrij
[Table]
, Speaker of the Ukrainian National
[Table]