SMART: Robust and Efficient Fine-Tuning for Pre-trained Natural Language Models through Principled Regularized Optimization

Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, Tuo Zhao

Introduction

The success of natural language processing (NLP) techniques relies on huge amounts of labeled data in many applications. However, large amounts of labeled data are usually prohibitive or expensive to obtain. To address this issue, researchers have resorted to transfer learning.

Transfer learning considers the scenario, where we have limited labeled data from the target domain for a certain task, but we have relevant tasks with a large amount of data from different domains (also known as out-of-domain data). The goal is to transfer the knowledge from the high-resource domains to the low-resource target domain. Here we are particularly interested in the popular two-stage transfer learning framework (Pan and Yang, 2009). The first stage is pre-training, where a high-capacity model is trained for the out-of-domain high-resource relevant tasks. The second stage is fine-tuning, where the high-capacity model is adapted to the low-resource task in the target domain.

For many applications in NLP, most popular transfer learning methods choose to pre-train a large language model, e.g., ELMo (Peters et al., 2018), GPT (Radford et al., 2019) and BERT (Devlin et al., 2019). Such a language model can capture general semantic and syntactic information that can be further used in downstream NLP tasks. The language model is particularly attractive, because it can be trained in a completely unsupervised manner with huge amount of unlabeled data, which are extremely cheap to fetch from internet nowadays. The resulting extremely large multi-domain text corpus allows us to train huge language models. To the best of our knowledge, by far the largest language model, T5, has an enormous size of about 11 billion parameters (Raffel et al., 2019).

For the second fine-tuning stage, researchers adapt the pre-trained language model to the target task/domain. They usually replace the top layer of the language model by a task/domain-specific sub-network, and then continue to train the new model with the limited data of the target task/domain. Such a fine-tuning approach accounts for the low-resource issue in the target task/domain, and has achieved state-of-the-art performance in many popular NLP benchmarks (Devlin et al., 2019; Liu et al., 2019c; Yang et al., 2019; Lan et al., 2019; Dong et al., 2019; Raffel et al., 2019).

Due to the limited data from the target task/domain and the extremely high complexity of the pre-trained model, aggressive fine-tuning often makes the adapted model overfit the training data of the target task/domain and therefore does not generalize well to unseen data. To mitigate this issue, the fine-tuning methods often rely on hyper-parameter tuning heuristics. For example, Howard and Ruder (2018) use a heuristic learning rate schedule and gradually unfreeze the layers of the language model to improve the fine-tune performance; Peters et al. (2019) give a different suggestion that they only adapt certain layers and freeze the others; Houlsby et al. (2019); Stickland and Murray (2019) propose to add additional layers to the pre-trained model and fine-tune both of them or only the additional layers. However, these methods require significant tuning efforts.

To fully harness the power of fine-tuning in a more principled manner, we propose a new learning framework for robust and efficient fine-tuning on the pre-trained language models through regularized optimization techniques. Specifically, our framework consists of two important ingredients for preventing overfitting:

(I) To effectively control the extremely high complexity of the model, we propose a Smoothness-inducing Adversarial Regularization technique. Our proposed regularization is motivated by local shift sensitivity in existing literature on robust statistics. Such regularization encourages the output of the model not to change much, when injecting a small perturbation to the input. Therefore, it enforces the smoothness of the model, and effectively controls its capacity (Mohri et al., 2018).

(II) To prevent aggressive updating, we propose a class of Bregman Proximal Point Optimization methods. Our proposed optimization methods introduce a trust-region-type regularization (Conn et al., 2000) at each iteration, and then update the model only within a small neighborhood of the previous iterate. Therefore, they can effectively prevent aggressive updating and stabilize the fine-tuning process.

We compare our proposed method with several state-of-the-art competitors proposed in Zhu et al. (2020); Liu et al. (2019b, c); Lan et al. (2019); Raffel et al. (2019) and show that our proposed method significantly improves the training stability and generalization, and achieves comparable or better performance on multiple NLP tasks. We highlight that our single model with 356M parameters (without any ensemble) can achieve three state-of-the-art results on GLUE, even compared with all existing ensemble models and the T5 model (Raffel et al., 2019), which contains 11 billion parameters. Furthermore, we also demonstrate that the proposed framework complements with SOTA fine-tuning methods (Liu et al., 2019b) and outperforms the T5 model.

