Approximate Distribution Matching for Sequence-to-Sequence Learning

08/24/2018 ∙ by Wenhu Chen, et al. ∙ Microsoft The Regents of the University of California 2

Sequence-to-Sequence models were introduced to tackle many real-life problems like machine translation, summarization, image captioning, etc. The standard optimization algorithms are mainly based on example-to-example matching like maximum likelihood estimation, which is known to suffer from data sparsity problem. Here we present an alternate view to explain sequence-to-sequence learning as a distribution matching problem, where each source or target example is viewed to represent a local latent distribution in the source or target domain. Then, we interpret sequence-to-sequence learning as learning a transductive model to transform the source local latent distributions to match their corresponding target distributions. In our framework, we approximate both the source and target latent distributions with recurrent neural networks (augmenter). During training, the parallel augmenters learn to better approximate the local latent distributions, while the sequence prediction model learns to minimize the KL-divergence of the transformed source distributions and the approximated target distributions. This algorithm can alleviate the data sparsity issues in sequence learning by locally augmenting more unseen data pairs and increasing the model's robustness. Experiments conducted on machine translation and image captioning consistently demonstrate the superiority of our proposed algorithm over the other competing algorithms.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

Introduction

Deep learning has achieved great success in recent years, especially in sequence-to-sequence applications like machine translation [Bahdanau, Cho, and Bengio2014, Cho et al.2014], image captioning [Xu et al.2015, Rennie et al.2017], abstractive summarization [Rush, Chopra, and Weston2015, Paulus, Xiong, and Socher2017] and speech recognition [Wu et al.2016a, Lu et al.2015], etc. The most common approaches are based on neural networks which employ very large parameter set to learn a transductive function between the input space and the target space.

The key problem faced by neural sequence-to-sequence model is how to learn a robust transductive function in such a high-dimensional space with rather sparse human-annotated data pairs. For example, machine translation takes the input sequence which lies in the space of to output sequence in another space, where denote the vocabulary sizes and denote the sequence lengths. In the large-scale problem, the input and output space become so large that any amount of annotated dataset appears to be sparse. Such data sparsity problem poses great challenges for the model to understand both the input and output diversity. It’s worth noting that our claimed data sparsity problem is specific to sequence-to-sequence scenario, which is slightly different from curse of dimensionality111The curse of dimensionality problem happens when the feature dimension is too high for the limited data to fit while our claimed data sparsity happens when the data space is too large for the limited data to cover.. In general, our method runs parallel with the methods which prevent model overfitting like l1/2 regularization, dropout [Srivastava et al.2014], and etc.

Figure 1: Illustration of our method: (A) There are two true distributions in the source and target space, red means the source sequence and blue means the target sequence. Here we assume there are four training sample pairs (dots) and one testing sample (triangles) in the dataset. (B) We use the sequence-to-sequence model to maximize the likelihood of target data points given source data points. Though the alignments of four dots are perfect, the overall space is misaligned causing errors in testing samples. (C) We use the augmenters to expand dots as ellipses for both sides. (D) The sequence-to-sequence model can align the overall source and target space better, thus minimizing the error for testing samples.

In order to resolve the specific data sparsity problem in sequence-to-sequence learning, different data augmentation approaches [Sennrich, Haddow, and Birch2016, Ma et al.2017, Norouzi et al.2016, He et al.2016, Chen et al.2018] have been proposed. These methods are mainly focused on “augmenting” pseudo-parallel data to fully explore the data space, their main weaknesses can be mainly summarized into the following aspects: 1) Back-Translation [Sennrich, Haddow, and Birch2016] are specific to certain task like NMT; 2) Reward-Augmented Training [Ma et al.2017, Norouzi et al.2016] fail to consider source side diversity; 3) Dual Learning [He et al.2016] requires duality property and additional resources.

