Linguistically-Informed Transformations ( LIT ): A Method for Automatically Generating Contrast Sets (2020)

Abstract: Although large-scale pretrained language models, such as BERT and RoBERTa, have achieved superhuman performance on in-distribution test sets, their performance suffers on out-of-distribution test sets (e.g., on contrast sets). Building contrast sets often requires human-expert annotation, which is expensive and hard to create on a large scale. In this work, we propose a Linguistically-Informed Transformation (LIT) method to automatically generate contrast sets, which enables practitioners to explore linguistic phenomena of interests as well as compose different phenomena. Experimenting with our method on SNLI and MNLI shows that current pretrained language models, although being claimed to contain sufficient linguistic knowledge, struggle on our automatically generated contrast sets. Furthermore, we improve models’ performance on the contrast sets by applying LIT to augment the training data, without affecting performance on the original data.

## introduction large-scale pretrained language models have given remarkable improvements to a wide range of nlp tasks @xcite @xcite @xcite . however, the results are questionable, since those models take advantage of lexical cues (and other heuristics) in the datasets, which can make them right for wrong reasons @xcite . therefore, the concept of evaluating models on contrast sets @xcite and the creation of generalization tests @xcite is critical for building a robust nlp system. those test sets are usually figure 1 : example of bert making wrong prediction on lit-transformed data but correct prediction on the original datum. the detailed transformed datum includes a premise modified to past tense and a hypothesis with future tense. the true label correspondingly changes to neutral. lit also generates multiple transformation results at once for a single original datum; we include only one detailed example here for simplicity of the illustration. manually created, which requires significant human effort, and so is hard to do on a large scale. in this work, we propose linguistically-informed transformations (lit) to create contrast sets automatically. our method can perturb the original examples and generate various types of contrastive examples, with a wide choice of linguistic phenomena. furthermore, our tool supports compositional generalization tests. namely, researchers can choose transformations from a set of basic linguistic phenomena and modify original sentences with an arbitrary combination of those basic transformations. to demonstrate the utility of lit, we focus on the natural language inference (nli) task, a central task to many nlp applications. we apply lit to generate contrast sets for snli @xcite and mnli @xcite using seven linguistic phenomena. human experts' rating show that our generated data is high-quality for basic transformations and for most of the compositional transformations. see appendix b for more details. with our generated contrast sets, we show that pretrained language models, despite having 'seen' huge quantities of raw text data, fail on simple linguistic perturbations. as shown with an example in figure 1 , 'decoupling' tenses of the premise and hypothesis breaks bert's prediction. our analysis not only shows the inadequate coverage of snli and mnli datasets but also reveals the deficiency of current pretraining-and-finetuning paradigms. compared to previous work showing that bert is not robust and fails to generalize on out-of-distribution test sets @xcite @xcite , our method provides a more fine-grained picture showing on which phenomenon the models fail. in summary, our contributions are: after discussing several areas of related work in section 2, we describe lit in step-by-step detail (section 3). we then apply lit to snli and mnli (4.1) before evaluating bert and roberta on both simple (4.2) and compositional (4.4) transformations. we conclude (section 5) by discussing limitations of lit and future directions. contrast sets contrast sets @xcite serve to evaluate a models' true capabilities by evaluating on out-of-distribution data since previous in-distribution test sets often have systematic gaps, which inflate models' performance on a task @xcite . the idea of contrast sets is to modify a test instance to a minimum degree while preserving the original instance's syntactic/semantic artifacts and changing the label. typically, the authors of the dataset create the contrast set manually. we show that a precision grammar, namely erg @xcite , can be used to automate this process while preserving the authors' benefit of choosing the perturbations of interest. ## generating contrast sets we propose a new linguistically-informed transformation (lit) method for large-scale automatic generation of contrast sets. lit 1) parses the input sentence for both syntax and semantics, 2) produces transformed syntax and semantics for each linguistic phenomenon, 3) generates perturbed sentences corresponding to the transformed syntax/semantics, 4) and selects the best surface sentence for each phenomenon. the full pipeline is shown in figure 2 . note that we expand the definition of figure 2 : general pipeline of lit system exemplified with one input sentence. the parse result includes both syntax and semantics. the transformation rules produce one transformed representation per phenomenon. a set of sentences, all grammatical according to erg, is generated for each transformed representation. one sentence per phenomenon is selected as the final output sentence. we include two "rule"s for illustration purpose; lit includes more transformation rules and can be extended for more phenomena. lit contains seven phenomenon-specific transformation rules for modifying the parse results and can be further extended; lit also allows the composition of different transformation rules for complicated perturbations involving multiple linguistic phenomena. ## experiments using lit, we evaluate whether large pretrained models 'understand' certain linguistic phenomena through testing them on transformed snli and mnli instances. specifically, we investigate whether bert and roberta can successfully predict transformed instances on modality (may), tenses (past; future), passivization, it cleft, and their compositions correctly and consistently. in the following section, we first discuss how we set up our tasks, and then we present our results on simple transformations and composed transformations, respectively. ## discussion and analysis with lit, we reveal that current high-performance nli models still suffer from understanding simple linguistic phenomena. they can be trained to un-derstand these phenomena in a way that appears systematic. in the remainder, we discuss the limitations of lit, applying lit to investigate the systematic deficiency of current large-scale datasets, and potential applications of lit to tasks other than nli. ## conclusion we propose linguistically-informed transformations (lit), a general method to generate contrast sets using an existing linguistic resource. we apply lit to transform nli datasets and evaluate current state-of-the-art nli models. we reveal the systematic gap between current nli models and an ideal nli model for nlp practice, which comes from the inadequate coverage of the linguistic phenomenon of snli and mnli. we further show that models can be further improved by using lit to augment the training data. furthermore, models fine-tuned on simple transformations perform very well on compositional transformations, suggesting that fine-tuning provides some systematic understanding of these phenomena.