We summarize our contribution as follows: 1. We introduce the smoothness-inducing adversarial regularization and proximal point optimization into large scale language model fine-tuning; 2. We achieve state-of-the-art results on several popular NLP benchmarks (e.g., GLUE, SNLI, SciTail, and ANLI).

Notation: We use f(x;θ)f(x;\theta) to denote a mapping ff associated with the parameter θ\theta from input sentences xx to an output space, where the output is a multi-dimensional probability simplex for classification tasks and a scalar for regression tasks. ΠA\Pi_{\mathcal{A}} denotes the projection operator to the set A\mathcal{A}. DKL(PQ)=kpklog(pk/qk)\mathcal{D}_{KL}(P||Q)=\sum_{k}p_{k}\log(p_{k}/q_{k}) denotes the KL-divergence of two discrete distributions PP and QQ with the associated parameters of pkp_{k} and qkq_{k}, respectively.

Background

The transformer models were originally proposed in Vaswani et al. (2017) for neural machine translation. Their superior performance motivated Devlin et al. (2019) to propose a bidirectional transformer-based language model named BERT. Specifically, Devlin et al. (2019) pre-trained the BERT model using a large corpus without any human annotation through unsupervised learning tasks. BERT motivated many follow-up works to further improve the pre-training by introducing new unsupervised learning tasks (Yang et al., 2019; Dong et al., 2019; Joshi et al., 2020), enlarging model size (Lan et al., 2019; Raffel et al., 2019), enlarging training corpora (Liu et al., 2019c; Yang et al., 2019; Raffel et al., 2019) and multi-tasking (Liu et al., 2019a, b).

The pre-trained language model is then adapted to downstream tasks and further fine-tuned. Specifically, the top layer of the language model can be replaced by a task-specific layer and then continue to train on downstream tasks. To prevent overfitting, existing heuristics include choosing a small learning rate or a triangular learning rate schedule, and a small number of iterations, and other fine-tuning tricks mentioned in Howard and Ruder (2018); Peters et al. (2019); Houlsby et al. (2019); Stickland and Murray (2019).

Our proposed regularization technique is related to several existing works (Miyato et al., 2018; Zhang et al., 2019; Shu et al., 2018). These works consider similar regularization techniques, but target at other applications with different motivations, e.g., semi-supervised learning, unsupervised domain adaptation and harnessing adversarial examples in image classification.

Our proposed optimization technique covers a large class of Bregman proximal point methods in existing literature on optimization, including vanilla proximal point method (Rockafellar, 1976), generalized proximal point method (Teboulle, 1997; Eckstein, 1993), accelerated proximal point method, and other variants (Güler, 1991, 1992; Parikh et al., 2014).

There is a related fine-tuning method – FreeLB (Zhu et al., 2020), which adapted a robust adversarial training method. However, our framework focuses on the local smoothness, leading to a significant performance improvement. More discussion and comparison are provided in Section 4.

The Proposed Method

We describe the proposed learning framework – SMART for robust and efficient fine-tuning of pre-trained language models. Our framework consists of two important ingredients: SMoothness-inducing Adversarial Regularization and BRegman pRoximal poinT opTimizationThe complete name of our proposed method is SMAR3T2, but we use SMART for notational simplicity..

We propose to impose an explicit regularization to effectively control the model complexity at the fine-tuning stage. Specifically, given the model f(;θ)f(\cdot;\theta) and nn data points of the target task denoted by {(xi,yi)}i=1n\{(x_{i},y_{i})\}_{i=1}^{n}, where xix_{i}’s denote the embedding of the input sentences obtained from the first embedding layer of the language model and yiy_{i}’s are the associated labels, our method essentially solves the following optimization for fine-tuning:

where L(θ)\mathcal{L}(\theta) is the loss function defined as