In this paper, we are devoted to design a general-purpose sequence-to-sequence learning algorithm to alleviate data sparsity problem without relying on any external resources. We first assume every example in the dataset actually represents an unknown latent distribution, which we need to approximate. In the language domain, the latent distribution could be viewed as a set of paraphrases, while in the image domain, the latent distribution could be thought of as a set of similar pictures. The current prevalent heuristics for approximating the latent distribution 

[Norouzi et al.2016] are mainly based on token-level replacement, which are known to suffer from the following problems: 1) Inconsistency: RAML [Norouzi et al.2016] does not retain the fidelity to original data pairs and breaks the pairwise correspondence222RAML could turn an English sentence from “a girl is going to school” into “a girl is going to kitchen” while a German translation from “ein(a) Mädchen(girl) gehe(goes) …” to “ein(a) Junge(boy) gehe(goes) …”.. 2) Broken Structure: paraphrasing potentially breaks the structure of the sequence and causes unnecessary errors333Heuristic replacement could turn a source sentence from “a girl is going to school” into “a girl plans to school”.

. 3) Discreteness: these methods are merely used for a sequence with discrete tokens, not suitable for a sequence with continuous vector scenario.

In order to defeat these issues to augment fluent and well-corresponded source-target pairs, we design our system to meet the following three criterion: 1) generability: we employ the generative model (augmenter) to generate new sequences rather than using hard replacements, which can avoid broken structure and be applicable to continuous variable scenarios; 2) fidelity: we restrict the augmented pair to follow their original prototype by maximizing their likelihood computed by the sequence model; 3) diversity: we encourage the augmenters to output more unseen samples to cover the large data space. These designs can enable the augmenters to better approximate the latent distributions, which then enhances the robustness of sequence-to-sequence learning. A pedagogical illustration is shown in Figure 1, where we learn the latent distribution and then employ the sequence model to align them. The testing error can be reduced by fully exploring the data space.

In conclusion, the major contributions of our paper are described as follows:

  • [noitemsep,topsep=0pt]

  • we are the first to view sequence-to-sequence learning as a distribution matching problem.

  • we have successfully applied our algorithm into two large-scale real-life tasks and design corresponding architectures for them.

  • we have empirically demonstrated that our method can remarkably outperform the existing algorithms like MLE, RL, and RAML.

Related Literature

Neural Sequence Model

A major recent development in machine learning community is the adoption of neural networks. Neural network models promise better sharing of statistical evidence between similar words and inclusion of rich context. Since 

[Bahdanau, Cho, and Bengio2014, Cho et al.2014] proposed the sequence-to-sequence model, it has been widely adopted in the industries and academia. Later on, many follow-up works on machine translation like [Chen et al.2016, Wu et al.2016b] and visual captioning [Xu et al.2015, Rennie et al.2017, Chen, Lucchi, and Hofmann2016] have been proposed to achieve state-of-the-art performance.

Reinforcement Learning

Exposure bias and train-test loss discrepancy are two major issues in the training of sequence prediction models in neural machine translation or image captioning. Many research works  

[Bahdanau, Cho, and Bengio2014, Ranzato et al.2015, Xu et al.2015, Rennie et al.2017] have attempted to tackle these issues by exposing the model to its own distribution and directly maximizing task-level rewards. These methods are reported to achieve significant improvements in many applications like machine translation, image captioning and summarization, etc. These works are able to encourage the sequence model to exploit the target space better by driving it with a human-crafted reward signal, our method can also encourage the sequence model to exploit the source and target space with a sophisticated model-based reward signal.

Reward Augmented Training

One successful approach for data augmentation in neural machine translation system is RAML [Norouzi et al.2016], which proposes a novel payoff distribution to augment training samples based on task-level reward (BLEU, Edit Distance, etc). In order to sample from this intractable distribution, they further stratify the sampling process as first sampling an edit distance, then performing random substitution/deletion operations. In order to combat the unnecessary noises introduced by the random replacement strategy, our method considers semantic and syntactic context to perform paraphrase generation.

Preliminary

