Title: DISTILLING THE KNOWLEDGE OF BERT FOR TEXT GENERATION Anonymous authors Paper under double-blind review

Abstract: Large-scale pre-trained language model, such as BERT, has recently achieved great success in a wide range of language understanding tasks. However, it remains an open question how to utilize BERT for text generation tasks. In this paper, we present a novel approach to addressing this challenge in a generic sequence-to-sequence (Seq2Seq) setting. We first propose a new task, Conditional Masked Language Modeling (C-MLM), to enable fine-tuning of BERT on target text-generation dataset. The fine-tuned BERT (i.e., teacher) is then exploited as extra supervision to improve conventional Seq2Seq models (i.e., student) for text generation. By leveraging BERT's idiosyncratic bidirectional nature, distilling the knowledge learned from BERT can encourage auto-regressive Seq2Seq models to plan ahead, imposing global sequence-level supervision for coherent text generation. Experiments show that the proposed approach significantly outperforms strong baselines of Transformer on multiple text generation tasks, including machine translation (MT) and text summarization. Our proposed model also achieves new state-of-the-art results on the IWSLT German-English and English-Vietnamese MT datasets. 1

1. INTRODUCTION:

Large-scale pre-trained language model, such as ELMo (Peters et al., 2018) , GPT (Radford et al., 2018) and BERT (Devlin et al., 2019) , has become the de facto first encoding step for many natural language processing (NLP) tasks. For example, BERT, pre-trained with deep bidirectional Transformer (Vaswani et al., 2017) via masked language modeling and next sentence prediction, has revolutionized the state of the art in many language understanding tasks, such as natural language inference (Bowman et al., 2015) and question answering (Rajpurkar et al., 2016) .

However, beyond common practice of fine-tuning BERT for language understanding (Wang et al., 2019) , applying BERT to language generation still remains an open question. Text generation aims to generate natural language sentences conditioned on certain input, with applications ranging from machine translation (Cho et al., 2014; Sutskever et al., 2014; Bahdanau et al., 2015) , text summarization (Nallapati et al., 2016; Gehring et al., 2017; Chen & Bansal, 2018) ), to image captioning (Vinyals et al., 2015; Xu et al., 2015; Gan et al., 2017) . In this paper, we study how to use BERT for better text generation, which to the best of our knowledge is still a relatively unexplored territory.

Intuitively, as BERT is learned with a generative objective via Masked Language Modeling (MLM) during the pre-training stage, a natural assumption is that this training objective should have learned essential, bidirectional, contextual knowledge that can help enhance text generation. Unfortunately, this MLM objective is not auto-regressive, which encumbers its direct application to auto-regressive text generation in practice.

In this paper, we tackle this challenge by proposing a novel and generalizable approach to distilling knowledge learned in BERT for text generation tasks. We first propose a new Conditional Masked Language Modeling (C-MLM) task, inspired by MLM but requiring additional conditional input, which enables fine-tuning pre-trained BERT on a target dataset. In order to extract knowledge from the fine-tuned BERT and apply it to a text generation model, we leverage the fine-tuned BERT as a teacher model that generates sequences of word probability logits for the training samples, and treat the text generation model as a student network, which can effectively learn from the teacher's outputs for imitation. The proposed approach improves text generation by providing a good estimation on the word probability distribution for each token in a sentence, consuming both the left and the right context, the exploitation of which encourages conventional text generation models to plan ahead.

Text generation models are usually trained via Maximum Likelihood Estimation (MLE), or teacher forcing (Bengio et al., 2015) : at each time step, it maximizes the likelihood of the next word conditioned on its previous ground-truth words. This corresponds to optimizing one-step-ahead prediction. As there is no explicit signal towards global planning in the training objective, the generation model may incline to focusing on local structure rather than global coherence. With our proposed approach, BERT's looking into the future ability can act as an effective regularization method, capturing subtle long-term dependencies that ensure global coherence and in consequence boost model performance on text generation.

An alternative way to leverage BERT for text generation is to initialize the parameters of the encoder or decoder of Seq2Seq with pre-trained BERT, and then fine-tuning on the target dataset. However, this approach requires the encoder/decoder to have the same size as BERT, inevitably making the final text generation model too large. Our approach, on the other hand, is modular and compatible to any text-generation model, and has no restriction on the model size (e.g., large or small) or model architecture (e.g., LSTM or Transformer).

