Using contradictions improves question answering systems (2023)

Abstract: This work examines the use of contradiction in natural language inference (NLI) for question answering (QA). Typically, NLI systems help answer questions by determining if a potential answer is entailed (supported) by some background context. But is it useful to also determine if an answer contradicts the context? We test this in two settings, multiple choice and extractive QA, and find that systems that incorporate contradiction can do slightly better than entailment-only systems on certain datasets. However, the best performances come from using contradiction, entailment, and QA model confidence scores together. This has implications for the deployment of QA systems in domains such as medicine and science where safety is an issue.

## introduction safety in nlp systems is unresolved, particularly in biomedical and scientific contexts where hallucination, overconfidence, and other problems are major obstacles to deployment @xcite . one active area of research to solve these issues is natural language inference (nli) @xcite . nli is the task of determining whether a hypothesis is true (entailed), false (contradicted), or undetermined (neutral) given some premise. current nli systems typically focus only on entailment to verify hypotheses-they calculate the degree to which a hypothesis is supported by the premise. but the premise can provide another signal: contradiction. regardless of how well a hypothesis is entailed by the context, it can also be more or less contradicted, which could affect whether it is accepted or rejected. contradictions are an important signal indicating whether some statement might be unacceptable given a premise. in some cases where we might not know if a statement is supported, we should still ensure we are rejecting statements that are outright contradicted. we wondered if adding this signal to a question answering (qa) system might improve performance and safety. to this end, we propose a method that reformulates answers from the qa system as hypotheses for nli, calculates the entailment, contradiction, and neutrality of each hypothesis, and then selects the best one based on a combination of these results (figure 1 ). we show that across 16 qa datasets (9 multiple choice and 7 extractive), the best approach is to use entailment, contradiction, and confidence scores together. using only contradiction is roughly on par with, and sometimes better than, using only entailment. one of these settings is selective question answering for extractive qa, where selective refers to abstention when the system is not confident enough in its answer @xcite . @xcite have found that nli systems are able to verify the predictions made by a qa system in this setting, but their result is limited to only selecting a top k% of answers. moreover, they do not provide an approach for improving overall performance, nor do they show the effect of incorporating contradiction directly (but do so indirectly by analyzing non-entailed passages). in the related setting of multiple choice qa and fact checking, @xcite have explored the use of entailment, finding that nli models do well at these tasks by themselves, but can perform even better when they are adapted to in-domain data and longer premises. yet their method uses only a two-class nli set up (entailed or not entailed), which doesn't tell us much about directly using the contradiction signal. @xcite does incorporate the contradiction signal showing the power of contradiction to improve machine comprehension but does not analyze its effects separately from entailment. other qa settings in which nli has been used include open domain @xcite and multi-hop @xcite . thus far, approaches tend to focus on entailment. to our knowledge, our work is the first to directly assess using contradictions for qa isolated from entailment. outside of question answering, a domain that uses contradictions is factual consistency-the task of ensuring that a collection of utterances is faithful to a source document. @xcite provide an overview. typically, entailment is still the main focus, but @xcite propose an nli-based method to ensure the consistency of a summary with a source document using contradiction and neutral scores in addition to entailment, beating out previous systems. other researchers have used contradictions to identify consistency errors across wikipedia @xcite or generate credible character dialogue @xcite . ## methods we tested the effect of contradictions in two qa settings and a total of sixteen question-answer datasets. our approach is broadly similar to both @xcite and @xcite in that we use most of the same datasets for evaluating nli reranking for multiple choice qa and extractive qa. unlike both, we incorporate contradiction directly as a signal for reranking answers. briefly, for each dataset, we used pretrained qa models to produce answers and confidence scores for the dataset's questions. we refer to the confi-dence scores below as qa. we then trained qa2d models (where qa2d stands for "question-answer to declarative") to turn the answers into the declarative hypothesis format required for nli. for example, the question-answer pair "what is the most abundant metal in the earth crust? copper." might be rephrased as "the most abundant metal in the earth crust is copper" (see appendix d for more details). with the question contexts as premises, we then used nli models to classify every premisehypothesis pair into three classes, each with an associated score: entailed (e), contradicted (c), and neutral (n). after that, we trained logistic regression calibration models to find which linear combination of the four scores-qa, e, c, and n-was best able to pick the answers accurately. when evaluating performance, we applied the selective qa approach from @xcite to rank answers using combinations of the four scores, and then consider only those that the model was most confident in answering. we compared selecting the top 20% and 50%. in the multiple choice setting, it was also possible to rank all potential answers according to the four scores, unlike in the extractive qa setting where the qa model produced only one answer per question, so we evaluated performance with that approach as well (see appendix a for details). ## experimental setting in the multiple choice setting, we tested 9 datasets. two of them are in-domain, since the pretrained qa models we used were finetuned on them. specifically, we used a roberta large model @xcite finetuned on the race dataset @xcite , as well as two deberta v3 variants, base and xsmall @xcite , finetuned on the sciq dataset @xcite . in the extractive qa setting, we used 7 datasets: five from the mrqa 2019 task @xcite , as well as squad 2.0 @xcite and squad adversarial @xcite . the squad model is the in-domain dataset: it was used to pretrain @xcite the two qa models we used, distillbert @xcite and bert-large @xcite . @xcite , we used the natural questions dataset for calibration. in both settings, all datasets contain the relevant context that can be used by the qa models to select answers. more detail on the datasets and qa models is available in appendices b and c respectively. see appendices d, e, and f for details on the qa2d, nli, and calibration models. our models follow the setups described in @xcite , @xcite , and @xcite . the main interesting detail is that the calibration models were trained on a holdout set of 100 samples from a single domain, using logistic regression, as in @xcite . ## discussion contradiction with background context is a useful signal that nlp systems can use to infer answers to questions. this is not necessarily a superior strategy to using entailment, but our results show that combining these two signals can improve performance beyond what qa models can achieve on their own. these results are interesting because using contradictions comes with potential benefits for the safety of nlp systems and, as a result, their deployment in domains such as medicine or science. namely, that there are many potential cases where we are not sure if a statement is entailed directly by a background context but we may be sure that the statement is not refuted by a background context. in two-class nli settings where we focus only on entailment, neutral and contradiction are collapsed together and we don't have this guarantee. ## limitations our work comes with some limitations. it is uncertain whether our results in two specific settings, multiple choice and extractive qa, would extend to more general settings for nli, although the use of contradictions for factual consistency by @xcite suggests that they could. additionally, 3-class nli is not sufficient to capture all the natural language relations that might be needed to verify an answer. as such more challenging datasets in other settings and more granular nli settings should be attempted. another limitation involves answer ranking and the associated computational cost. the main reason we did not test answer ranking in extractive qa is that we did not generate diverse outputs, but another reason is that such a procedure grows prohibitively expensive as the domain becomes more open. in a fully open domain, ranking would require a quadratic evaluation for each context passage against each reformulated answer candidate @xcite . future work should look at comparison approaches that amortize this cost, such as nli-based dense passage retrieval @xcite .