Here we first introduce the sequence-to-sequence model proposed in [Cho et al.2014, Bahdanau, Cho, and Bengio2014], which applies two recurrent neural networks [Mikolov et al.2010] to separately understand input sequence and generate output sequence. This framework has been widely applied in various sequence generation tasks due to its simplicity and end-to-end nature, which successfully avoids expensive human-crafted features. The sequence model receives the feedback and form a distribution

over the output space according to chain rule as follows:

(1)

where are the recurrent units, is a global attention function to compute the attention weights over the input information . For generality, the sequence element could be a discrete integer or a real-value vector depending on the distribution . In language related task, lies in the discrete space , where the most frequently used is the Multinomial distribution:

(2)

where is the output of function .

In contrast, in visual captioning, can be seen as the representation of image lying in the continuous d-dimensional space

, where the most popular option is multivariate Gaussian distribution:

(3)

where are the Gaussian mean and deviation obtained from functions . We will cover these two cases in the following sections.

Figure 2: Illustration of our objective function: both source and target augmenters are expanding their own data samples into distributions. The sequence model transforms the source distribution into the target domain, which is matched against augmented target distribution by minimizing the KL-divergence. The additional entropy regularization is designed to increase output diversity.

Model

Overview

Here we demonstrate our philosophy using a pedagogical illustration in Figure 1, the example demonstrates how our distribution-matching framework works in combating data sparsity problem to improve model’s ability to understand the diversity in both sides. Our framework first introduces the parallel augmenter, which views the source-target pairs from the dataset as a prototype and aims at augmenting them simultaneously to output synthetic pairs . Specifically, we parameterize the source side and target side augmenters as and , which are also implemented with recurrent neural networks. Then we elaborate the above mentioned constraints (see introduction) into two objective functions:

  • Matching loss: the transformed source distribution should match its corresponding local latent distribution in the target domain.

    (4)

    where we use to denote the marginal likelihood . However, we found that such KL-divergence can degenerate into Maximum Likelihood Estimation by setting to Kronecker-delta function . Such scenario will violate the diversity constraint, therefore, we leverage an entropy regularization term in the source side to avert that. The matching loss can hence be expressed as follows:

    (5)
  • Fidelity Loss: the randomly drawn samples should remain fidelity to its own ground truth.

    (6)

    where denotes the similarity score (e.g. BLEU, METEROR in discrete case, or other distance measure in continuous case).

With the above two loss function, we propose to sum them as the combined loss function as follows:

(7)

Here we draw a pedagogical illustration of our proposed objective function in Figure 2

. During optimization, we will optimize the joint loss function directly with stochastic gradient descent.

Optimization

Formally, we first write gradient of matching loss with respect to two augmenters and the sequence model as follows:

(8)

Here we adopt Monte-Carlo algorithm to approximate the gradients as follows: 1) sample N source sequence samples and N target sequence samples from augmenters. 2) estimate with . 3) use the sampled source and target sequences to estimate the gradients as follows:

Then we write gradient of fidelity loss with respect to two augmenters as follows:

(9)

Since the augmenters and sequence model are mutually dependent, we adopt an alternate iterative training algorithm to update these terms as described in Algorithm 1.

procedure Pre-training
     Initialize model parameters
     Initialize learning rate
     Pre-train the sequence model with Maximum Likelihood Estimation
end procedure
procedure Distribution Matching
     while Not Converged do
         Draw random samples
         if update augmenter then
              # Augmenter gradient descent
              
              
         else if update sequence-model then
              # Sequence model gradient descent
              
         end if
         Decay learning rate
     end while
end procedure
Algorithm 1 Distribution matching framework for Sequence-to-Sequence

Experiments