We remark that the proposed smoothness-inducing adversarial regularizer was first used in Miyato et al. (2018) for semi-supervised learning with p=2p=2, and then in Shu et al. (2018) for unsupervised domain adaptation with p=2p=2, and more recently in Zhang et al. (2019) for harnessing the adversarial examples in image classification with p=p=\infty. To the best of our knowledge, we are the first applying such a regularizer to fine-tuning of pre-trained language models.

Note that the idea of measuring the local Lipschitz continuity is similar to the local shift sensitivity criterion in existing literature on robust statistics, which dates back to 1960’s (Hampel, 1974; Huber, 2011). This criterion has been used to characterize the dependence of an estimator on the value of one of the sample points.

2 Bregman Proximal Point Optimization

We propose to develop a class of Bregman proximal point optimization methods to solve (1). Such optimization methods impose a strong penalty at each iteration to prevent the model from aggressive update. Specifically, we use a pre-trained model as the initialization denoted by f(;θ0)f(\cdot;\theta_{0}). At the (t+1)(t+1)-th iteration, the vanilla Bregman proximal point (VBPP) method takes

where μ>0\mu>0 is a tuning parameter, and DBreg(,)\mathcal{D}_{\rm Breg}(\cdot,\cdot) is the Bregman divergence defined as

Moreover, the Bregman proximal point method is capable of adapting to the information geometry (See more details in Raskutti and Mukherjee (2015)) of machine learning models and achieving better computational performance than the standard proximal point method (i.e., DBreg(θ,θt)=θθt22\mathcal{D}_{\rm Breg}(\theta,\theta_{t})=\left\lVert\theta-\theta_{t}\right\rVert_{2}^{2}) in many applications.

Acceleration by Momentum. Similar to other optimization methods in existing literature, we can accelerate the Bregman proximal point method by introducing an additional momentum to the update. Specifically, at the (t+1)(t+1)-th iteration, the momentum Bregman proximal point (MBPP) method takes

where θ~t=(1β)θt+βθ~t1\widetilde{\theta}_{t}=(1-\beta)\theta_{t}+\beta\widetilde{\theta}_{t-1} is the exponential moving average and β(0,1)\beta\in(0,1) is the momentum parameter. The MBPP method is also called the “Mean Teacher” method in existing literature (Tarvainen and Valpola, 2017) and has been shown to achieve state-of-the-art performance in popular semi-supervised learning benchmarks. For convenience, we summarize the MBPP method in Algorithm 1.

Experiment – Main Results

We demonstrate the effectiveness of SMART for fine-tuning large language models using GLUE Wang et al. (2018) by comparing with existing state-of-the-art methods. Dataset details can be found in Appendix 7.

Our implementation of SMART is based on BERThttps://github.com/huggingface/transformers (Wolf et al., 2019), RoBERTa https://github.com/pytorch/fairseq (Liu et al., 2019c), MT-DNN https://github.com/namisan/mt-dnn (Liu et al., 2020b) and HNNhttps://github.com/namisan/mt-dnn/tree/master/hnn. We used ADAM (Kingma and Ba, 2014) and RADAM (Liu et al., 2020a) as our optimizers with a learning rate in the range {1×105,2×105,3×105,5×105}\in\{1\times 10^{-5},2\times 10^{-5},3\times 10^{-5},5\times 10^{-5}\} and a batch size {16,32,64}\in\{16,32,64\}. The maximum number of epochs was set to 66. A linear learning rate decay schedule with warm-up of 0.10.1 was used, unless stated otherwise. We also set the dropout rate of all the task specific layers as 0.10.1, except 0.30.3 for MNLI and 0.050.05 for CoLA. To avoid gradient exploding, we clipped the gradient norm within 11. All the texts were tokenized using wordpieces and were chopped to spans no longer than 512512 tokens. For SMART, we set the perturbation size ϵ=105\epsilon=10^{-5} and σ=105\sigma=10^{-5}. We set μ=1\mu=1 and λs{1,3,5}\lambda_{s}\in\{1,3,5\}. The learning rate η\eta in Algorithm 1 is set to 10310^{-3}. We set β\beta = 0.99 for the first 10%10\% of the updates (t0.1Tt\leq 0.1T) and β=0.999\beta=0.999 for the rest of the updates (t>0.1Tt>0.1T) following Tarvainen and Valpola (2017). Lastly, we simply set S=1,Tx~=1S=1,T_{\widetilde{x}}=1 in Algorithm 1.

