CREST : A Joint Framework for Rationalization and Counterfactual Text Generation (2023)

Abstract: Selective rationales and counterfactual examples have emerged as two effective, complementary classes of interpretability methods for analyzing and training NLP models. However, prior work has not explored how these methods can be integrated to combine their complementary advantages. We overcome this limitation by introducing CREST (ContRastive Edits with Sparse raTionalization), a joint framework for selective rationalization and counterfactual text generation, and show that this framework leads to improvements in counterfactual quality, model robustness, and interpretability. First, CREST generates valid counterfactuals that are more natural than those produced by previous methods, and subsequently can be used for data augmentation at scale, reducing the need for human-generated examples. Second, we introduce a new loss function that leverages CREST counterfactuals to regularize selective rationales and show that this regularization improves both model robustness and rationale quality, compared to methods that do not leverage CREST counterfactuals. Our results demonstrate that CREST successfully bridges the gap between selective rationales and counterfactual examples, addressing the limitations of existing methods and providing a more comprehensive view of a model’s predictions.

## introduction as nlp models have become larger and less transparent, there has been a growing interest in developing methods for finer-grained interpretation and control of their predictions. one class of methods leverages selective rationalization @xcite , which trains models to first select rationales, or subsets of relevant input tokens, and then make predictions based only on the selected rationales. these methods offer increased interpretability, as well as learning benefits, such figure 1: our generation procedure consists of two stages: (i) a mask stage that highlights relevant tokens in the input through a learnable masker; and (ii) an edit stage, which receives a masked input and uses a masked language model to infill spans conditioned on a prepended label. as improved robustness to input perturbations @xcite . another class of methods generates counterfactual examples, or modifications to input examples that change their labels. by providing localized views of decision boundaries, counterfactual examples can be used as explanations of model predictions, contrast datasets for fine-grained evaluation, or new training datapoints for learning more robust models @xcite @xcite . this paper is motivated by the observation that selective rationales and counterfactual examples allow for interpreting and controlling model behavior through different means: selective rationalization improves model transparency by weaving interpretability into a model's internal decisionmaking process, while counterfactual examples provide external signal more closely aligned with human causal reasoning @xcite . we propose to combine both methods to leverage their complementary advantages. we introduce crest (contrastive edits with sparse rationalization), a joint framework for rationalization and figure 2 : overview of crest-rationalization. we start by passing an input x through crest-generation, which yields a counterfactual edit x along side two masks: z ⋆ for the original input, and z⋆ for the counterfactual. next, we train a new rationalizer (masker) decomposed into two flows: a factual flow that takes in x and produces a rationale z, and a counterfactual flow that receives x and produces a rationale z. lastly, we employ a regularization term ω(z, z) to encourage agreement between rationales for original and counterfactual examples. overall, our experiments show that crest successfully combines the benefits of counterfactual examples and selective rationales to improve the quality of each, resulting in a more interpretable and robust learned model. ## crest-generation we now introduce crest (contrastive edits with sparse rationalization), a framework that combines selective rationalization and counterfactual text generation. crest has two key components: (i) crest-generation offers a controlled approach to generating counterfactuals, which we show are valid, fluent, and diverse ( §4.2); and (ii) crest-rationalization leverages these counterfactuals through a novel regularization technique encouraging agreement between rationales for original and counterfactual examples. we demonstrate that combining these two components leads to models that are more robust ( §6.2) and interpretable ( §6.3). we describe crest-generation below and crest-rationalization in §5. formally, let @xmath0, ..., x n ⟩ represent a factual input text with a label y f . we define a counterfactual as an input @xmath1, ..., x m ⟩ labeled with y c such that y f ̸ = y c . a counterfactual generator is a mapping that transforms the original text x to a counterfactual x. like mice, our approach for generating counterfactuals consists of two stages, as depicted in figure 1 : the mask and the edit stages. mask stage. we aim to find a mask vector @xmath2, 1} n such that tokens x i associated with z @xmath3. to this end, we employ a spectra rationalizer as the masker. concretely, we pre-train a spectra rationalizer on the task at hand with a budget constraint b, and define the mask as the rationale vector @xmath4, 1} n (see §2.1). ## evaluating crest counterfactuals this section presents an extensive comparison of counterfactuals generated by different methods. ## crest-rationalization now that we have a method that generates highquality counterfactual examples, a natural step is to use these examples for data augmentation. however, vanilla data augmentation does not take advantage of the paired structure of original/contrastive examples and instead just treats them as individual datapoints. in this section, we present crest's second component, crest-rationalization (illustrated in figure 2 ), which leverages the relationships between factual and counterfactual inputs through a spectra rationalizer with an agreement regularization strategy, described next. ## exploiting counterfactuals for training in this section, we evaluate the effects of incorporating crest-generated counterfactuals into training by comparing a vanilla data augmentation approach with our crest-rationalization approach. we compare how each affects model robustness ( §6.2) and interpretability ( §6.3). ## conclusions we proposed crest, a joint framework for selective rationalization and counterfactual text generation that is capable of producing valid, fluent, and diverse counterfactuals, while being flexible for controlling the amount of perturbations. we have shown that counterfactuals can be successfully incorporated into a rationalizer, either via counterfactual data augmentation or agreement regularization, to improve model robustness and rationale quality. our results demonstrate that crest successfully bridges the gap between selective rationales and counterfactual examples, addressing the limitations of existing methods and providing a more comprehensive view of a model's predictions.