In order to evaluate our distribution matching frameworks on different sequence-to-sequence applications, we select the most popular machine translation and image captioning as our benchmark. We compare our method against state-of-the-art approaches as well as MLE, RAML and RL methods. Here we design two types of augmenters as described in Figure 3 to handle two different scenarios for machine translation and visual captioning. Our method is abbreviated as S2S-DM in the following sections. For comparability, we follow the existing papers [Bahdanau, Cho, and Bengio2014, Xu et al.2015] to adopt same network architecture, and we also apply learning rate annealing strategy described in [Wu et al.2016b] to further boost our system performance. We trained all our models on Titan X GPU, the experiments for both machine translation and visual captioning take within 3 days (excluding pre-training) to achieve the reported score. For machine translation, the performance is reported with the standard measure BLEU-4, while for image captioning, the performance is reported with CIDEr, METEOR and BLEU4 to measure different aspects of the generated captions.

Figure 3: Two realizations of augmenter: the discrete augmenter uses RNN architecture to generate discrete tokens. The continuous augmenter uses the re-parametrization trick to generate continuous feature vector with a multivariate Gaussian distribution.

denotes the multinomial distribution with categorical probability

, while and denote the mean and deviate for dimension for multi-variate Gaussian distribution.

Baseline systems

In both experiments, we specifically compare with the following three baselines:

  • MLE: The maximum likelihood estimation is the de facto algorithm to train sequence-to-sequence model, here we follow [Bahdanau, Cho, and Bengio2014] to train attention-based sequence-to-sequence model.

  • RL: REINFORCE [Williams1992] has been frequently used in sequence training to maximize the task-level metrics like [Ranzato et al.2015, Bahdanau et al.2016], etc. Here we design use delta BLEU as the reward function and use policy gradient to update the sequence model.

  • RAML: We follow  [Norouzi et al.2016] to select the best temperature in all experiments. In order to sample from the intractable payoff distribution, we adopt a stratified sampling technique described in [Norouzi et al.2016]. Given a ground truth , we first sample an edit distance , and then randomly select positions to replace the original labels. For each sentence, we randomly sample four candidates to perform RAML training.

Task 1: Machine Translation

In the machine translation experiments, we follow  [Bahdanau, Cho, and Bengio2014, Chung et al.2014] to design our seq-to-seq translation model. The two augmenters are also implemented with the same architecture, but they take the groundtruth tokens as their inputs. The goal of augmenters is to approximate the latent distribution with a Multinomial distribution (depicted in Figure 3):

where is the recurrent state obtained by transition function in each step and as the softmax parameters, is the distribution over the whole vocabulary, where is an summarization vector from the ground truth sequence . Here we write the derivatives as follows:

We use to denote the whole parameter sets in layer and RNN transition function .

IWSLT2014 German-English Dataset

This corpus contains 153K sentences while the validation dataset contains 6,969 sentences pairs. The test set comprises dev2010, dev2012, tst2010, tst2011 and tst2012, and the total amount is 6,750 sentences. We adopt 512 as the length of RNN hidden stats and 256 as embedding size. We use the bidirectional encoder and initialize both its own decoder states and coach’s hidden state with the learner’s last hidden state. We pre-trained the model using MLE using a batch size of 128, we stop the pre-training stage when the dev set score converges. Then we start pre-training the augmenter using self-reconstruction, which maximizes the objective function , such pre-training procedure makes sure that the augmenter has a high initial fidelity. Finally, we train the three models jointly with distribution matching loss function. We use BLEU4 [Papineni et al.2002]

as the evaluation metrics throughout the experiments.

Experimental Results

The experimental results for IWSLT2014 German-English and English-German Translation Task are summarized in Table 1, where we compare with MLE, RL, RAML, and many other popular competing algorithms like the reinforcement-based (MIXER and A-C), augmentation-based method (Softmax-Q) and state-of-the-art method (Transformer). From the table, we can observe that our distribution matching method outperforms all these methods and brings significant gains in both translation directions.