2 GLUE Main Results

We compare SMART with a range of strong baselines including large pre-trained models and approaches with adversarial training, and a list of state-of-the-art models that have been submitted to the GLUE leaderboard. SMART is a generic framework, we evaluate our framework on two pre-trained models, the BERTBASE model (Devlin et al., 2019) and the RoBERTaLARGE model (Liu et al., 2019c), which are available publicly. Most of our analyses are done with the BERTBASE to make our results comparable to other work, since BERTBASE has been widely used as a baseline. To make our result comparable to other state-of-the-art models, we also evaluate the framework on the RoBERTaLARGE model.

\bullet BERT (Devlin et al., 2019): This is the BERTBASE model released by the authors. In Devlin et al. (2019), authors only reported the development results on a few tasks, thus we reproduced the baseline results, which are denoted by BERTReImp.

\bullet RoBERTa (Liu et al., 2019c): This is the RoBERTaLARGE released by authors, and we present the reported results on the GLUE dev.

\bullet PGD, FreeAT, FreeLB (Zhu et al., 2020): They are three adversarial training approaches built on top of the RoBERTaLARGE.

\bullet SMART: our proposed method as described in section 3. We use both the BERTBASE model (SMARTBERT) and the RoBERTaLARGE model (SMARTRoBERTa) as the pretrained model to evaluate the effectiveness of SMART.

The main results are reported in Table 1. This table can be clustered into two groups based on different pretrained models: the BERTBASE model (the first group) and the RoBERTaLARGE model (the second group). The detailed discussions are as follows.

For a fair comparison, we reproduced the BERT baseline (BERTReImp), since several results on the GLUE development set were missed. Our reimplemented BERT baseline is even stronger than the originally reported results in Devlin et al. (2019). For instance, the reimplemented model obtains 84.5% (vs. 84.4%) on MNLI in-domain development in terms of accuracy. On SST-2, BERTReImp outperforms BERT by 0.2% (92.9% vs. 92.7%) accuracy. All these results demonstrate the fairness of our baselines.

Comparing with two strong baselines BERT and RoBERTa In our experiments, we use BERT referring the BERTBASE model, which has 110 million parameters, and RoBERTa referring the RoBERTaLARGE model, which has 356 million parameters, unless stated otherwise., SMART, including SMARTBERT and SMARTRoBERTa, consistently outperforms them across all 8 GLUE tasks by a big margin. Comparing with BERT, SMARTBERT obtained 85.6% (vs. 84.5%) and 86.0% (vs. 84.4%) in terms of accuracy, which is 1.1% and 1.6% absolute improvement, on the MNLI in-domain and out-domain settings. Even comparing with the state-of-the-art model RoBERTa, SMARTRoBERTa improves 0.8% (91.1% vs. 90.2%) on MNLI in-domain development set. Interestingly, on the MNLI task, the performance of SMART on the out-domain setting is better than the in-domain setting, e.g., (86.0% vs. 85.6%) by SMARTBERT and (91.3% vs. 91.1%) by SMARTRoBERTa, showing that our proposed approach alleviates the domain shifting issue. Furthermore, on the small tasks, the improvement of SMART is even larger. For example, comparing with BERT, SMARTBERT obtains 71.2% (vs. 63.5%) on RTE and 59.1% (vs. 54.7%) on CoLA in terms of accuracy, which are 7.7% and 4.4% absolute improvement for RTE and CoLA, respectively; similarly, SMARTRoBERTa outperforms RoBERTa 5.4% (92.0% vs. 86.6%) on RTE and 2.6% (70.6% vs. 68.0%) on CoLA.

We also compare SMART with a range of models which used adversarial training such as FreeLB. From the bottom rows in Table 1, SMART outperforms PGD and FreeAT across the all 8 GLUE tasks. Comparing with the current state-of-the-art adversarial training model, FreeLB, SMART outperforms it on 6 GLUE tasks out of a total of 8 tasks (MNLI, RTE, QNLI, MRPC, SST-2 and STS-B) showing the effectiveness of our model.

