N euro C ounterfactuals: Beyond Minimal-Edit Counterfactuals for Richer Data Augmentation (2022)

Abstract: While counterfactual data augmentation offers a promising step towards robust generalization in natural language processing, producing a set of counterfactuals that offer valuable inductive bias for models remains a challenge. Most existing approaches for producing counterfactuals, manual or automated, rely on small perturbations via minimal edits, resulting in simplistic changes. We introduce NeuroCounterfactuals, designed as loose counterfactuals, allowing for larger edits which result in naturalistic generations containing linguistic diversity, while still bearing similarity to the original document. Our novel generative approach bridges the benefits of constrained decoding, with those of language model adaptation for sentiment steering. Training data augmentation with our generations results in both in-domain and out-of-domain improvements for sentiment classification, outperforming even manually curated counterfactuals, under select settings. We further present detailed analyses to show the advantages of NeuroCounterfactuals over approaches involving simple, minimal edits.

## introduction despite the enormous successes in natural language processing, out-of-domain (ood) generalization still poses a challenge for even the most powerful models, which achieve remarkable performance in domain @xcite . this can be attributed to the models' reliance on spurious biases @xcite @xcite , i.e. features which co-occur with the ground truth without any causal dependence @xcite . adopting methods from causal inference @xcite , training data augmentation with counterfactuals (cfs) has been proposed for nlp as one potential solution @xcite @xcite . counterfactuals are designed to study the change in a response variable (e.g., the finally, to ensure that the generation is similar to the original, we use neurologic, a constrained decoding approach ( §2.3; @xcite , where the constraints are extracted tokens from 1. this results in neurocounterfactuals, which are loose counterfactuals of the original, but are more naturalistic ( §4; tab. 1), compared to minimal edit counterfactuals (bottom). 4 when used to augment training data for sentiment classification, our generations are valuable for ood generalization ( §3). however, designing the appropriate interventions to produce counterfactuals can be challenging. indeed, most counterfactuals are produced via basic edits to the input text, either manually @xcite or automatically @xcite @xcite , such that the target label changes. these minimal edits are made via substitution, insertion or deletion of tokens in the original sentence, resulting in simplistic generations, which are often unrealistic and lack linguistic diversity. 1 as a result, counterfactuals via minimum edits often fail to provide adequate inductive biases to promote robustness @xcite @xcite . in this paper, we investigate the potential of more realistic and creative counterfactuals, which go beyond simple token-level edits, towards improving robust generalization. while allowing larger edits reduces proximity to the original sentence, we believe that this is a worthwhile trade-off for more realistic and creative counterfactuals, which offer greater flexibility in sentiment steering, increasing the likelihood that the counterfactual possesses the desired label. we propose a novel approach that can generate diverse counterfactuals via conceptcontrolled text generation, illustrated in figure 1 . in particular, our approach combines the benefits of domain adaptive pretraining @xcite for soft steering of the target label @xcite , with those of neurologic decoding @xcite , an unsupervised, inference-time algorithm that generates fluent text while strictly satisfying complex lexical constraints. as constraints, we use tokens that evoke salient concepts derived from conceptnet @xcite . our resulting generations, called neurocounterfactuals 2 , provide loose counterfactuals to the original, while demonstrating nuanced linguistic alterations to change the target label ( §2). compared to minimal-edit counterfactuals, our counterfactuals are more natural and linguistically diverse, resulting in syntactic, semantic and pragmatic changes which alter the label while preserving relevance to the original concepts ( we describe our methodology for automatic generation of loose counterfactuals, neurocfs, for sentiment classification. the key idea underlying our approach is the need for retention of concepts to ensure content similarity to the original text, while steering the sentiment to the opposite polarity. our method, illustrated in figure 1 , combines a concept-constrained decoding strategy with a sentiment-steered language model. first, we detail our approach for extracting the salient concepts from a document ( §2.1). next, we discuss language model adaptation to produce sentiment-steered lms ( §2.2). finally, we provide an overview of the neurologic decoding algorithm for controlled text generation, and how it can be adapted for the task of generating sentiment counterfactuals ( §2.3). ## data augmentation with neurocfs our experiments compare neurocfs to cfs from minimal edit approaches, for augmentation of sentiment classification training data. ## analysing neurocfs we present further analysis of neurocf properties, such as neurocfs size ( §4.1), and similarity to the original ( §4.2), and also ablations of our method ( §4.3, §4.4). ## related work counterfactual data augmentation is emerging as a viable solution for improving model robustness towards spurious correlations @xcite . in previous sections, we present comparisons to various minimal edit approaches for producing counterfactuals @xcite @xcite @xcite , either manually or automatically. our approach steers away from minimal edits, as well as manual intervention for creating counterfactuals. beyond sentiment classification, this approach has been employed for tasks such as question answering @xcite , fairness in social computing @xcite , and natural language inference @xcite . most work focus on minimal edits of training instances via small perturbations to the causal features, via manually editing instances. @xcite introduce a controlled text generation approach to create counterfactuals containing specific attributes, but focus on applications to debiasing and evaluation rather than our objective of training data augmentation. @xcite propose a structural causal model for combing attribute-conditional generation and text attribute transfer (i.e., minimal edits), but similarly produce counterfactuals for different purposes than ours. @xcite automate contrast sets @xcite for question answering, dependency parsing and relation extraction, via training a generator with semantic control codes; however, their method requires the user to specify what changes in the original sentence are desired. beyond counterfactuals: srivastava et al. (2020) collect human annotations for commonsense reasoning behind examples, in a robust optimization setting to minimize worst-case loss, without explicitly collecting counterfactuals. ribeiro et al. (2018) demonstrate how state-of-the-art models are vulnerable to semantically-equivalent adversarial examples constructed from a rule-based method. ribeiro et al. (2020) propose checklists, which contain heuristic edits of the evaluation data instances. other approaches employ perturbations without creating actual data instances @xcite . ## discussion we presented an approach to generate neurocfs, via sentiment steering and concept-constrained decoding. training data augmentation with neu-rocfs results in improvement on sentiment classification performance over existing minimal-edit methods, both in and out of domain; even matching human counterfactuals in some cases. we presented several analyses for neurocfs, and ablations showing the effectiveness of our approach. while neurocfs are loose by design, our analyses indicate the existence of an optimal degree of similarity, which is not as high as minimal edit counterfactuals, and not as low as constraint-free counterexamples. while this work focused on neurocfs for movie reviews only, our results show that training on them transfers to other domains such as product reviews and social media posts for the same sentiment analysis task. future directions of research might investigate generating neurocfs for evaluation, and tasks beyond sentiment classification. our approach is broadly compatible with tasks for which a language model steer can be trained; future applications of this work could therefore include other nlp tasks where global attributes are available, such as toxicity removal or style transfer. further, we could consider generating a neurocfs neighborhood around individual instances, similar to contrast sets @xcite .