Model DE2EN EN2DE
MIXER [Ranzato et al.2015] 21.81 -
BSO [Wiseman and Rush2016] 26.36 -
A-C [Bahdanau et al.2016] 28.53 -
Softmax-Q [Ma et al.2017] 28.77 -
Transformer [Vaswani et al.2017] 30.21 25.02
MLE 29.10 24.40
RL 29.70 24.75
RAML 29.47 24.86
S2S-DM 30.92 25.54
Table 1: Experimental results on IWSLT-2014 German-English Machine Translation Task

Task 2: Image Captioning

In the image captioning experiments, we follow [Rennie et al.2017, Xu et al.2015] to design our seq-to-seq captioning model as depicted in Figure 4. The two augmenters are also based on similar architecture (depicted in Figure 3), but the source augmenter takes the visual representation as input while the target augmenter takes the groundtruth tokens as inputs (same as MT augmenter). For source augmenter, we use the re-parameterization trick to denote the continuous visual representation as a multi-variate Gaussian distribution

. By assuming independence between dimensions, we can simplify the standard deviate

as

. Hence, the output probability distribution can be written as follows:

We here adopt re-parameterization trick and use an RNN to predict the deviate at each time step with and . The noise is sampled from isotropic Gaussian and the RNN hidden state is obtained from transition function . We use to denote the individual dimension and formally write its derivatives as follows:

where represents the multi-variate Gaussian dimension, and represents the length of the sequence. We use to denote the whole parameter sets in both and RNN .

Figure 4: The sequence-to-sequence architecture flattens the image CNN feature map as a sequence to fully represent the image’s spatial features.

MSCOCO Dataset

We evaluate the performance of our model on MS-COCO captioning dataset [Lin et al.2014]. The MS-COCO dataset contains 123,287 images for training and validation, 40775 images for testing. Here we use the standard split described by Karpathy444https://github.com/karpathy/neuraltalk2

for which 5000 images were used for both validation and testing and the rest for training. We pre-train the model on this data using a batch size of 256 and validate on an out-of-domain held-out set, this stage is ended when the validation score converges or the maximum number of epochs is reached. After pre-training, we continue distribution matching training on the original paired dataset. The LSTM hidden, image, word and attention embeddings dimension are fixed to 512 for all of the models discussed herein. We initialize all models by training the model under the cross-entropy objective with a learning rate of

. We anneal the learning rate by a factor of 0.8 every three epochs. At test time, we do beam search with a beam size of 4 to decode words until the end sentence symbol is reached. We use different standard evaluation metrics described in [Chen et al.2015], including BLEU@N [Papineni et al.2002], METEOR, and CIDEr to measure different aspects of generated captions.

Model CIDEr BLEU MET
Neuraltalk2 66.0 23.0 19.5
Soft-Attention [Xu et al.2015] 66.7 24.3 23.9
Att2in SCST [Rennie et al.2017] 111.4 33.3 26.3
Att2in MLE [Rennie et al.2017] 101.3 31.3 26.0
Att2in RL [Rennie et al.2017] 109.8 32.8 26.0
Att2in RAML 98.5 31.2 26.0
S2S-DM 112.8 33.9 26.4
Table 2: Experimental results on image captioning task, where we use CIDEr, BLEU4 and METEOR (MET) to measure the system performance.
Synonym
Replacement
Reference taihsi natives seeking work … being hired, and later their colleagues maintain …
Sample taihsi natives seeking work … being employed, and later their colleagues maintain …
Simplification Reference i once took mr tung … that a narrow alley could have accommodated so many people.
Sample i once took mr tung … that a narrow alley have a lot of people.
Re-Ordering Reference he and I went to the theater yesterday to see a film.
Sample I and he went to the theater yesterday to see a film.
Repetition/Missing Reference and i had recently discovered a bomb shelter
Sample i have discovered a place place
Table 3: Samples drawn from Augmenter in LDC Chinese-English Translation task

Experimental Results