The main contributions of this work are three-fold. (i) We present a novel approach to utilizing BERT for text generation. The proposed method induces sequence-level knowledge into the conventional one-step-ahead and teacher-forcing training paradigm, by introducing an effective regularization term to MLE training loss. (ii) We conduct comprehensive evaluation on multiple text generation tasks, including machine translation, text summarization and image captioning. Experiments show that our proposed approach significantly outperforms strong Transformer baselines and is generalizable to different tasks. (iii) The proposed model achieves new state-of-the-art on both IWSLT14 German-English and IWSLT15 English-Vietnamese datasets.

2. RELATED WORK:

Pre-trained Language Models Prior to pre-trained language model, word embeddings (Mikolov et al., 2013; Pennington et al., 2014; Bojanowski et al., 2017) were widely used for NLP tasks. Recently, CoVe (McCann et al., 2017) introduced (conditional) language models pre-trained on paired machine translation corpus. ELMo (Peters et al., 2018) learned a contextual language model on a large corpus with bidirectional RNN. GPT (Radford et al., 2018) used unidirectional Transformer to achieve better contextualized word representation. By fine-tuning pre-trained language models, ULMFit (Howard & Ruder, 2018 ) also achieved promising results on text classification.

In our study, we focus on BERT due to its superior performance on multiple language understanding tasks. However, different from previous work exploiting BERT for language understanding tasks, here we aim to apply BERT to text generation. To the best of our knowledge, this is still a relatively unexplored space. The proposed approach is also model-agnostic and can be applied to other pretrained language models as well.

BERT for Text Generation There has been some recent attempt on applying BERT to text generation. Specifically, Lample & Conneau (2019) trained cross-lingual MLM and demonstrated promising results for cross-lingual natural language inference (Conneau et al., 2018) and unsupervised neural machine translation (NMT) (Lample et al., 2018) . Wang & Cho (2019) formulated BERT as a Markov Random Field LM and showed preliminary results on unsupervised text generation with improved diversity. Zhang et al. (2019a) utilized an encoder with BERT and a two-stage decoder for text summarization. Song et al. (2019) proposed Masked Seq2Seq (MASS) pre-training, demonstrating promising results on unsupervised NMT, text summarization and conversational response generation. Concurrent with our work, Ghazvininejad et al. (2019) proposed a similar conditional MLM for constant-time translation, and Yang et al. (2019) studied how to fine-tune BERT for NMT.

Our approach is novel in the sense that we do not directly use the parameters of BERT in the Seq2Seq model. Instead, BERT acts as an effective regularization to the MLE training loss, by proactively injecting future information for predicting the present. Right-to-Left Generation Our work also shares a high-level intuition with those approaches that try to regularize left-to-right generative models with a right-to-left counterpart. Specifically, Liu et al. (2016) trained a separate reverse NMT and performed joint decoding at inference time to enforce agreement between forward and reverse models. Twin Networks (Serdyuk et al., 2018) used a backward RNN jointly trained with a forward RNN decoder by matching their hidden states. Zhang et al. (2019b) further extended the idea to Transformer with joint training, so that the forward and the backward models iteratively improve each other. Our proposed approach stems from a similar intuition. However, we focus on using pre-trained language model such as BERT to regularize an auto-regressive generation model. Knowledge Distillation Our method shares the same loss formulation as Knowledge Distillation (KD) proposed in Bucilu et al. (2006) ; Hinton et al. (2015) ; Kim & Rush (2016) , where a smaller student model is trained on soft labels provided by a larger teacher model. More recently, Tan et al. (2019) applied KD to multilingual NMT, and Sun et al. (2019) proposed patient KD for BERT model compression. Compared with these previous studies, where both the teacher and the student are trained on the same task, our approach is different in the sense that the BERT teacher is not designed to perform the student's generation task. We focus on using KD to leverage the learned knowledge of BERT for text generation, while previous work mostly focused on model compression.

3. PROPOSED APPROACH:

In this section, we present our proposed approach to distilling the knowledge in BERT for text generation in generic sequence-to-sequence (Seq2Seq) setting. We first review Seq2Seq learning in Section 3.1, and then describe the proposed approach in Section 3.2 and 3.3.

3.1. SEQUENCE-TO-SEQUENCE LEARNING:

Seq2Seq learning (Sutskever et al., 2014) aims to generate a sequence of discrete output Y = (y 1 , . . . , y N ) of length N , conditioned on a sequence of discrete input X = (x 1 , . . . , x M ) of length M . A Seq2Seq model learns parameters θ to estimate the conditional likelihood P θ (Y |X), typically trained via Maximum Likelihood Estimation (MLE), or equivalently, minimizing the cross-entropy loss as follows:

