Controlling Learned Effects to Reduce Spurious Correlations in Text Classifiers (2023)

Abstract: To address the problem of NLP classifiers learning spurious correlations between training features and target labels, a common approach is to make the model’s predictions invariant to these features. However, this can be counter-productive when the features have a non-zero causal effect on the target label and thus are important for prediction. Therefore, using methods from the causal inference literature, we propose an algorithm to regularize the learnt effect of the features on the model’s prediction to the estimated effect of feature on label. This results in an automated augmentation method that leverages the estimated effect of a feature to appropriately change the labels for new augmented inputs. On toxicity and IMDB review datasets, the proposed algorithm minimises spurious correlations and improves the minority group (i.e., samples breaking spurious correlations) accuracy, while also improving the total accuracy compared to standard training.

## introduction while classifiers trained on pre-trained nlp models achieve state-of-the-art accuracy on various tasks, they have been shown to learn spurious correlations between input features and the label @xcite . such learned correlations impact accuracy on out-of-distribution samples and in the case of sensitive spurious features, lead to unfair predictions @xcite . learned spurious correlations can be over features that are either irrelevant (e.g., tense, gender for profession classification) or relevant (e.g., emoticons for sentiment classification, negation words for contradiction). in both cases, the classifier overweighs their importance compared to other features. for removing spurious correlations, a common principle underlying past work is to make a model's prediction invariant to the features that exhibit the correlation. this can be done by data augmentation @xcite , latent space removal @xcite , subsampling @xcite , or sample reweighing @xcite . in many cases, however, the correlated features may be important for the task and their complete removal can cause a degradation in task performance. for instance, for spurious correlation over negation tokens (e.g., "not") or lexical overlap in mnli natural language inference tasks, @xcite ; @xcite show that correlated features are necessary for prediction and their removal can hurt accuracy. as another example, consider the imdb review dataset @xcite where the task is classify the sentiment of a given review as positive or negative. reviewers often include a numeric rating in their text reviews, e.g., "9/10" or "1/10". the numeric rating is highly correlated with the sentiment label, often regarded as a spurious correlation @xcite ) that a model should not rely on. in the first review of fig. 1 , for instance, the positive rating can mislead a classifier since the review is overall negative. however, in the second example, the text is ambiguous and the rating "8/10" can provide a helpful signal about the reviewer's sentiment (and removing it may decrease classifier's accuracy). thus, there exist inputs where the rating is a helpful feature for prediction and other inputs where it can be counter-productive. this shows the trade-off between accuracy on majority groups, (i.e., samples where these correlations hold and constitute a majority of samples) and minority groups (i.e., comparatively fewer samples where these correlations break). in this paper, we propose a general method to resolve the above trade-off: rather than always removing the effect of a feature on the model's prediction, we argue that the learned effect should be equal to the true effect of the feature on the output label. we define feature effect using the notion of conditional effect from the causal inference literature @xcite : the change in the ground-truth label upon changing the feature, keeping all other input features constant. to enforce the true feature effect, we make two contributions: when combined with the standard accuracy loss over training data, the proposed method, feature effect augmentation (feag), obtains the highest overall accuracy compared to baselines while reducing the learnt spurious correlation. for our evaluation, we consider the practical goal of increasing the accuracy on the minority groups while not substantially reducing the accuracy over the majority group. on comment toxicity and imdb review datasets, we find that existing methods tend to increase minority group accuracy but reduce overall accuracy, whereas feag obtains a good tradeoff. in some cases, it can obtain both higher overall accuracy and higher average group accuracy. moreover, by making it easy to change the target feature effect to be enforced, feag provides an interpretable control mechanism to obtain any desired tradeoff between minority and majority group accuracy (setting the feature effect to zero, e.g., prioritizes minority group accuracy). more generally, our work provides a viable direction for automated data augmentation. while existing work requires manual labeling of counterfactual examples for removing spurious correlation @xcite , our method can label new examples using estimated feature effects. we also show how estimated feature effects can be useful for other tasks, such as detecting annotator bias in a train set. ## estimating feature effects on labels our task is to estimate the effect of text features on the label y in training dataset. this is important for many use cases : 1) regularising a text classifier to obey the feature's effect on the label in its prediction; 2) identifying annotator artifacts @xcite for the label y in the dataset, e.g., when the estimated effect does not match the ground-truth known effect of a feature. for 1), we present an automated augmentation algorithm in sec 4 based on the estimated feature effect. for 2), we use the feature effect estimation technique and present results on a comment toxicity dataset in sec 5.4. for feature effect estimation, we assume that the data is generated from a distribution d following the causal graph in fig. 2 @xcite . the writer has some intent c, which generates the input sentence (z). the sentence z can conceptually be disentangled into 2 parts, 1) the feature of interest (@xmath0, 1}) and 2) rest of the text x. annotators perceive the outcome label (y ) from the complete text z. the samples {(z i , y i )} are drawn independently from d. note that the same dataset may contain multiple features t j (@xmath1...m) whose effect needs to be estimated, leading to a different decompositions (x j , t j ). we term the feature t as treatment, and x as covariates, following the causality literature. since the variables x and t are sampled from the same latent variable c, they are not independent of each other. for example, in context of imdb data, if the intent of the writer is to write a positive review then it is highly likely that x will contain positive adjectives while treatment t might be the inclusion of rating as the string 9/10. this unobserved latent variable (intent of writer) is called the confounder c. the correlations between treatment feature t and rest of text x due to the presence of confounder c can lead to the classifier model learning incorrect effect for the treatment feature. for computing feature effect, we leverage the causal inference literature @xcite and estimate average treatment effect (ate). ## experiments we have three goals for evaluation: 1) rr-based estimators of feature effect are more accurate than propensity-based estimators; 2) feag using rrbased estimators provides better overall accuracy while minimizing spurious correlation compared to existing baselines for removing spurious correlations; 3) our feature effect estimator is a general method and can be used to detect annotator bias. ## conclusion rather than fully removing a feature's effect on the classifier, we presented a method for fine-grained control of the feature's effect based on causal inference. we showed how our method allows a better tradeoff between overall accuracy and accuracy over subgroups in the data. our preliminary study on annotator bias demonstrated that our method may be useful for detecting biases in the classification label too. as future work, a natural direction is to combine these two threads and explore how we can develop methods to regularize features' effect on the debiased label, rather than the (possibly confounded) labels provided in the dataset. limitations one major shortcoming of feag method is the dependency on creation of counterfactual inputs. if there is an error in counterfactual generation, we might get a wrong feature effect estimate. thus, for simplicity, our evaluation considered tokens as features. the parallel development of counterfactual input generation methods @xcite would hopefully ease this issue and allow feag to be used reliably for spurious correlations on more complex features too. ethics statement this project aims to check when methods are using spurious correlation. identification of these spurious correlation is important for debiasing i.e. removal of dependence of the model on these correlations. our work shows how instead of complete removal of these spurious features, regularising them might be better. at the same time, this is early research work and shouldn't be used in real-world systems without further evaluation.