We summarize the experimental results in Table 2, where we mainly compare with MLE, RL, and RAML. We implement our Att2in RAML and S2S-DM based on the open repository555https://github.com/ruotianluo/self-critical.pytorch. As can be seen, our method achieves remarkable gains across different metrics over RL, MLE and RAML, besides, our single model best results also slightly outperform SCST training algorithm [Rennie et al.2017]. These results have consistently demonstrated the advantage of distribution matching algorithm under continuous sequence scenarios, which can be potentially extended to more vision-related sequence-to-sequence tasks.

Results Analysis

From the above results, we can observe limited improvements yielded by the RAML algorithm on most tasks and even causes performance degradation in some tasks (LDC Chinese-English, Image Captioning). We conjecture that it’s caused by the heuristic strategic replacement strategy which breaks both the semantic and structure information. Especially in image captioning, there already exist five references for the target side, further augmenting the target site receives very little gain. For reinforcement learning, it only focuses on enhancing the target-side decision process, while our method to augment the source sequence is able to expose the model to more unseen source-side sequences. Such advantage makes our model better in handling unseen visual representation and generalizing test cases. We empirically verify the effectiveness of S2S-DM algorithm on augmenting both the discrete and continuous sequence data pairs.

Learning Curves

Here we showcase the learning curves of the sequence-to-sequence model for both the IWSLT machine translation task and image captioning task separately in Figure 5 and Figure 6. We can observe very stable improvements of our distribution matching algorithm over the pre-trained model. In machine translation task, RL and RAML can both boost the model by 0.5-0.8 BLEU, while distribution matching can boost roughly 1.5 BLEU. In image captioning, RAML does not benefit the training evidently, while RL and distribution matching both improve the performance remarkably in terms of CIDEr-D.

Figure 5: Learning curves for machine translation.
Figure 6: Learning curves for machine translation.

Case Studies

In order to give a more intuitive view of latent distribution approximated by our augmenters, we here draw some high-probability samples from the augmenters. We can observe that most of the sample pairs remain their fidelity to the original pair, their modifications against the original ground truth are mainly classified into four types, which we demonstrate in 

Table 3. Though the augmenter introduces some noises into the references, these noises are still under control, and the most frequent noises are missing and repetition. Further, we also demonstrate a few image captioning examples in Figure 7 to showcase the advantage of our distribution-matching framework. As can be seen, the generated samples adopt a more vivid and diverse language expression. More detailed descriptions about the objects in the picture are included.

Figure 7: Examples of captions on MS-COCO dataset, we compare with the samples generated with MLE method.

Conclusion

In this paper, we propose a new end-to-end training algorithm to resolve the data sparsity problem in sequence-to-sequence applications. We have verified the capability of our model in two popular applications (machine translation and image captioning) to understand more diverse inputs and generate more complicated outputs. We look forward to testing our algorithms on more sequence-to-sequence applications to verify its generality.

References

Appendix A Supplementary Material

LDC Chinese-English Dataset

The LDC Chinese-English training corpus consists of 1.25M parallel sentence, 27.9M Chinese words and 34.5M English words. We choose NIST 2003 as our development set and evaluate our results on NIST 2005, NIST2006. We adopt a similar setting as IWSLT German-English translation task, we use 512 as hidden size for GRU cell and 256 as embedding size. The experimental results for LDC Chinese-English translation task are listed in Table 4.

Model
CH2EN
NIST03/05/06
EN2CH
NIST03/05/06
MLE 39.0 / 37.1 / 39.1 17.57 / 16.38 / 17.31
RL 41.0 / 39.2 / 39.3 18.44 / 16.98 / 17.80
RAML 40.2 / 37.3 / 37.2 17.83 / 16.52 / 16.79
S2S-DM 41.8 / 39.3 / 39.5 18.92 / 17.36 / 17.88
Table 4: Experimental results on NIST Chinese-English Machine Translation Task

Augmenter Results Visualization

Such observation has confirmed our intuition to build a semantic/syntactic preserving cluster around the ground truth. We here showcase the paired augmentation samples in Figure 8.

Figure 8: Paired samples drawn from augmenters in IWSLT DE-EN translation task.