EQUATION

where each conditional probability can be calculated via an attention-based recurrent neural network (RNN) (Bahdanau et al., 2015; Luong et al., 2015) , Transformer (Vaswani et al., 2017) , or any other neural sequence-generation models.

3.2. FINE-TUNING BERT WITH CONDITIONAL MLM:

This generic Seq2Seq learning framework is the state of the art on a wide range of text generation tasks. Using modern deep neural networks, the conditional probabilities can be readily modeled as a sequence of classifications over the word vocabulary. However, during training, in order to generate the t-th token y t , the model only sees a partial sentence y 1:t-1 from the ground-truth training data. Intuitively, it is reasonable to assume that a bidirectional model can be more informative than a leftto-right generation model, since additional context from the right (or future) is also incorporated to predict the current word. Unfortunately, this additional information is not utilized in a standard Seq2Seq model, since it can only be trained in a left-to-right manner, where the future context is masked out to prevent each word from indirectly "seeing itself ". To compensate this singledirectional limitation of Seq2Seq setting, we propose a new conditional language model (C-MLM) to enable the fine-tuning of BERT on target generation task, in hope that the fine-tuned bidirectional BERT can be utilized for better text generation.

BERT (Devlin et al., 2019 ) is a deep bidirectional Transformer trained via Masked Language Modeling (MLM).2 In a similar setting, where the input is a sequence pair (X, Y ),3 15% of the tokens are randomly masked. Formally, we denote the masked token sets as X m and Y m , and the disjoint counterpart (i.e., the unmasked tokens) as X u and Y u , respectively. The trained BERT model aims to estimate the joint probability:

EQUATION

where i and j denote the number of masked tokens in X and Y , respectively. Each x m ∈ X m , and each y m ∈ Y m . Eqn. ( 2) can be trained with the standard word-level cross-entropy loss.

We aim to marry MLM pre-training with Seq2Seq learning, to leverage bidirectional language model for text generation. To this end, we propose a conditional-MLM, a variant of MLM that allows further fine-tuning of pre-trained BERT on target dataset. For example, for machine translation, X and Y represent the source and the target sentence, respectively. We first concatenate them together and randomly mask 15% of the tokens only in Y , then train the network to model the joint probability

EQUATION

The above C-MLM objective is similar to the conditional language modeling (LM) objective in Eqn.

(1), but conditional LM only permits predicting a word based on its left context. C-MLM is also related to Masked Seq2Seq (MASS) pre-training Song et al. (2019) . However, in MASS, the encoder takes a sentence with randomly masked fragment (several consecutive tokens) as input, and the decoder tries to predict this masked fragment, which is different from our model design. The final goal is also different: MASS focuses on Seq2Seq pre-training, while we focus on leveraging BERT for text generation. In our experiments, we observe that the C-MLM task can obtain high accuracy and good generalization on word prediction. However, it is not feasible to generate sequential output directly from C-MLM. Instead, we use knowledge distillation to distill the knowledge learned from the fine-tuned BERT into a Seq2Seq model for direct text generation, which will be explained in the next sub-section.

3.3. KNOWLEDGE DISTILLATION FOR GENERATION:

Our inspiration springs from the observation that the probability distribution of the masked word y m t is estimated using both y u 1:t-1 and y u t+1:N from Y u . In other words, the distribution for a given word P (y m t |X, Y u ) contains information from both backward and forward contexts, which is a desirable benefit for providing sequence-level global guidance. This probability distribution can be considered as soft targets for a text generation model to mimic from, which potentially contains more useful and fine-grained information than the usual hard-assigned, one-hot label, therefore enhancing conventional left-to-right generation models to look into the future.

In a knowledge distillation setting, the BERT model can be considered as a teacher, while the Seq2Seq model acts as a student. Specifically, the Seq2Seq model can be trained with the following objective function:

EQUATION

where P φ (y t ) is the soft target estimated by the fine-tuned BERT with learned parameters φ, and V denotes the output vocabulary. Note that φ is fixed during the distillation process. An illustration of this learning process is provided in Figure 1 , which aims to match the word probability distribution P θ (y t ) provided by the student with P φ (y t ) provided by the teacher (i.e., distillation).

To further improve the Seq2Seq student model, hard-assigned labels are also utilized. the final model is trained with the following compound objective:

EQUATION

where α is a hyper-parameter for tuning the relative importance of the two training targets: soft estimation from fine-tuned BERT, and ground-truth hard label. Note that our proposed approach only has a minimal requirement on the architecture of the incorporated Seq2Seq model. As long as the model is trained to estimate word-level probability as in Eqn.

