How Does Counterfactually Augmented Data Impact Models for Social Computing Constructs? (2021)

Abstract: As NLP models are increasingly deployed in socially situated settings such as online abusive content detection, it is crucial to ensure that these models are robust. One way of improving model robustness is to generate counterfactually augmented data (CAD) for training models that can better learn to distinguish between core features and data artifacts. While models trained on this type of data have shown promising out-of-domain generalizability, it is still unclear what the sources of such improvements are. We investigate the benefits of CAD for social NLP models by focusing on three social computing constructs — sentiment, sexism, and hate speech. Assessing the performance of models trained with and without CAD across different types of datasets, we find that while models trained on CAD show lower in-domain performance, they generalize better out-of-domain. We unpack this apparent discrepancy using machine explanations and find that CAD reduces model reliance on spurious features. Leveraging a novel typology of CAD to analyze their relationship with model performance, we find that CAD which acts on the construct directly or a diverse set of CAD leads to higher performance.

## introduction dataset design is receiving increasing attention, especially in response to concerns related to the generalizability of machine learning-based nlp models. recent critiques argue that models trained for nlp tasks may end up "learning the dataset" rather than a particular construct (bras et al., 2020), i.e, the intangible measure like sentiment or stance that is the ultimate goal of the learning task @xcite . in particular, in the process of inferring the mapping between an input space and output space, models may learn cues in the dataset which are spuriously correlated with the construct @xcite . for example, sentiment models trained on movie reviews tend to learn more about movies than about sentiment, thereby failing to measure it as accurately in e.g., news media @xcite . this potential learning of spurious cues over meaningful manifestations of the construct makes it especially difficult to foresee how even small differences in the context of deployment would affect the performance of nlp models, with undesirable consequences for their applicability at large. the issue of model robustness is all the more crucial for social computing nlp models, particularly for constructs like hate speech and sexism, which are often deployed in detecting abusive content on online platforms @xcite . in such settings, there is a risk of high societal and human harms such as sanctioning marginalized voices due to model misclassification and bias @xcite . even in contexts other than online governance, such as using social nlp models for detecting abuse faced by a certain subpopulations on a particular online space, we incur the risks and consequences of mismeasurement @xcite . one suggested solution to address the issue of spurious features is counterfactually augmented data (cad)-instances generated by human annotators that are minimally edited to flip their labeland their variations such as iterative benchmark design @xcite , contrast data generation @xcite ), foot_0 and their combination @xcite . drawing on the rich history of counterfactuals @xcite @xcite , the promise of cad is to offer a causality-based framework where only cues that are meaningfully associated with the construct are edited -which is expected to be conducive to models learning less spurious features. indeed, recent work has shown that models trained on cad generalize better out of domain @xcite . yet, it is not well understood why or how these counterfactuals are effective, especially for social nlp tasks-do they reduce dependence on spurious features and to what extent? ## experiments we first start by assessing overall performance on different types of data (rq1), followed by introducing a typology of different types of cad in order to understand if certain strategies of generating cad are better for model performance (rq2), and end by using explanations to understand which features the cf models promote (rq3). unless specified otherwise, we report results for bert, while including the results for lr in the appendix for completeness (appendix 10). we measure performance using macro f1 and positive class f1, where the latter metric is significant for constructs like sexism and hate speech. ## related work our work connects the area of learning with counterfactuals to improve nlp models' robustness with the area of social nlp. counterfactuals in nlp. counterfactuals in nlp have been used for model testing, and ex-planation, but in this work, we are interested in using them for training models. counterfactuals can be used for augmenting training data where previous research, focused on sentiment and nli, has shown models trained on this augmented data are more robust to data artifacts @xcite . counterfactuals need not always be label-flipping, but usually entail making minimal changes to original data either, and can be generated by manually or automatically @xcite . recent work has also addressed automatic cad generation through lexical or paraphrase changes @xcite , templates @xcite , and controlled text generation @xcite . concurrent and closely related to our work, joshi and he assess the efficacy of cad for natural language inference and question answering, and find that diverse cad is crucial for improving generalizability, in line with our current work. on the other hand, cad generated by human annotators has not been analyzed in detail to see which strategies are used for generating counterfactuals nor which strategies are more effective, particularly for social computing nlp tasks. in this work, we focus on human generated, label-flipping counterfactuals for relatively understudied constructs in this domain -sexism and hate speech, while more importantly focusing on how cad impacts models. inspired by causal mediation @xcite , we put forth a typology of construct-driven and construct-agnostic cad. complementing previous research on overall performance, we take a deeper dive into which features cad promotes, and which types are effective. ## conclusion we take a deeper dive into the utility of training on counterfactually augmented data (cad) for improving the robustness of social nlp models. for three text classification constructs-sentiment, sexism, and hate speech-we train lr and bert models with and without counterfactual data. for the counterfactual models, we experiment with different sampling strategies to understand how different types of cad affect model performance. firstly, we corroborate previous findings on using counterfactual data, showing that models trained on cad have higher out-of-domain performance. our work's core novelty is that we study different strategies for cad generation, and find that examples generated by acting on the construct are effective for sexism, while a diverse set is better for hate speech. finally, we show that models trained on cad promote core or non-spurious features over spurious ones. taken together, our analysis serves as a blueprint for assessing the potential of cad, while our findings can help dataset and model designers design better cad for social nlp tasks.