Undersensitivity in Neural Reading Comprehension (2020)

Abstract: Current reading comprehension methods generalise well to in-distribution test sets, yet perform poorly on adversarially selected data. Prior work on adversarial inputs typically studies model oversensitivity: semantically invariant text perturbations that cause a model’s prediction to change. Here we focus on the complementary problem: excessive prediction undersensitivity, where input text is meaningfully changed but the model’s prediction does not, even though it should. We formulate an adversarial attack which searches among semantic variations of the question for which a model erroneously predicts the same answer, and with even higher probability. We demonstrate that models trained on both SQuAD2.0 and NewsQA are vulnerable to this attack, and then investigate data augmentation and adversarial training as defences. Both substantially decrease adversarial vulnerability, which generalises to held-out data and held-out attack spaces. Addressing undersensitivity furthermore improves model robustness on the previously introduced ADDSENT and ADDONESENT datasets, and models generalise better when facing train / evaluation distribution mismatch: they are less prone to overly rely on shallow predictive cues present only in the training set, and outperform a conventional model by as much as 10.9% F1.

## introduction neural networks can be vulnerable to adversarial input perturbations @xcite . in natural language processing (nlp), which operates on discrete symbol sequences, adversarial attacks can take a variety of forms @xcite including character perturbations @xcite , semantically invariant reformulations @xcite orspecifically in reading comprehension (rc) -adversarial text insertions @xcite . a model's inability to handle adversarially chosen input text puts into perspective otherwise impressive generalisation results for in-distribution test sets @xcite ; @xcite ; @xcite ; inter alia) and constitutes an important caveat to conclusions drawn regarding a model's comprehension abilities. while semantically invariant text transformations can remarkably alter a model's predictions, the complementary problem of model undersensitivity is equally troublesome: a model's text input can often be drastically changed in meaning while retaining the original prediction. in particular, previous works @xcite @xcite show that even after deletion of all but a small fraction of input words, models often produce the same output. however, such reduced inputs are usually unnatural to a human reader, and it is both unclear what behaviour we should expect from natural language models evaluated on unnatural text, and how to use such unnatural inputs to improve models. in this work we explore rc model undersensitivity for natural language questions, and we show that addressing undersensitivity not only makes rc models more sensitive where they should be, but also less reliant on shallow predictive cues. fig. 1 shows an example for a bert large model @xcite trained on squad2.0 @xcite that is given a text and a comprehension question, i.e. what was fort caroline renamed to after the spanish attack? which it correctly answers as san mateo with 98% probability. altering this question, however, can increase model probability for this same prediction to 99%, although the new question is unanswerable given the same con- we formalise the process of finding such questions as an adversarial search in a discrete space arising from perturbations of the original question. there are two types of discrete perturbations we consider, based on part-of-speech tags and named entities, with the aim of obtaining grammatical and semantically consistent alternative questions that do not accidentally have the same correct answer. we find that squad2.0 and newsqa models can be attacked on a substantial proportion of samples. the observed undersensitivity correlates negatively with in-distribution test set performance metrics (em/f 1 ), suggesting that this phenomenonwhere present -is indeed a reflection of a model's lack of question comprehension. when training models to defend against undersensitivity attacks with data augmentation and adversarial training, we observe that they can generalise their robustness to held out evaluation data without sacrificing in-distribution test set performance. furthermore, the models improve on the adversarial datasets proposed by @xcite , and behave more robustly in a learning scenario that has dataset bias with a train / evaluation distribution mismatch, increasing performance by up to 10.9%f 1 . ## experiments: model vulnerability training and dataset details we next conduct experiments using the attacks laid out above to investigate model undersensitivity. we attack the bert model fine-tuned on squad2.0, and measure to what extent the model exhibits undersensitivity to adversarially chosen inputs. our choice of bert is motivated by the currently widespread adoption of its variants across the nlp field, and empirical success across a wide range of datasets. squad2.0 per design contains unanswerable questions; models are thus trained to predict a noanswer option where a comprehension question cannot be answered. as the test set is unavailable, we split off 5% from the original training set for development purposes and retain the remaining 95% for training, stratified by articles. the original squad2.0 development set is then used as evaluation data, where the model reaches 73.0%em and 76.5%f 1 ; we will compute the undersensitivity attacks on this entirely held out part of the dataset. appendix b provides further training details. attack details to compute the perturbation spaces, we gather large collections of ne and pos expressions across types that define the perturbation spaces t e and t p , which we gather from the wikipedia paragraphs used in the squad2.0 training set, with the pretrained taggers in spacy, and the penn treebank tag set for pos. this results on average in 5,126 different entities per entity type, and 2,337 different tokens per pos tag. when computing pos perturbations, we found it useful to disregard perturbations of particular pos types that often led to only minor changes or incorrectly formed expressions, such as punctuation or determiners; details on these can be found in appendix a. as the number of possible perturbations to consider is potentially very large, we limit the beam search at each step to a maximum of η randomly chosen type-consistent entities from e, or tokens from p , and re-sample these throughout the search. we use a beam width of @xmath0, resulting in a bound to the total computation spent on adversarial search of b • ρ • η model evaluations per sample, where ρ is the perturbation "radius" (maximum search depth). we quantify vulnerability to the described attacks by measuring the fraction of evaluation samples for which at least one undersensitivity attack is found given a computational search budget, disregarding cases where a model predicts noanswer. 2 2 altering such samples likely retains their unanswerability. results fig. 2 shows plots for adversarial error rates on squad2.0 for both perturbation types. we observe that attacks based on pos perturbations can already for very small search budgets (η = 32, ρ = 1) reach more than 60% attack success rates, and this number can be raised to 95% with a larger computational budget. for perturbations based on ne substitution, we find overall lower attack success rates, but still find that more than half of the samples can successfully be attacked with the budgets tested. note that where attacks were found, we observed that there often exist multiple alternatives satisfying inequality 1. these findings demonstrate that bert is not necessarily considering the entire content of a comprehension question given to it, and that even though trained to tell when questions are unanswerable, the model often fails when facing adversarially selected unanswerable questions. in a side experiment we also investigated undersensitivity attacks using ne perturbations on squad1.1, which proves even more vulnerable with an adversarial error rate of 70% already using η = 32; ρ = 1 (compared to 34% on squad2.0). while this demonstrates that undersensitivity is also an issue for squad1.1, the unanswerable question behaviour is not really well-defined, rendering results difficult to interpret. on the other hand, the notable drop between the datasets demonstrates the effectiveness of the unanswerable questions added during training in squad2.0. ## analysis of vulnerable samples qualitative analysis of attacks the attacks are potentially noisy, and the introduced substitutions are by no means guaranteed to result in semanti overall the ne perturbations result in cleaner questions than pos perturbations, which suffer from semantic inconsistencies in about a quarter (24%) of the cases. while these questions have some sort of inconsistency (e.g. what year did the case go before the supreme court? vs. a perturbed version what scorer did the case go before the supreme court?), it is remarkable that the model assigns higher probabilities to the original answer even when faced with incoherent questions, casting doubt on the extent to which the replaced question information is used to determine the answer. since ne-based attacks have a substantially larger fraction of valid, well-posed questions, we will focus our study on these for the remainder of this paper. characterising successfully attacked samples we observe that models are vulnerable to undersensitivity adversaries, yet not all samples are successfully attacked. this raises the question of what distinguishes samples that can and cannot be attacked. we thus examine various characteristics, aiming to understand model vulnerability causes. first, successfully attacked questions produce lower original prediction probabilities, on average 72.9% vs. 83.8% for unattackable questions. that is, there exists a direct inverse link between a model's original prediction probability and sample vulnerability to an undersensitivity attack. the adversarially chosen questions had an average probability of 78.2% -a notable gap to the original questions. it is worth noting that search halted once a single question with higher probability was found; continuing the search increases the respective probabilities. second, vulnerable samples are furthermore less likely to be given the correct prediction overall. concretely, evaluation metrics for vulnerable examples are 56.4%/69.6% em/f 1 , compared to 73.0%/76.5% on the whole dataset (-16.6% and -6.9% em/f 1 ). attackable questions have on average 12.3 tokens, whereas unattackable ones are slightly shorter with on average 11.1 tokens. next we considered the distribution of different question types (what, who, when, ...) for both attackable and unattackable samples and did not observe notable differences apart from the single most frequent question type what; it is a lot more prevalent among the unattacked questions (56.4%) than among successfully attacked questions (42.1%). this is by far the most common question type, and furthermore one that is comparatively open-ended and does not prescribe particular type expectations to its answer, as e.g., a where question would require a location. a possible explanation for the prevalence of the what questions among unsuccessfully attacked samples is that the model cannot rely on type constraints alone to arrive at its predictions @xcite , and is thus less prone to such exploitation -see section 6 for a more in-depth analysis. finally, figure 3 shows a histogram of the 10 most common ne tags appearing in unsuccessfully attacked samples, and the corresponding fraction of replaced entities in successfully attacked samples. besides one exception, the distributions are remarkably similar: undersensitivity can be induced for a variety of entity types used in the perturbation. notably, questions with geopolitical entities (gpe) are particularly error-prone. a possible explanation can be provided by observations regarding (noncontextualised) word vectors, which cluster geopolitical entities (e.g. countries) together, thus making them harder to distinguish for a model operating on these embeddings @xcite . ## robustness to undersensitivity attacks we will now investigate methods for mitigating excessive model undersensitivity. prior work has considered both data augmentation and adversarial training for more robust models; we will conduct experiments with both. adding a robustness objective can negatively impact standard test metrics @xcite , and it should be noted that there exists a natural trade-off between performance on one particular test set and performance on a dataset of adversarial inputs. we perform data augmentation and adversarial training by adding a corresponding loss term to the log-likelihood training objective: l @xmath1, fit with a discriminative log-likelihood objective, ω either a set of augmentation data points, or of successful adversarial attacks where they exist, and λ ∈ r + a hyperparameter. in data augmentation, we randomly sample perturbed input questions, whereas in adversarial training we perform an adversarial search to identify them. in both cases, alternative data points in ω will be fit to a null label to represent the noanswer prediction -again using a log-likelihood objective. we continuously update ω throughout training to reflect adversarial samples with respect to the current model. we conduct experiments on both squad2.0 and newsqa; details on training and hyperparameters can be found in the appendix. experimental outcomes results for these experiments can be found in finally, a closer inspection of how performance changes on answerable (hasans) vs. unanswerable (noans) samples of the datasets reveals that models with modified training objectives show improved performance on unanswerable samples, while sacrificing some performance on answerable samples. 3 this suggests that the trained models -even though similar in standard metrics -evolve on different paths during training: the modified objectives prioritise unanswerable questions to a higher degree. evaluation on held-out perturbation spaces in generalisation in a biased data setting datasets for high-level nlp tasks often come with annotation and selection biases; models then learn to exploit shortcut triggers which are dataset but not task-specific @xcite . for example, a model might be confronted with question/paragraph pairs which only ever contain one type-consistent answer span, e.g. mention one number in a text with a how many...? question. it is then sufficient to learn to pick out numbers from text to solve the task, irrespective of other information given in the question. such a model might then have trouble generalising to articles that mention several numbers, as it never learned that it is necessary to take into account other relevant question information to determine the correct answer. we test models in such a scenario: a model is trained on squad1.1 questions with paragraphs containing only a single type-consistent answer expression for either a person, date, or numerical answer. at test time, we present it with question/article pairs of the same respective question types, but now there are multiple possible typeconsistent answers in the paragraph. we obtain such data from @xcite , who first described this biased data scenario. previous experiments on this dataset were conducted without dedicated development set, so while using the same training data, we split the test set with a 40/60% split into development and test data. 4 we then test both a vanilla fine-tuned bert base transformer model, and a model trained to be less vulnerable to undersensitivity attacks using data augmentation. finally, we perform a control experiment, where we join and shuffle all data points from train/dev/test (of each question type, respectively), and split the ## conclusion we have investigated undersensitivity: a problematic behaviour of rc models, where they are overly stable in their predictions when given semantically altered questions. a model's robustness to undersensitivity attacks can be drastically improved with appropriate defences without sacrificing nominal performance, and the resulting models become more robust also in other adversarial data settings.