(1), it can be trained jointly with the proposed objective function Eqn. (5).

At a higher level, the additional loss term L bidi can be interpreted as a sequence-level objective function. Our auto-regressive (or causal) model θ tries to predict the probability distribution that matches the estimation the bidirectional teacher model predicts, hence encouraging the planning of future (right context) for generation.

4. EXPERIMENTS:

In this section, we describe our experiments on two well-studied text generation tasks: machine translation, and abstractive text summarization.

4.1. DATASETS AND TRAINING DETAILS:

Machine Translation We consider two relatively small-scale datasets, IWSLT15 English-Vietnamese (En-Vi, 113k training samples) and IWSLT14 German-English (De-En, 160k training samples), and one medium-scale dataset, WMT14 English-German (En-De, 4.5M training samples).

For IWSLT15 En-Vi, we use the pre-processed dataset provided by Luong & Manning (2015) . We use tst2012 as dev set and test on tst2013. For IWSLT14 De-En, we follow the pre-processing steps and the same train/dev/test split as in Wu et al. (2019) . For WMT14 En-De, we follow the preprocessing steps in Vaswani et al. (2017) for fair comparison. We use newstest2013 as the dev set and newstest2014 as the test set. We report BLEU scores (Papineni et al., 2002) for evaluation of MT performance following the Moses script.4 

Abstractive Summarization For summarization, we conduct experiments on the Gigaword summarization dataset (Rush et al., 2015) . Note that the original train/valid/test split of Gigaword is 3.8M/190k/2k. In our experiments, we observed severe distribution mismatch between the validation and test data. See Table 4 , 5, and Sec. 4.3 for detailed discussion. Therefore, we further sampled 5k/5k dev/test-dev splits from the validation set and tuned hyper-parameters on the dev set only. We report ROUGE scores (Lin, 2004) on test-dev for the evaluation of our proposed approach, and include results on the standard test split for the comparison with prior work.

Training and Hyper-parameters Our implementation is based on the PyTorch (Paszke et al., 2017) version of OpenNMT (Klein et al., 2018) seq2seq toolkit. We use the 'base' model of 6-layer Transformer with 512-hidden 8-head attention blocks and 2048-hidden feed-forward layer for all experiments, with label smoothing regularization (LSR) (Szegedy et al., 2016) of 0.1. We batch examples with similar sequence length, and count batch size by the number of tokens. For MT we use the pre-trained BERT-base-multilingual-cased model, and for summarization we use BERTbase-uncased as the starting point of BERT fine-tuning. 5 We use the corresponding pre-trained byte-pair-encoding (Sennrich et al., 2016) shipped together with the BERT model for tokenization.

For all training methods of all Transformer models, the learning rate schedule is set to lr = η • d -0.5 model • min(step -0.5 , step • warmup steps -1.5 ), where d model = 512 is the attention representation size (Vaswani et al., 2017) . For all BERT fine-tuning, we follow Devlin et al. (2019) use a triangular learning rate schedule with maximum learning rate η. The parameters are updated with the Adam optimizer (Kingma & Ba, 2015). In the distillation stage, we pre-compute BERT's prediction logits of the training data using top-K distillation (Tan et al., 2019) to reduce computation overhead and memory footprint, where K is set to 8 across all the experiments. We also tune the temperature T for the sof tmax applied at the teacher's logits. 6For the detailed values of the hyper-parameters for each experiment, please refer to the supplementary material. We found it necessary to train longer with L bidi , since it is still improving after the step at which the baseline Transformer starts to plateau. At inference time, we use beam search with beam size 4 and length penalty (Wu et al., 2016) of 0.6 across all the models. All the hyperparameters are tuned on the development set. Note that we tuned our Transformer baseline to achieve higher scores than the reference implementation on each dataset with default hyper-parameters (in most cases comparable to the state-of-the-art). For IWSLT German-English translation, our method improves over the Transformer baseline by 1.54 BLEU points, and achieves new state of the art. Our approach outperforms previously-reported results such as ConvS2S+MRT, a convolutional-based model (Gehring et al., 2017) with minimum risk training (Edunov et al., 2018) , and Lightweight and Dynamic Convolution (Wu et al., 2019) . Note that Wu et al. ( 2019) also tuned checkpoint averaging, which creates a soft ensemble effect. And their model has roughly the same amount of parameters as Transformer (big).

4.2. RESULTS ON MACHINE TRANSLATION:

