CAT f OOD : Counterfactual Augmented Training for Improving Out-of-Domain Performance and Calibration (2024)

Abstract: In recent years, large language models (LLMs) have shown remarkable capabilities at scale, particularly at generating text conditioned on a prompt. In our work, we investigate the use of LLMs to augment training data of smaller language models (SLMs) with automatically generated counterfactual (CF) instances – i.e. minimally altered inputs – in order to improve out-of-domain (OOD) performance of SLMs in the extractive question answering (QA) setup. We show that, across various LLM generators, such data augmentation consistently enhances OOD performance and improves model calibration for both confidence-based and rationale-augmented calibrator models. Furthermore, these performance improvements correlate with higher diversity of CF instances in terms of their surface form and semantic content. Finally, we show that CF augmented models which are easier to calibrate also exhibit much lower entropy when assigning importance, indicating that rationale-augmented calibrators prefer concise explanations.

## introduction ever since their introduction to the field of nlp, large language models (llms) have shown exceptional performance across a wide array of applications @xcite @xcite ; inter alia). llms have frequently been utilized to enhance reasoning capabilities of smaller models @xcite , generate counterfactuals (cf) -minimally perturbed input instances -for data augmentation @xcite , and have shown remarkable generalization capabilities, performing well on various tasks such as question answering (qa), complex reasoning, and code generation @xcite @xcite . on the other hand, comparatively small language models 1 we make our code available at: github.com/catfood original: what did john rawls publish? counterfactuals rgf: what was the title of rawls' 1993 work? llama: what did rawls's first main book focus on? gpt-neoxt: what was rawls's last book? flan-ul2: what was rawls's approach to distributive justice? 0.55 0.50 0.45 0.41 semantic similarity (sbert) figure 1 : an illustration of the counterfactual samples (purple) for the input question (green) produced by the rgf baseline and our approaches using llms. while rgf produces a question closely related to the input, llms generate more diverse questions with respect to surface form and semantic content. to alleviate the issue of poor ood performance for qa, recent works have resorted to augmenting training data with counterfactual instances automatically generated by llms @xcite . training on cf augmented data reduces model reliance on spurious features, which in turn improves generalizability @xcite . @xcite fine-tune a t5-based model to generate minimally different counterfactual instances with their retrieve-generate-filter (rgf) approach, we leverage a range of more powerful llms such as flan-ul2 @xcite and @xcite . owing to the extensive training of these llms on diverse data, coupled with their enhanced generative capabilities, we hypothesize they will produce counterfactual instances more diverse with respect to their surface form and semantic content, covering a broader part of the input space, further improving robustness and generalization. a sample of diverse cf instances is shown in figure 1 , highlighting variations in focus, temporality, specificity, and domain knowledge. in other work, @xcite improve the calibration of slms by leveraging features from rationales, explanations of the inner decision making process of the model, to train a calibrator model -a simple classifier which predicts whether the base model is correct or not. we hypothesize that cf augmented models possess more precise explanations of their decisions, as they are forced to consolidate the more complex discrepancies between instances and their cfs, which should in turn provide better information to the calibrator model and improve calibration. to better investigate the connection between model explanations and calibrator performance, we introduce semantic features -dense representations of the most important tokens from explanations -to calibrator models, consider a wider range of explainability methods, and measure whether characteristics of explanations -such as comprehensiveness and sufficiency @xcite are indicative of the models' calibration performance. in our work, we present the first systematic and comprehensive study on the effect of diverse cfs for augmenting slms with respect to their ood performance, explanation quality and calibration performance. our experiments show that: (1) more diverse cfs improve ood performance and model calibration in extractive qa by a large margin; ## conclusion in our paper, we present a novel approach for automatic data augmentation by llm generated counterfactual instances diverse in surface form and semantic content. our results show that augmenting training data of smaller models with llm generated cfs consistently improves generalization capabilities of slms across six ood extractive qa datasets. we further show that models trained on cf augmented data are easier to calibrate, both when considering the standard confidence-based setup as well as the explanation-augmented calibration setup. finally, we show that rationaleaugmented calibrator models prefer concise explanations, rather than comprehensive ones. by highlighting the fact that more diverse cf instances improve the quality of the models' internal representations we pave the way for future works exploring the relation between surface form and semantic diversity of data used for augmentation and the models' generalization performance.