Syntactic Data Augmentation Increases Robustness to Inference Heuristics (2020)

Abstract: Pretrained neural models such as BERT, when fine-tuned to perform natural language inference (NLI), often show high accuracy on standard datasets, but display a surprising lack of sensitivity to word order on controlled challenge sets. We hypothesize that this issue is not primarily caused by the pretrained model’s limitations, but rather by the paucity of crowdsourced NLI examples that might convey the importance of syntactic structure at the fine-tuning stage. We explore several methods to augment standard training sets with syntactically informative examples, generated by applying syntactic transformations to sentences from the MNLI corpus. The best-performing augmentation method, subject/object inversion, improved BERT’s accuracy on controlled examples that diagnose sensitivity to word order from 0.28 to 0.73, without affecting performance on the MNLI test set. This improvement generalized beyond the particular construction used for data augmentation, suggesting that augmentation causes BERT to recruit abstract syntactic representations.

## introduction in the supervised learning paradigm common in nlp, a large collection of labeled examples of a particular classification task is randomly split into a training set and a test set. the system is trained on this training set, and is then evaluated on the test set. neural networks-in particular systems pretrained on a word prediction objective, such as elmo @xcite or bert @xcite -excel in this paradigm: with large enough pretraining corpora, these models match or even exceed the accuracy of untrained human annotators on many test sets @xcite . at the same time, there is mounting evidence that high accuracy on a test set drawn from the same distribution as the training set does not indicate that the model has mastered the task. this discrepancy can manifest as a sharp drop in accuracy when the model is applied to a different dataset that illustrates the same task @xcite , or as excessive sensitivity to linguistically irrelevant perturbations of the input @xcite . one such discrepancy, where strong performance on a standard test set did not correspond to mastery of the task as a human would define it, was documented by @xcite for the natural language inference (nli) task. in this task, the system is given two sentences, and is expected to determine whether one (the premise) entails the other (the hypothesis). most if not all humans would agree that nli requires sensitivity to syntactic structure; for example, the following sentences do not entail each other, even though they contain the same words: the lawyer saw the actor. mccoy et al. constructed the hans challenge set, which includes examples of a range of such constructions, and used it to show that, when bert is fine-tuned on the mnli corpus @xcite , the fine-tuned model achieves high accuracy on the test set drawn from that corpus, yet displays little sensitivity to syntax; the model wrongly concluded, for example, that (1) entails (2). we consider two explanations as to why bert fine-tuned on mnli fails on hans. under the representational inadequacy hypothesis, bert fails on hans because its pretrained representations are missing some necessary syntactic information. under the missed connection hypothesis, bert extracts the relevant syntactic information from the input (cf. goldberg 2019; @xcite , but it fails to use this information with hans because there are few mnli training examples that indicate how syntax should support nli @xcite . it is possible for both hypotheses to be correct: there may be some aspects of syntax that bert has not learned at all, and other aspects that have been learned, but are not applied to perform inference. the missed connection hypothesis predicts that augmenting the training set with a small number of examples from one syntactic construction would teach bert that the task requires it to use its syntactic representations. this would not only cause improvements on the construction used for augmentation, but would also lead to generalization to other constructions. in contrast, the representational inadequacy hypothesis predicts that to perform better on hans, bert must be taught how each syntactic construction affects nli from scratch. this predicts that larger augmentation sets will be required for adequate performance and that there will be little generalization across constructions. this paper aims to test these hypotheses. we constructed augmentation sets by applying syntactic transformations to a small number of examples from mnli. accuracy on syntactically challenging cases improved dramatically as a result of augmenting mnli with only about 400 examples in which the subject and the object were swapped (about 0.1% of the size of the mnli training set). crucially, even though only a single transformation was used in augmentation, accuracy increased on a range of constructions. for example, bert's accuracy on examples involving relative clauses (e.g, the actors called the banker who the tourists saw the banker called the tourists) was 0.33 without augmentation, and 0.83 with it. this suggests that our method does not overfit to one construction, but taps into bert's existing syntactic representations, providing support for the missed connection hypothesis. at the same time, we also observe limits to generalization, supporting the representational inadequacy hypothesis in those cases. ## background hans is a template-generated challenge set designed to test whether nli models have adopted three syntactic heuristics. first, the lexical overlap heuristic is the assumption that any time all of the words in the hypothesis are also in the premise, the label should be entailment. in the mnli training set, this heuristic often makes correct predictions, and almost never makes incorrect predictions. this may be due to the process by which mnli was generated: crowdworkers were given a premise and were asked to generate a sentence that contradicts or entails the premise. to minimize effort, workers may have overused lexical overlap as a shortcut to generating entailed hypotheses. of course, the lexical overlap heuristic is not a generally valid inference strategy, and it fails on many hans examples; e.g., as discussed above, the lawyer saw the actor does not entail the actor saw the lawyer. hans also includes cases that are diagnostic of the subsequence heuristic (assume that a premise entails any hypothesis which is a contiguous subsequence of it) and the constituent heuristic (assume that a premise entails all of its constituents). while we focus on counteracting the lexical overlap heuristic, we will also test for generalization to the other heuristics, which can be seen as particularly challenging cases of lexical overlap. examples of all constructions used to diagnose the three heuristics are given in tables a.5, a.6 and a.7. data augmentation is often employed to increase robustness in vision @xcite and language @xcite , including in nli @xcite . in many cases, augmentation with one kind of example improves accuracy on that particular case, but does not generalize to other cases, suggesting that models overfit to the augmentation set @xcite @xcite . in particular, @xcite found that augmentation with hans examples generalized to a different word overlap challenge set @xcite , but only for examples similar in length to hans examples. we mitigate such overfitting to superficial properties by generating a diverse set of corpus-based examples, which differ from the challenge set both lexically and syntactically. finally, @xcite used a similar augmentation approach to ours but did not study generalization to types of examples not in the augmentation set. ## generating augmentation data we generate augmentation examples from mnli using two syntactic transformations: inversion, which swaps the subject and object of the source sentence, and passivization. for each of these transformations, we had two families of augmenta-original mnli example: there are 16 el grecos in this small collection. → this small collection contains 16 el grecos. ## experimental setup we added each augmentation set separately to the mnli training set, and fine-tuned bert on each resulting training set. further fine-tuning details are in appendix a.1. we repeated this process for five random seeds for each combination of augmentation strategy and augmentation set size, except for the most successful strategy (inversion + trans-formed hypothesis), for which we had 15 runs for each augmentation size. following @xcite , when evaluating on hans, we merged the neutral and contradiction labels produced by the model into a single non-entailment label. for both original premise and trans-formed hypothesis, we experimented with using each of the transformations separately, and with a combined dataset including both inversion and passivization. we also ran separate experiments with only the passivization examples with an entailment label, and with only the passivization examples with a non-entailment label. as a baseline, we used 100 runs of bert fine-tuned on the unaugmented mnli @xcite . we report the models' accuracy on hans, as well as on the mnli development set (mnli test set labels are not publicly available). we did not tune any parameters on this development set. all of the comparisons we discuss below are significant at the @xmath0.01 level (based on two-sided t-tests). ## results accuracy on mnli was very similar across augmentation strategies and matched that of the unaugmented baseline (0.84), suggesting that syntactic augmentation with up to 1215 examples does not harm overall performance on the dataset. by contrast, accuracy on hans varied significantly, with most models performing worse than chance (which is 0.50 on hans) on non-entailment examples, suggesting that they adopted the heuristics (figure 1 ). the most effective augmentation strategy, by a large margin, was inversion with a transformed hypothesis. accuracy on the hans word overlap cases for which the correct label is non-entailmente.g., the doctor saw the lawyer the lawyer saw the doctor-was 0.28 without augmentation, and 0.73 with the large version of this augmentation set. simultaneously, this strategy decreased bert's accuracy on the cases where the heuristic makes the correct prediction (the tourists by the actor called the @xmath1; in the lexical overlap heuristic makes... the random shuffling method did not improve over the unaugmented baseline, suggesting that syntactically-informed transformations are essential (table a .2). passivization yielded a much smaller benefit than inversion, perhaps due to the presence of overt markers such as the word by, which may lead the model to attend to word order only when those are present. intriguingly, even on the passive examples in hans, inversion was more effective than passivization (large inversion augmentation: 0.13; large passivization augmentation: 0.01). finally, inversion on its own was more effective than the combination of inversion and passivization. we now analyze in more detail the most effective strategy, inversion with a transformed hypothesis. first, this strategy is similar on an abstract level to the hans subject/object swap category, but the two differ in vocabulary and some syntactic properties; despite these differences, performance on this hans category was perfect (1.00) with medium and large augmentation, indicating that bert benefited from the high-level syntactic structure of the transformation. for the small augmentation set, accuracy on this category was 0.53, suggesting that 101 examples are insufficient to teach bert that subjects and objects cannot be freely swapped. conversely, tripling the augmentation size from medium to large had a moderate and inconsistent effect across hans subcases (see appendix a.3 for case-by-case results); for clearer insight about the role of augmentation size, it may be necessary to sample this parameter more densely. although inversion was the only transformation in this augmentation set, performance also improved dramatically on constructions other than subject/object swap (figure 2 ); for example, the models handled examples involving a prepositional phrase better, concluding, for instance, that the judge behind the manager saw the doctors does not entail the doctors saw the manager (unaugmented: 0.41; large augmentation: 0.89). there was a much more moderate, but still significant, improvement on the cases targeting the subsequence heuristic; this smaller degree of improvement suggests that contiguous subsequences are treated separately from lexical overlap more generally. one exception was accuracy on "np/s" inferences, such as the managers heard the secretary resigned the managers heard the secretary, which improved dramatically from 0.02 (unaugmented) to 0.50 (large augmentation). further improvements for subsequence cases may therefore require augmentation with examples involving subsequences. a range of techniques have been proposed over the past year for improving performance on hans. these include syntax-aware models @xcite , auxiliary models designed to capture pre-defined shallow heuristics so that the main model can focus on robust strategies ## discussion our best-performing strategy involved augmenting the mnli training set with a small number of instances generated by applying the subject/object inversion transformation to mnli examples. this yielded considerable generalization: both to another domain (the hans challenge set), and, more importantly, to additional constructions, such as relative clauses and prepositional phrases. this supports the missed connection hypothesis: a small amount of augmentation with one construction induced abstract syntactic sensitivity, instead of just "inoculating" the model against failing on the challenge set by providing it with a sample of cases from the same distribution @xcite . at the same time, the inversion transformation did not completely counteract the heuristic; in particular, the models showed poor performance on passive sentences. for these constructions, then, bert's pretraining may not yield strong syntactic representations that can be tapped into with a small nudge from augmentation; in other words, this may be a case where our representational inadequacy hypothesis holds. this hypothesis predicts that pretrained bert, as a word prediction model, struggles with passives, and may need to learn the properties of this construction specifically for the nli task; this would likely require a much larger number of augmentation examples. the best-performing augmentation strategy involved generating premise/hypothesis pairs from a single source sentence-meaning that this strategy does not rely on an nli corpus. the fact that we can generate augmentation examples from any corpus makes it possible to test if very large augmentation sets are effective (with the caveat, of course, that augmentation sentences from a different domain may hurt performance on mnli itself). ultimately, it would be desirable to have a model with a strong inductive bias for using syntax across language understanding tasks, even when overlap heuristics lead to high accuracy on the training set; indeed, it is hard to imagine that a human would ignore syntax entirely when understanding a sentence. an alternative would be to create training sets that adequately represent a diverse range of linguistic phenomena; crowdworkers' (rational) preferences for using the simplest generation strategies possible could be counteracted by approaches such as adversarial filtering @xcite . in the interim, however, we conclude that data augmentation is a simple and effective strategy to mitigate known inference heuristics in models such as bert.