For IWSLT English-Vietnamese translation, since most prior work experimented with RNN models, we also report RNN-based results here. This also suggests that our method is model-agnostic. Our best model outperforms Seq2Seq-OT (Chen et al., 2019) that utilizes optimal transport for sequencelevel training, as well as the ELMo and CVT results reported in Clark et al. (2018) . 8 For WMT14 ( †) from Nallapati et al. (2016) . ( ‡) from Lin et al. (2018) . ( ) from Cao et al. (2018b) . ( ) from Amplayo et al. (2018) . (•) from Cao et al. (2018a) .

English-German translation, our method still improves over the well-tuned Transformer baseline. We also report the scores of Transformer (big) and state-of-the-art Dynamic Convolution model (Wu et al., 2019) for reference.

4.3. RESULTS ON ABSTRACTIVE SUMMARIZATION:

Table 4 and Table 5 show the results of our approach on abstractive summarization task, where R-1, R-2, and R-L denote F 1 scores of ROUGE-1, ROUGE-2, and ROUGE-L, respectively. Our method shows improvement on all the metrics, as shown in Table 4 . We observe that the performance on test set is much lower, which suggests that the distribution in the test set is very different from that in the validation set, as mentioned in Section 4.1. When we manually checked the test set data, we found many corrupted examples such as short input articles, meaningless text, and dominating unknown words. Given that the official test split contains only 1,951 noisy examples, we believe that our results on the dev/test-dev sets are more reliable.

On the test split, our best model is comparable to state-of-the-art models that use much more complex architectures specifically designed for summarization. CGU (Lin et al., 2018) augmented convolutional gating units. FTSum g (Cao et al., 2018b) leveraged extra information extraction and dependency parsing features. E2T cnn (Amplayo et al., 2018) utilized entities provided by an external entity linking system. Re 3 Sum (Cao et al., 2018a) carefully designed a retrieve-and-rerank pipeline with human-written soft templates. Despite that our model has no summarization-specific model design, we still achieve comparable performance to these models on all the metrics. There are several possible factors that could contribute to the performance gain: additional parameters of BERT, extra data (pretraining corpus) of BERT, and the bidirectional nature. To better understand the key contributions of our method, we conduct an ablation study described in the following. We finetune 2 extra teachers: BERT sm and BERT l2r . For BERT sm , we use a smaller BERT (6 layers) for C-MLM finetuning, which has approximately the same number of parameters as Transformer-base9 . For BERT l2r , we use the full BERT model but finetune it using left-to-right LM as in the conventional Seq2Seq model. Next, we apply the proposed KD method to train the Transformer on En-Vi and De-En MT tasks. Results are shown in Table 6 . BERT sm still works well though the full BERT provides further improvement. On the other hand, BERT l2r slightly hurts the performance. We hypothesize that it generates noisy learning targets for the student, hence the performance drop. Empirically, we show that the bidirectional knowledge could be more important than the extra parameters, while the pre-trained weights remain useful for more stable C-MLM training.

4.4. ABLATION STUDY:



4.5. GENERATION FOR DIFFERENT LENGTHS:

We next analyze the effect of our proposed approach on different output lengths. We plot the BLEU scores on MT w.r.t. different output generation lengths N on the development set. 10 Results are provided in Figure 2 . For IWSLT German-English dataset (Figure 2 : Left), we can see a shared Table 7 : Qualitative examples from IWSLT German-English translation. Numbers inside the parenthesis are sentence-level BLEU scores. Red word is where the baseline Transformer makes a mistake without considering the possible future phrase and fails to recover. On the other hand, our model makes the right decision at the blue word, hence generates more coherent sentence. Please refer to Section 4.6 for detailed explanation.

trend that the proposed L bidi objective gains higher BLEU points on longer translation pairs. For WMT English-German (Figure 2 : Middle), we can see that although the proposed method performs much worse when the output sentences are very short, it achieves relatively consistent improvement on longer cases, hence resulting in overall BLEU improvement. For IWSLT English-Vietnamese (Figure 2 : Right), we see a similar trend when the length N > 24.

4.6. QUALITATIVE EXAMPLES:

In Table 7 , we show some translation examples on IWSLT German-English dataset. In the first example, the baseline Transformer cannot recover from 'with' and 'of ', which renders the full sentence not making much sense. "I started reading with..." would make sense from the left context; however, if the model also considers the right context "the age of two", the word 'with' would be assigned with lower probability by the soft labels provided by the BERT teacher. Even though at test-time the model cannot 'look ahead', the soft-targets at training-time prevents the over-confidence of the model on one-hot label; hence the better generalization at the test-time. Similarly, other examples show that our model can generate text more coherently w.r.t. the context on the right (underlined in Table 7 ), thus making more accurate and natural translation.