Table 2 summarizes the current state-of-the-art models on the GLUE leaderboard. SMART obtains a competitive result comparing with T5 (Raffel et al., 2019), which is the leading model at the GLUE leaderboard. T5 has 11 billion parameters, while SMART only has 356 millions. Among this super large model (T5) and other ensemble models (e.g., ALBERT, ALICE), SMART, which is a single model, still sets new state-of-the-art results on SST-2, MRPC and STS-B. By combining with the Multi-task Learning framework (MT-DNN), MT-DNN-SMART obtains new state-of-the-art on GLUE, pushing the GLUE benchmark to 89.9%. More discussion will be provided in Section 5.3.

Experiment – Analysis and Extension

In this section, we first analyze the effectiveness of each component of the proposed method. We also study that whether the proposed method is complimentary to multi-task learning. We further extend SMART to domain adaptation and use both SNLI (Bowman et al., 2015) and SciTail (Khot et al., 2018) to evaluate the effectiveness. Finally, we verified the robustness of the proposed method on ANLI (Nie et al., 2019).

Note that due to the limitation of time and computational resources, all the experiments reported below are based on the BERTBASE model. In this section, we study the importance of each component of SMART: smoothness-inducing adversarial regularization and Bregman proximal point optimization. All models in this study used the BERTBASE as the encoder for fast training. Furthermore, we also include the BERTBASE model as an additional baseline for a fair comparison. SMART denotes the proposed model. Then we set λs\lambda_{s} to 0, which denotes as -Rs\mathcal{R}_{\rm s}. The model with μ=0\mu=0 is noted as -DBreg\mathcal{D}_{\rm Breg}.

The results are reported in Table 3. It is expected that the removal of either component (smooth regularization or proximal point method) in SMART would result in a performance drop. For example, on MNLI, removing smooth regularization leads to a 0.8% (85.6% vs. 84.8) performance drop, while removing the Breg proximal point optimization, results in a performance drop of 0.2% (85.6% vs. 85.4%). It demonstrates that these two components complement each other. Interestingly, all three proposed models outperform the BERT baseline model demonstrating the effectiveness of each module. Moreover, we obersere that the generalization performance benefits more from SMART on small datasets (i.e., RTE and MRPC) by preventing overfitting.

2 Error Analysis

To understand why SMART improves the performance, we analyze it on the ambiguous samples of MNLI dev set containing 3 classes, where each sample has 5 annotations. Based on the degree of agreement between these annotations, we divide the samples into 4 categories: 1) 5/0/0 all five annotations are the same; 2) 4/1/0 four annotations are the same; 3) 3/2/0 three annotations are the same and the other two annotations are the same; 4) 3/1/1 three annotations are the same and the other two annotations are different.

Figure 2 summarizes the results in terms of both accuracy and KL-divergence:

For a given sample xix_{i}, the KL-Divergence evaluates the similarity between the model prediction {fj(xi)}j=13\{f_{j}(x_{i})\}_{j=1}^{3} and the annotation distribution {pj(xi)}j=13\{p_{j}(x_{i})\}_{j=1}^{3}. We observe that SMARTRoBERTa outperforms RoBERTa across all the settings. Further, on high degree of ambiguity (low degree of agreement), SMARTRoBERTa obtains an even larger improvement showing its robustness to ambiguity.

3 SMART with Multi-task Learning

It has been shown that multi-task learning (MTL, Caruana (1997); Liu et al. (2015, 2019b)) has a regularization effect via alleviating overfitting to a specific task. One question is whether MTL helps SMART as well. In this section, we are going to answer this question. Following Liu et al. (2019b), we first “pre-trained” shared embeddings using MTL with SMART, denoted as MT-DNN-SMART Due to limitation of computational resources, we only trained jointly using MTL on MNLI, RTE, QNLI, SST and MRPC, while MT-DNN was trained on the whole GLUE tasks except CoLA. , and then adapted the training data on each task on top of the shared embeddings. We also include a baseline which fine-tuned each task on the publicly released MT-DNN checkpoint It is from: https://github.com/namisan/mt-dnn. Note that we did not use the complicated answer module, e.g., SAN (Liu et al., 2018)., which is indicated as MT-DNN-SMARTv0.

