Skip to main content
QUICK REVIEW

[Paper Review] Generate Your Counterfactuals: Towards Controlled Counterfactual Generation for Text

Nishtha Madaan, Inkit Padhi|arXiv (Cornell University)|Dec 8, 2020
Topic Modeling30 citations
TL;DR

We introduce GYC, a GPT-2–based framework that generates plausible, diverse, goal-oriented, and effective counterfactual text samples, controllable via user-defined conditions like NER, SRL, or sentiment, and evaluated across multiple domains.

ABSTRACT

Machine Learning has seen tremendous growth recently, which has led to larger adoption of ML systems for educational assessments, credit risk, healthcare, employment, criminal justice, to name a few. The trustworthiness of ML and NLP systems is a crucial aspect and requires a guarantee that the decisions they make are fair and robust. Aligned with this, we propose a framework GYC, to generate a set of counterfactual text samples, which are crucial for testing these ML systems. Our main contributions include a) We introduce GYC, a framework to generate counterfactual samples such that the generation is plausible, diverse, goal-oriented, and effective, b) We generate counterfactual samples, that can direct the generation towards a corresponding condition such as named-entity tag, semantic role label, or sentiment. Our experimental results on various domains show that GYC generates counterfactual text samples exhibiting the above four properties. GYC generates counterfactuals that can act as test cases to evaluate a model and any text debiasing algorithm.

Motivation & Objective

  • Motivate trustworthiness of NLP systems by producing test-cases that reveal fairness and robustness gaps.
  • Propose a framework (GYC) to generate counterfactual text that is plausible, diverse, goal-oriented, and effective.
  • Enable conditioning of counterfactual generation on specific attributes (e.g., NER, SRL, sentiment) and allow plug-in of custom condition models.
  • Demonstrate that GYC can generate high-quality counterfactuals without retraining, and evaluate its usefulness for testing and debiasing.

Proposed method

  • Reconstruct the input text x by learning perturbations that maximize the log-likelihood of x (proximity loss) to ensure content preservation.
  • Introduce a conditioned perturbation H_t to generate counterfactuals that satisfy a given condition, and sample y_t autoregressively using a GPT-2 decoder.
  • Handle differentiable and non-differentiable condition signals with a differentiable score loss or REINFORCE-based reward training.
  • Incorporate a diversity loss via entropy over the logits of multiple generated samples to avoid mode collapse.
  • Combine losses into L = lambda_r L_r + lambda_H L_H + lambda_p L_p with curriculum/annealing to stabilize training.
  • Leverage pre-trained GPT-2 without re-training the model itself, enabling plug-and-play conditioning with an auxiliary condition model.

Experimental results

Research questions

  • RQ1How can we generate counterfactual text that remains plausible and diverse while flipping a target attribute?
  • RQ2Can counterfactual generation be directed toward specific conditions (e.g., NER, SRL, sentiment) using additional models without re-training the generator?
  • RQ3What learning signals (differentiable scores vs. reinforcement learning rewards) effectively guide generation toward the desired condition?
  • RQ4How does GYC perform on label-flip, diversity, content preservation, and syntactic structure across multiple domains?

Key findings

  • GYC generates counterfactual text samples with high potential to flip the target label across datasets.
  • GYC achieves strong diversity while preserving content and syntactic structure compared with baselines.
  • Human evaluation indicates GYC produces more plausible and grammatically correct counterfactuals than baselines.
  • GYC can incorporate different condition models (e.g., sentiment classifiers, NER, SRL) and does not require re-training of GPT-2.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.