5. CONCLUSION:

In this work, we propose a novel and generic approach to utilizing pre-trained language models to improve text generation without explicit parameter sharing, feature extraction, or augmenting with auxiliary tasks. Our proposed Conditional MLM mechanism leverages unsupervised language models pre-trained on large corpus, and then adapts to supervised sequence-to-sequence tasks. Our distillation approach indirectly influences the text generation model by providing soft-label distributions only, hence is model-agnostic. Experiments show that our model improves over strong Transformer baselines on multiple text generation tasks such as machine translation and abstractive summarization, and achieves new state-of-the-art on some of the translation tasks. For future work, we will explore the extension of Conditional MLM to multimodal input such as image captioning.

A DETAILED HYPER-PARAMETER VALUES:

We run all experiments on single GPU of NVIDIA Titan RTX or V100 except for WMT En-De we use 4 V100s for training. Note that for large batch sizes that do not fit in GPU memory, we use the gradient accumulation tricks as in Ott et al. (2018) . Batch sizes are counted in number of tokens. Note that all the hyper-parameters are tuned on the development set only.

IWSLT De-En For C-MLM fine-tuning, we train for 100k steps with 5k warmup steps, η = 5 • 10 -5 , and batch size of 16k tokens. For baseline model, we train for 50k steps with 4k warmup steps and batch size of 6k tokens. The learning rate η is set to 1. For the proposed model, we train for 100k steps with 8k warmup steps and batch size of 6k tokens. The learning rate η is set to 2, α = 0.5, and T = 10. Seq2Seq model uses dropout (Srivastava et al., 2014) of 0.3 in both cases.

IWSLT En-Vi For C-MLM fine-tuning and baseline Transformer, the hyper-parameters are identical to that of IWSLT De-En. For the proposed model, we train for 100k steps with 8k warmup steps and batch size of 6k tokens. The learning rate η is set to 2, α = 0.1, and T = 5. Dropout is still 0.1.

WMT En-De For C-MLM fine-tuning, we train for 100k steps with 5k warmup steps, η = 5 • 10 -5 , and batch size of 512k tokens. For baseline model, we train for 30k steps with 4k warmup steps and batch size of 384k tokens. The learning rate η is set to 4. Since this is our largest dataset and training is slow, for the proposed model we use the baseline Transformer to initialize the Seq2Seq student. For the proposed model, we continue training for 50k steps with 4k warmup steps and batch size of 64k tokens. The learning rate η is set to 2, α = 0.1, and T = 5. Seq2Seq model uses dropout of 0.1 in both cases.

Gigaword For C-MLM fine-tuning, we train for 100k steps with 5k warmup steps, η = 5•10 -5 , and batch size of 64k tokens. For baseline model, we train for 50k steps with 4k warmup steps and batch size of 40k tokens. The learning rate η is set to 1. For the proposed model, we train for 70k steps with 4k warmup steps and batch size of 36k tokens. The learning rate η is set to 2, α = 0.1, and T = 10. Seq2Seq model uses dropout of 0.1 in both cases. 

B EXTRA GENERATION EXAMPLES:



Reference:

it would be immoral to leave these young people with a climate system spiraling out of control . Transformer it would be immoral to let these young people leave a climate system that was out of control . (44.6) Ours it would be immoral to leave these young people with a climate system out of control .

(84.3) Reference the tahltan have called for the creation of a tribal heritage reserve which will set aside the largest protected area in british columbia . Transformer tahltan demands the institution of a tribe in british columbia that should make the largest protection area in british columbia . (19.9) Ours the tahltan demands to build a tribe reserve that should be the largest protected area in british columbia . (32.2)

Table 8 : Qualitative examples from IWSLT German-English translation. Numbers inside the parenthesis are sentence-level BLEU scores. Red word is where the baseline Transformer makes a mistake without considering the possible future phrase and fails to recover. On the other hand, our model makes the right decision at the blue word, hence generates more coherent sentence. Please refer to Section 4.5 in the main paper for detailed explanation. 

:

Code will be released upon acceptance.

Besides MLM, Devlin et al. (2019) also introduced the next sentence prediction task for training BERT. We omit this task since it is unrelated to our work.

The two sequences are consecutive paragraphs sampled from a very large corpus such as Wikipedia.

