Learning the Difference that Makes a Difference with Counterfactually-Augmented Data

Divyansh Kaushik, Eduard Hovy, Zachary C. Lipton

TL;DR

This paper introduces a human-in-the-loop method to break "spurious correlations" in NLP models by using counterfactually-augmented data. By tasking humans to minimally edit documents to flip their labels (e.g., turning a negative review positive), the authors create datasets that force models to learn causal features rather than accidental statistical shortcuts, resulting in significantly more robust classifiers.

What Problem Does This Paper Address?

Standard machine learning is associative: it identifies features that are predictive of a label. However, these associations are often "spurious"—they work in one dataset but fail in the real world because they aren't actually the cause of the label.

For example, if a sentiment analysis dataset contains many poorly reviewed horror movies, a model might learn that the word "horror" implies a negative sentiment. In reality, "horror" is just a genre, not a sentiment. The authors argue that while statistical frameworks struggle to define "spuriousness," the language of causality provides a fix: a feature is spurious if intervening on it doesn't actually change the label. The challenge is that we lack automated tools to disentangle these factors in raw text.

Methods

The authors propose a human-in-the-loop pipeline to generate counterfactual examples. Instead of just asking crowd workers to label new data, they ask them to edit existing data to match a new, "counterfactual" target label.

Figure 1: Pipeline for collecting and leveraging counterfactually-altered data

The process follows a "least action principle":

  1. Flip the Label: Given a document (e.g., a negative movie review) and its label, the worker is told the new target label (Positive).
  2. Minimal Edits: The worker must revise the text so it fits the new label while remaining coherent and making as few changes as possible.
  3. Verification: A separate set of workers verifies the new label-text pairs.

This approach ensures that the only things changing are the features that actually determine the label, effectively "breaking" the connection between the label and spurious background features like genre or specific nouns.

Figure 2: Annotation platform for collecting counterfactually annotated data for sentiment analysis

Datasets

The authors applied this method to two major NLP benchmarks:

  • IMDb (Sentiment Analysis): They sampled 2,500 reviews and created counterfactual counterparts.
  • SNLI (Natural Language Inference): They sampled pairs of premises and hypotheses, asking workers to modify either the premise or the hypothesis to change the relationship (Entailment, Contradiction, or Neutral).

The resulting "Counterfactually-Augmented Data" (CAD) is released publicly as an extension to these standard resources.

Key Insights and Ideas

  • The "OOD" Failure: Classifiers trained only on original data perform terribly on the revised data (and vice versa). For example, a Bi-LSTM trained on original IMDb reviews dropped from 79.3% to 55.7% accuracy when tested on the counterfactual versions. This proves the models were relying heavily on non-causal shortcuts.
  • Breaking Spurious Weights: In original datasets, words like "horror" or "romantic" often appear as top predictors for sentiment. By adding counterfactuals, these words appear equally with both positive and negative labels, forcing the model to ignore them and focus on actual sentiment-bearing words like "fascinating" or "boring."
  • The Power of Combined Training: Training on a mix of original and counterfactual data yields models that are nearly as accurate as specialized ones but far more robust across different domains.
  • BERT's Resilience: While all models suffered, BERT was notably more resilient to spurious patterns than simpler architectures like SVMs or Bi-LSTMs, likely due to its massive pre-training.
Figure 4: Thirty most important features learned by an SVM classifier trained on TF-IDF bag of words. Note how the combined dataset (c) removes spurious genre-related features.

Key Results

  • Sentiment Analysis: Models trained on the combined (Original + Revised) dataset achieved high accuracy on both types of data (e.g., 88.7% on original and 79.5% on revised for a Bi-LSTM).
  • Out-of-Domain Generalization: Models trained on the augmented IMDb data performed better when tested on entirely different datasets like Amazon reviews, Yelp, and Twitter sentiment, proving that learning "causal" features helps models generalize.
  • NLI Robustness: For Natural Language Inference, fine-tuning BERT on the combined dataset significantly improved performance on revised premises and hypotheses, where original models previously suffered a 30+ point drop in accuracy.

Limitations and Future Work

  • Scalability and Cost: The primary limitation is the cost and effort of human editing. While more effective than simple labeling, it is more time-consuming for crowd workers.
  • Complexity of Tasks: The authors focused on sentiment and NLI. They suggest that future work should explore whether this "difference that makes a difference" approach can scale to more complex generative tasks like question answering and summarization.
  • Human Bias: While the method breaks dataset-specific spurious correlations, it still relies on human intuition of what "matters," which might introduce its own set of biases.

Summary updated

BibTeX
@inproceedings{kaushik2020learning,
  author = {Divyansh Kaushik and Eduard Hovy and Zachary C. Lipton},
  title = {{Learning the Difference that Makes a Difference with Counterfactually-Augmented Data}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
}
Figure