We observe that both MT-DNN and SMART consistently outperform the BERT model on all five GLUE tasks. Furthermore, SMART outperforms MT-DNN on MNLI, QNLI, and MRPC, while it obtains worse results on RTE and SST, showing that MT-DNN is a strong counterpart for SMART. By combining these two models, MT-DNN-SMARTv0 enjoys advantages of both and thus improved the final results. For example, it achieves 85.7% (+0.1%) on MNLI and 80.2% (+1.1%) on RTE comparing with the best results of MT-DNN and SMART demonstrating that these two techniques are orthogonal. Lastly we also trained SMART jointly and then finetuned on each task like Liu et al. (2019b). We observe that MT-DNN-SMART outperformes MT-DNN-SMARTv0 and MT-DNN across all 5 tasks (except MT-DNN on SST) showing that SMART improves the generalization of MTL.

4 Domain Adaptation

In this section, we evaluate our model on the domain adaptation setting. Following Liu et al. (2019b), we start with the default training/dev/test set of SNLI and SciTail. Then, we randomly sample 0.1%, 1%, 10% and 100% of its training data, which is used to train a model.

The results are reported in Table 5. We observe that both MT-DNN and MT-DNN-SMART significantly outperform the BERT baseline. Comparing with MT-DNN, MT-DNN-SMART also achieves some improvements indicating the robustness of SMART. Furthermore, MT-DNN-SMART outperforms current state-of-the-art on the SNLI/SciTail test.

5 Results on SNLI and SciTail

In Table 7, we compare our methods, using all in-domain training data, against several state-of-the-art models. We observe that SMART obtains the same improvement on SNLI in the BERT setting. Combining SMART with MT-DNN achieves a significant improvement, e.g., our BASE model even outperforms the BERTLARGE model. Similar observation is found on SciTail and in the BERTLARGE model setting. We see that incorporating SMART into MT-DNN achieves new state-of-the-art results on both SNLI and SciTail, pushing benchmarks to 91.7% on SNLI and 95.2% on SciTail.

6 Robustness

One important property of the machine learning model is its robustness to adversarial attack. We test our model on an adversarial natural language inference (ANLI) dataset Nie et al. (2019).

We evaluate the performance of SMART on each subset (i.e., R1,R2,R3) of ANLI dev and test set. The results are presented in Table 6. Table 6 shows the results of training on combined NLI data: ANLI (Nie et al., 2019) + MNLI (Williams et al., 2018) + SNLI Bowman et al. (2015) + FEVER (Thorne et al., 2018) and training on only ANLI data. In the combined data setting, we obverse that SMARTRoBERTa-LARGE obtains the best performance compared with all the strong baselines, pushing benchmarks to 57.1%. In case of the RoBERTaLARGE baseline, SMARTRoBERTa-LARGE outperforms 3.4% absolute improvement on dev and 7.4% absolute improvement on test, indicating the robustness of SMART. We obverse that in the ANLI-only setting, SMARTRoBERTa-LARGE outperforms the strong RoBERTaLARGE baseline with a large margin, +5.2% (57.1% vs. 51.9%)

Conclusion

We propose a robust and efficient computation framework, SMART, for fine-tuning large scale pre-trained natural language models in a principled manner. The framework effectively alleviates the overfitting and aggressive updating issues in the fine-tuning stage. SMART includes two important ingredients: 1) smooth-inducing adversarial regularization; 2) Bregman proximal point optimization. Our empirical results suggest that SMART improves the performance on many NLP benchmarks (e.g., GLUE, SNLI, SciTail, ANLI) with the state-of-the-art pre-trained models (e.g., BERT, MT-DNN, RoBERTa). We also demonstrate that the proposed framework is applicable to domain adaptation and results in a significant performance improvement. Our proposed fine-tuning framework can be generalized to solve other transfer learning problems. We will explore this direction as future work.

Acknowledgments