For fair comparison to previous work, we report tokenized BLEU scores using https://github.com/mosessmt/mosesdecoder/blob/master/scripts/generic/multi-bleu.perl, and for WMT14 En-De, we further split the compound words after tokenization.

5 BERT pre-trained models are available at https://github.com/google-research/bert. Our fine-tuning implementation is modified from code available at https://github.com/huggingface/pytorch-pretrained-BERT.

Different from the original KD, we do not apply the same temperature on the student. In our preliminary experiment we found high T of Seq2Seq results in much worse performance. We hypothesize the low-entropy nature of conditioned text generation is not suitable for temperature scaling.

Parameter counts exclude word embedding and final linear projection, which mostly depends on the vocabulary size. BERT-base

has 86M trainable parameters.8 The CVT results used a much larger RNN and CNN-based character embedding, as well as a customized structure. Therefore, we did not try to use RNN to match their results.

We still use the pretrained weights of BERT, otherwise the C-MLM does not converge very well.

For Gigaword summarization, almost all summaries are short sentences (less than 0.5% of the summaries contain more than 16 words), so we omit the analysis.

Figures and Tables:

Figure 1: Illustration of the proposed approach to distilling knowledge from BERT for text generation. See Section 3.2 and 3.3 for details.

Figure 2: BLEU scores on IWSLT German-English, WMT English-German and IWSLT English-Vietnamese for different output lengths. Reference my mother says that i started reading at the age of two , although i think four is probably close to the truth . Transformer my mother says that i started reading with two years , but i think that four of them probably correspond to the truth . (39.6) Ours my mother says that i started reading at the age of two , but i think four is more likely to be the truth . (65.2) Reference we already have the data showing that it reduces the duration of your flu by a few hours . Transformer we 've already got the data showing that it 's going to crash the duration of your flu by a few hours . (56.6) Ours we already have the data showing that it reduces the duration of your flu by a few hours . (100.0) Reference we now know that at gombe alone , there are nine different ways in which chimpanzees use different objects for different purposes . Transformer we know today that alone in gombe , there are nine different ways that chimpanzees use different objects in different ways . (35.8) Ours we now know that in gombe alone , there are nine different ways that chimpanzees use different objects for different purposes . (71.5)

Referencechina offers tax exemptions for laid-off workers Transformer china encourages laid-off workers to seek employment Ours china offers tax exemptions to laid-off workers Reference swiss police arrest britons who allegedly ran rental car racket Transformer three britons arrested in swiss luxury hotel Ours swiss police arrest three britons in rental car racket case Reference south korea stocks extend declines as kia concerns intensify Transformer south korean stocks fall for #th time in # days ; kia leads Ours south korean stocks fall as kia troubles intensify

and

Table content: <table><tr><td>De-En Models</td><td>dev</td><td>test</td><td colspan="2">En-Vi Models</td><td colspan="2">tst2012 tst2013</td></tr><tr><td colspan="2">Our Implementations</td><td/><td/><td colspan="2">Our Implementations</td></tr><tr><td>Transformer (base)</td><td colspan="2">35.27 34.09</td><td>RNN</td><td/><td>23.37</td><td>26.80</td></tr><tr><td>+ BERT teacher</td><td colspan="2">36.93 35.63</td><td colspan="2">+ BERT teacher</td><td>25.14</td><td>27.59</td></tr><tr><td colspan="2">Other Reported Results</td><td/><td colspan="2">Transformer (base)</td><td>27.03</td><td>30.76</td></tr><tr><td>ConvS2S + MRT  ‡</td><td colspan="2">33.91 32.85</td><td colspan="2">+ BERT teacher</td><td>27.85</td><td>31.51</td></tr><tr><td>Transformer (big) Lightweight Conv Dyn. Convolution</td><td>---</td><td>34.4  † 34.8  † 35.2  †</td><td>RNN  † ELMo CVT</td><td colspan="2">Other Reported Results ---</td><td>26.1 29.3 29.6</td></tr><tr><td colspan="3">Table 1: BLEU scores for IWSLT14 German-English translation. ( †) tuned with checkpoint av-eraging and length penalty. ( ‡) from Edunov et al. (2018). ( ) from Wu et al. (2019).</td><td colspan="4">Table 2: BLEU scores for IWSLT15 English-Vietnamese translation. ( †) from Luong et al. (2017). ( ) from Clark et al. (2018).</td></tr></table>



