Source-linked AI summary
Robustness to Spurious Correlations in Text Classification via Automatically Generated Counterfactuals
Zhao Wang, Aron Culotta
TL;DR
Spurious correlations can threaten classifier reliability when test distributions shift or examples change. The paper identifies likely causal features through matching and uses antonym substitutions to generate oppositely labeled counterfactual training data. The combined training data improves performance on original and human-generated counterfactual tests.
Problem
Spurious feature–class correlations can threaten model validity and reliability when test data shifts or examples receive minor changes.
Source: §1 · p. 1Method
Results
12%–25% absolute improvement over the baseline was reported for the combined-data classifier on original and counterfactual testing data.
Source: §1 · p. 2Takeaways & Limitations
The authors report that even a small number of causal terms can improve robustness, and that 100 annotated causal terms achieved performance comparable to human-generated counterfactuals in their experiments.
Source: §7 · p. 7Causal features are operationalized as terms expected to determine a document's label, all else being equal.
Source: §3 · p. 2
Abstract
from arXiv · showhide
Spurious correlations threaten the validity of statistical classifiers. While model accuracy may appear high when the test data is from the same distribution as the training data, it can quickly degrade when the test distribution changes. For example, it has been shown that classifiers perform poorly when humans make minor modifications to change the label of an example. One solution to increase model reliability and generalizability is to identify causal associations between features and classes. In this paper, we propose to train a robust text classifier by augmenting the training data with automatically generated counterfactual data. We first identify likely causal features using a statistical matching approach. Next, we generate counterfactual samples for the original training data by substituting causal features with their antonyms and then assigning opposite labels to the counterfactual samples. Finally, we combine the original data and counterfactual data to train a robust classifier. Experiments on two classification tasks show that a traditional classifier trained on the original data does very poorly on human-generated counterfactual samples (e.g., 10%-37% drop in accuracy). However, the classifier trained on the combined data is more robust and performs well on both the original test data and the counterfactual test data (e.g., 12%-25% increase in accuracy compared with the traditional classifier). Detailed analysis shows that the robust classifier makes meaningful and trustworthy predictions by emphasizing causal features and de-emphasizing non-causal features.
1 Introduction
Spurious feature–class correlations can undermine classifiers under distribution shifts or minor example changes, motivating models that identify causal features. This paper automatically generates counterfactual training data and reports improved performance on original and human-generated counterfactual tests.
1 Introduction
- Spurious correlations can make predictions problematic when test distributions change or examples receive minor changes, raising fairness and trust concerns.Source: §1 · p. 1
- Identifying causal associations between features and classes is presented as a route to more robust and generalizable models.Source: §1 · p. 1
- Earlier human-in-the-loop approaches used crowdsourced reasoning or minimally edited counterfactuals, but collecting such annotations can be costly.Source: §1 · p. 1
- The proposed pipeline identifies likely causal features, substitutes their antonyms in counterfactual samples, assigns opposite labels, and combines the samples with original training data.Source: §1 · p. 1
- 12%–25% absolute improvement over the baseline was reported for the classifier trained on original and automatically generated counterfactual data across original and counterfactual testing data.The original-data classifier had a 10%–37% drop in accuracy on human-generated counterfactual tests.Source: §1 · pp. 1–2
2 Related Work
Prior work addresses spurious correlations through causal methods and human-assisted counterfactual augmentation. This paper's stated contributions are statistical matching to find likely causal features, automatic antonym-based counterfactual generation, robustness experiments, and analyses of feature importance.
2 Related Work
- Prior work examined spurious correlations arising from overparameterization, imbalanced training data, data leakage, distribution shift, and backdoor attacks.Source: §2 · p. 2
- Related approaches include causal adjustment and feature removal, as well as human-provided rationales and counterfactual data augmentation, including methods requiring substantial human intervention.Source: §2 · p. 2
- The paper proposes statistical matching to discover likely causal features, then antonym substitution to generate counterfactual samples with reduced human effort.Source: §2 · p. 2
- The authors report experiments demonstrating improved robustness to spurious features and analyses showing increased importance for causal features and decreased importance for spurious features.Source: §2 · p. 2
3 Problem and Motivation
The paper frames spurious feature correlations as a source of classification errors and operationalizes a causal feature as one expected to determine a document's label, all else equal. Its proposed augmentation replaces causal terms with antonyms and assigns the resulting samples opposite labels.
3 Problem and Motivation
- A binary logistic-regression classifier maps bag-of-words document features to labels, and its coefficients are used to examine partial feature–label correlations.Source: §3 · p. 2
- In the Amazon Kindle example, “free” correlates with negative sentiment because it is frequent in negative reviews, misleading predictions on positive documents containing the term.Source: §3 · p. 2
- A causal feature is operationally a term expected to determine a document's label, all else being equal; “boring,” rather than “free,” is the motivating example.Source: §3 · pp. 2–3
- For each sample, the method substitutes causal terms with antonyms and assigns the counterfactual sample the opposite label, aiming to balance non-causal terms across classes.The example changes “boring” to “interesting” while retaining “free.”Source: §3 · p. 3
4 Methods
The method identifies likely causal features through matching opposite-label documents, uses those features to generate antonym-substituted counterfactuals, and combines the generated data with the original training data. It evaluates closest-opposite-match scores as a signal for identifying causal terms.
4 Methods
- The two-stage method identifies likely causal features, generates counterfactual training data from them, and trains on the original and generated data together.It seeks a similar document without the candidate term and with the opposite label, then uses high-similarity matches as evidence of likely causal features.Source: §4 · p. 3
4.1 Identifying Likely Causal Features
- Terms whose closest opposite matches score above 0.95 are selected as likely causal terms.A match pairs documents with opposite labels and compares the semantic similarity of their contexts after removing the candidate terms.Source: §4 · p. 3, §4.1 · p. 3
- High closest-opposite-match scores align more reliably with human-annotated causal terms than high classifier coefficients do.The paper describes this pattern as high precision and low recall.Source: §4.1 · p. 3
4.2 Selecting Antonyms for Causal Terms
- Candidate antonyms must have coefficients opposite in sign to the causal term’s coefficient in the initial classifier.The search checks direct antonyms first and then searches antonyms of synonyms if needed.Source: §4.2 · p. 4
4.3 Generating Counterfactual Samples
- For each training document containing causal terms, the method substitutes antonyms and assigns the resulting counterfactual the opposite label.When a term has multiple candidate antonyms, one is chosen at random; documents without causal terms are not transformed.Source: §4.3 · p. 4
4.4 Training a Robust Text Classifier
- The original training data is augmented with automatically generated counterfactual data to train the robust classifier.The experiments investigate how the selected causal terms affect the quantity and quality of generated samples.Source: §4.4 · p. 4
5 Data
The study evaluates sentiment classification on IMDB and Amazon Kindle reviews, using human-generated counterfactual test samples to assess robustness. It also creates a short-sentence version of IMDB and annotates causal terms for evaluation.
5 Data
- The benchmark uses IMDB and Kindle sentiment datasets, each with human-generated counterfactual testing samples for evaluating classifier robustness.For Kindle, the authors manually edited 500 test samples into counterfactuals; the IMDB counterfactual data was collected by Kaushik, Hovy, and Lipton (2020).Source: §5 · pp. 4–5
- IMDB-S is created by splitting IMDB reviews into keyword-containing sentences and inheriting each sentence’s label from its source review.A manual check of 500 sentences found 96.8% label accuracy; the original long-review version is called IMDB-L.Source: §5 · p. 4
- Two student annotators labeled causal terms, with 96% raw agreement reported as an example of their generally high agreement.The authors note some subjectivity and report training annotators to resolve disagreements before annotation.Source: §5 · p. 5
- The initial-classifier coefficient thresholds for selecting top terms are 0.4 for IMDB-L and 1.0 for IMDB-S and Kindle.The thresholds differ by dataset and are used to select top terms.Source: §5 · p. 5
6 Experiments and Discussion
Across sentiment datasets, counterfactual augmentation improves robustness to human-generated test edits, while analysis links the gains to greater emphasis on causal terms and reduced emphasis on non-causal terms.
6.1 Causal term identification
- At a 0.95 matching-score threshold, causal-term identification reaches 84% precision on IMDB-L/IMDB-S and 83% on Kindle.The threshold identifies 32 terms across IMDB-L and IMDB-S, and 23 for Kindle.Source: §6.1 · p. 5
6.2 Robust classification for counterfactual test data
- Original-only classifiers lose 20.1%, 10.6%, and 37.4% accuracy on counterfactual tests for IMDB-L, IMDB-S, and Kindle, respectively.The authors attribute this decline to spurious correlations that do not generalize to counterfactual test data.Source: §6.2 · p. 5
- Automatic causal-term augmentation improves counterfactual-test accuracy across all datasets by 13%, 5.5%, and 11%, respectively.Using all causal terms, the approach performs comparably to a baseline requiring humans to edit more than 1K counterfactual samples.Source: §6.2 · p. 5, Table 4 · p. 6
6.3 Alternative experiments
- Across experiments, logistic-regression approaches show similar relative-accuracy trends; downsampling augmented training data to original-data size changes accuracy by <0.04, and L2 regularization yields only minor counterfactual-test accuracy differences.The logistic-regression L2 experiments used C values 0.01, 0.1, 1, 10, and 100.Source: §6.3 · p. 6
6.4 Performance change with different number of human annotated causal terms
- Performance seems to plateau after about 100 annotated causal terms, comparable to creating more than 1K human-generated counterfactual training samples.The authors suggest later terms are infrequent or co-occur with other causal terms, yielding few new counterfactuals.Source: §6.4 · p. 6, Figure 2 · p. 6
6.5 Coefficient change for causal and non-causal terms
- Counterfactual augmentation reduces the magnitude of non-causal “free” while increasing the magnitude of causal terms such as “awesome” and “awful.”The generated positive-sentiment example with “free” helps mitigate its spurious association with negative sentiment.Source: §6.5 · p. 6, Table 5 · p. 7
6.6 Error analysis
- A corrected “Really good movie” prediction illustrates how increasing “good” and decreasing spuriously correlated “movie” can reverse an error.The original classifier was misled by “movie,” which correlates with low ratings in the data.Source: §6.6 · pp. 6–7, Table 6 · p. 7
- Which coefficient shift matters more for corrected predictions varies by dataset: causal-term increases dominate for IMDB-L, while non-causal-term decreases dominate for the other two.Although causal terms tend to receive larger individual increases, the greater frequency of non-causal terms can give their changes greater overall impact.Source: §6.6 · p. 7, Table 7 · p. 7
7 Conclusion and Future Work
The conclusion presents a framework for generating counterfactual training samples from causal terms and training with them alongside original data. It reports comparable performance with enough annotated terms and identifies extensions for future work.
- The framework identifies causal terms, generates counterfactual training samples, and combines them with original data to train a robust classifier.The conclusion says robustness can improve even with few causal terms.Source: §7 · p. 7
- Annotating about 100 causal terms in the experiments can yield performance comparable to using human-generated counterfactuals.Source: §7 · p. 7
- Future work could improve causal-term identification precision and recall or extend the framework to topic classification by generalizing antonym-like substitutions.For topic changes, the conclusion suggests substituting topic-related terms with terms unrelated to the current topic or related to other topics.Source: §7 · p. 7
A Appendix
The appendix section introduces supplemental information.
- The appendix section provides supplemental information.Source: A Appendix · p. 9
A.1 Results using neural network models
The appendix evaluates an LSTM classifier and reports trends similar to logistic regression when counterfactual data is added.
A.1 Results using neural network models
- With LSTM, augmenting training with counterfactual data across increasing human-supervision levels shows trends similar to logistic regression.Baseline accuracies are within 0.05 across the three test datasets; Kindle counterfactual testing gains about 0.12 improvement in one exception.Source: §A.1 · p. 9, Table 8 · p. 9
A.2 Regularization
The study tests whether L2 regularization improves LogisticRegression robustness. Careful tuning of C yields only minor improvements, which the authors attribute to highly class-correlated spurious features.
A.2 Regularization
- L2 regularization tuning improves accuracy by only within 0.02, and does not sufficiently reduce the impact of highly class-correlated spurious features.The experiments vary C across 0.01, 0.1, 1, 10, and 100.Source: §A.2 · p. 9, Table 9 · p. 9
- The experiment varies LogisticRegression's L2 regularization strength through C values of 0.01, 0.1, 1, 10, and 100.Source: §A.2 · p. 9
- The authors explain that regularization cannot sufficiently reduce spurious-feature impact when those features are highly correlated with classes.Source: §A.2 · p. 9
A.3 Control the size of training data
The authors control for training-set size by downsampling augmented data to match the original set. Counterfactual training retains its robustness benefit, with accuracy changing only slightly from the uncontrolled results.
A.3 Control the size of training data
- The authors downsample augmented training data to match the original training-set size, isolating the effect of data volume on performance.Source: §A.3 · pp. 9–10
- Within 0.04 of Table 4, controlled-size results preserve the overall trend that counterfactual training improves classifier robustness.Table 10 reports classification accuracy after downsampling augmented data to the original training-set size.Source: §A.3 · p. 10, Table 10 · p. 10
- Compared with Table 4, controlled-size results show only minor accuracy changes while retaining the same overall robustness trend.Source: §A.3 · p. 10, Table 10 · p. 10