We thank Jade Huang, Niao He, Chris Meek, Liyuan Liu, Yangfeng Ji, Pengchuan Zhang, Oleksandr Polozov, Chenguang Zhu and Keivn Duh for valuable discussions and comments, and Microsoft Research Technology Engineering team for setting up GPU machines. We also thank the anonymous reviewers for valuable discussions.

References

Datasets

The GLUE benchmark, SNLI, SciTail and ANLI is briefly introduced in the following sections. The detailed description can be found in Wang et al. (2018); Bowman et al. (2015); Khot et al. (2018); Nie et al. (2019). Table 8 summarizes the information of these tasks.

\bullet GLUE. The General Language Understanding Evaluation (GLUE) benchmark is a collection of nine natural language understanding (NLU) tasks. As shown in Table 8, it includes question answering Rajpurkar et al. (2016), linguistic acceptability Warstadt et al. (2019), sentiment analysis Socher et al. (2013), text similarity Cer et al. (2017), paraphrase detection Dolan and Brockett (2005), and natural language inference (NLI) Dagan et al. (2006); Bar-Haim et al. (2006); Giampiccolo et al. (2007); Bentivogli et al. (2009); Levesque et al. (2012); Williams et al. (2018). The diversity of the tasks makes GLUE very suitable for evaluating the generalization and robustness of NLU models.

\bullet SNLI. The Stanford Natural Language Inference (SNLI) dataset contains 570k human annotated sentence pairs, in which the premises are drawn from the captions of the Flickr30 corpus and hypotheses are manually annotated Bowman et al. (2015). This is the most widely used entailment dataset for NLI. The dataset is used only for domain adaptation in this study.

\bullet SciTail This is a textual entailment dataset derived from a science question answering (SciQ) dataset Khot et al. (2018). The task involves assessing whether a given premise entails a given hypothesis. In contrast to other entailment datasets mentioned previously, the hypotheses in SciTail are created from science questions while the corresponding answer candidates and premises come from relevant web sentences retrieved from a large corpus. As a result, these sentences are linguistically challenging and the lexical similarity of premise and hypothesis is often high, thus making SciTail particularly difficult. The dataset is used only for domain adaptation in this study.

\bullet ANLI. The Adversarial Natural Language Inference (ANLI, Nie et al. (2019)) is a new large-scale NLI benchmark dataset, collected via an iterative, adversarial human-and-model-in-the-loop procedure. Particular, the data is selected to be difficult to the state-of-the-art models, including BERT and RoBERTa.

Hyperparameters

As for the sensitivities of hyper-parameters, in general the performance of our method is not very sensitive to the choice of hyper-parameters as detailed below.

We only observed slight differences in model performance when λs\lambda_{s}\in, μ\mu\in and ϵ[105,104]\epsilon\in[10^{-5},10^{-4}]. When λs100\lambda_{s}\geq 100, μ100\mu\geq 100 or ϵ103\epsilon\geq 10^{-3}, the regularization is unreasonably strong. When λs0.1\lambda_{s}\leq 0.1, μ0.1\mu\leq 0.1 or ϵ<=106\epsilon<=10^{-6}, the regularization is unreasonably weak.

The algorithm is not sensitive to σ\sigma, any σϵ\sigma\leq\epsilon works well.

p=p=\infty makes the size of perturbation constraint to be the same regardless of the number of dimensions. For p=2p=2, adversarial perturbation is sensitive to the number of dimensions (A higher dimension usually requires a larger perturbation), especially for sentences with different length. As a result, we need to make less tuning effort for p=p=\infty. For other values of pp, the associated projections are computationally inefficient.

We observed a minor improvement by using a larger SS or a larger Tx~T_{\widetilde{x}}. The minor improvement comes with an increased cost of computation. When S=Tx~=1S=T_{\widetilde{x}}=1, SMART requires 3 more forward passes and 3 more backward passes per iteration, compared with direct fine-tuning. In practice, it takes about 3 times the original training time. In terms of memory usage, it approximately doubles the GPU memory usage.

We set β=0.99\beta=0.99 for the first 10%10\% of the updates (t<=0.1Tt<=0.1T) and β=0.999\beta=0.999 for the rest of the updates (t>0.1Tt>0.1T) following (Tarvainen and Valpola, 2017), which works well in practice.