Table content: <table><tr><td>: BLEU scores for WMT14 English-German</td></tr><tr><td>translation. ( †) tuned with checkpoint averaging. ( ‡)</td></tr><tr><td>trained on WMT16, a slightly different version of train-</td></tr><tr><td>ing data. ( ) from Vaswani et al. (2017). ( ) from Ott</td></tr><tr><td>et al. (2018). (•) from Wu et al. (2019).</td></tr></table>

ROUGE F1 scores on the official test set.

Table content: <table><tr><td>GW Models</td><td>R-1</td><td>R-2</td><td>R-L</td><td>GW Models</td><td>R-1</td><td>R-2</td><td>R-L</td></tr><tr><td/><td>Dev</td><td/><td/><td>Seq2Seq  †</td><td colspan="3">36.40 17.77 33.71</td></tr><tr><td>Transformer (base)</td><td colspan="3">46.64 24.37 43.17</td><td>CGU  ‡</td><td>36.3</td><td>18.0</td><td>33.8</td></tr><tr><td>+ BERT teacher</td><td colspan="3">47.35 25.11 44.04</td><td>FTSumg</td><td colspan="3">37.27 17.65 34.24</td></tr><tr><td/><td>Test-Dev</td><td/><td/><td>E2Tcnn</td><td colspan="3">37.04 16.66 34.93</td></tr><tr><td>Transformer (base)</td><td colspan="3">46.84 24.80 43.58</td><td>Re 3 Sum •</td><td colspan="3">37.04 19.03 34.46</td></tr><tr><td>+ BERT teacher</td><td colspan="3">47.90 25.75 44.53</td><td colspan="4">Trm + BERT teacher 37.57 18.59 34.82</td></tr><tr><td colspan="4">Table 4: ROUGE F1 scores for Gigaword abstrac-</td><td/><td/><td/><td/></tr><tr><td colspan="4">tive summarization on our internal test-dev split.</td><td/><td/><td/><td/></tr></table>

Ablation study. (Trm: Transformer)

Table content: <table><tr><td>Methods</td><td>En-Vi</td><td>De-En</td></tr><tr><td/><td>(tst2012)</td><td>(dev)</td></tr><tr><td>Transformer (base)</td><td>27.03</td><td>35.27</td></tr><tr><td>Trm + BERT l2r</td><td>26.99</td><td>35.20</td></tr><tr><td>Trm + BERTsm</td><td>27.68</td><td>36.32</td></tr><tr><td>Trm + BERT</td><td>27.85</td><td>36.93</td></tr></table>

We show Gigaword summarization examples inTable 9 and extra En-DE generation examples in Table 8. Qualitatively, our Transformer + BERT Teacher outperforms baseline Transformer and generate more coherent sentences.Reference the political climate in the u.s. at the time was tense , and there were debates going on about immigration . Transformer the political climate in the u.s. was back then , and there was constant disasters .(29.5)

Table content: <table><tr><td>Ours</td><td>the</td><td>political</td><td>climate</td><td>in</td><td>the</td><td>united</td><td>states</td><td>at</td><td>the</td><td>time</td><td>was</td></tr><tr><td/><td colspan="6">tense , and there were ongoing shifting debates . (57.3)</td><td/><td/><td/><td/><td/></tr></table>

Qualitative examples from the Gigaword summarization dataset. Baseline model suffers from early mistakes. Our model generates more coherent summaries.

Table content: <table/>

Peer review (iclr2020):
The paper focuses on text generation. It proposes to 1) fine-tune BERT for conditional masked language modeling and 2) use the fine-tuned BERT as a teacher that provides supervision signals during seq2seq training. The paper is clearly written. The proposed approach lacks a strong motivation though; I would like to see more explanation on what problem is solved by adding the BERT teacher. The empirical results are okay but not remarkable. Thus I intend to reject the submission. Approach: - The main motivation as described in the paper is *BERT’s looking into the future ability can act as an effective regularization method, capturing subtle long-term dependencies that ensure global coherence and in consequence boost model performance on text generation.* While I agree that looking into the future is useful, I don*t see why adding BERT*s future-dependent prediction to the objective is helpful. The ground truth label is also dependent on the future. - If the proposed approach does help *looking into the future*, it should improve model performance with small beam sizes or even greedy search. It would be helpful to have this experiment. - The idea itself is very similar to label smoothing. Thus I*d like to see comparison with (uninformative) label smoothing in the experiments. Experiments: - How does changing alpha affect the results? - Section 4.5: Results in Figure 2 do not consistently support the claim that the proposed approach improves on longer sequences. Minor: - Equation 5: notation is loose. Loss should sum over examples. Unclear which words are masked in Y^u.