Source-linked AI summary

Counterfactual Fairness in Text Classification through Robustness

Sahaj Garg, Vincent Perot, Nicole Limtiaco, Ankur Taly, Ed H. Chi, Alex Beutel

arXiv:1809.10610v2cs.LGstat.ML

TL;DR

Text classifiers can change predictions when identity tokens change, creating a counterfactual fairness problem. The paper defines counterfactual token fairness, proposes blindness, counterfactual augmentation, and counterfactual logit pairing, and evaluates their accuracy and group-fairness tradeoffs. Blindness and CLP address counterfactual token fairness without overall accuracy costs, while asymmetric counterfactuals limit when equal predictions are appropriate.

  • Problem

    Text classifiers may assign different predictions to nearly identical sentences that reference different identity groups, motivating counterfactual fairness for individual token substitutions.

  • Method

    The paper defines counterfactual token fairness and studies blindness, counterfactual augmentation, and counterfactual logit pairing, including group-fairness evaluation through TPR and TNR gaps.

  • Results

    Blindness and CLP address counterfactual token fairness, generalize better to held-out tokens in the case of CLP, and do not harm overall classifier accuracy.

  • Takeaways & Limitations

    Robustness-based training provides a path for improving identity-token fairness while preserving overall accuracy, with varying tradeoffs involving group fairness.

  • Takeaways & Limitations

    The approach is limited because some identity-token counterfactuals are asymmetric, making equal predictions potentially harmful to more vulnerable groups.

Abstract

from arXiv · show

In this paper, we study counterfactual fairness in text classification, which asks the question: How would the prediction change if the sensitive attribute referenced in the example were different? Toxicity classifiers demonstrate a counterfactual fairness issue by predicting that "Some people are gay" is toxic while "Some people are straight" is nontoxic. We offer a metric, counterfactual token fairness (CTF), for measuring this particular form of fairness in text classifiers, and describe its relationship with group fairness. Further, we offer three approaches, blindness, counterfactual augmentation, and counterfactual logit pairing (CLP), for optimizing counterfactual token fairness during training, bridging the robustness and fairness literature. Empirically, we find that blindness and CLP address counterfactual token fairness. The methods do not harm classifier performance, and have varying tradeoffs with group fairness. These approaches, both for measurement and optimization, provide a new path forward for addressing fairness concerns in text classification.

Introduction

The paper targets counterfactual fairness in text classification, where changing an identity token can change predictions for otherwise similar sentences. It introduces a metric and three training approaches, while examining accuracy, group-fairness tradeoffs, and asymmetric counterfactuals.

  • Identity tokens such as “gay” can produce high false-positive toxicity predictions because they appear frequently in toxic training examples.
  • A baseline model predicts “Some people are gay” as 98% toxic but “Some people are straight” as only 2% toxic.
  • Counterfactual fairness compares predictions for individual examples after changing the referenced sensitive attribute, unlike group-based statistical fairness criteria.
  • Counterfactual token fairness measures prediction changes caused by substituting identity tokens such as “gay” and “straight,” though it captures only a subset of general counterfactual fairness.
  • Some token substitutions are asymmetric because identity can affect toxicity or vulnerability, so enforcing identical predictions may harm the more vulnerable group.
  • The paper studies blindness, counterfactual augmentation, and counterfactual logit pairing as methods for addressing counterfactual token fairness.
  • The methods do not significantly harm accuracy, but their effects on group fairness vary through tradeoffs between true negatives and true positives.

Related Work

Related work distinguishes observational group-fairness criteria from counterfactual and robustness-based approaches. The paper connects these traditions to identity-token substitutions in text classification.

  • Counterfactual fairness evaluates text by intervening on sensitive attributes, while group fairness evaluates statistical relationships involving group membership, labels, and predictions.
  • Group-fairness criteria include demographic parity and equality of odds, but observational criteria cannot distinguish some reasonable from unreasonable uses of identity.
  • Prior debiasing methods address group fairness through score recalibration, fair representations, data rebalancing, and gender-term augmentation.
  • Text robustness research generates adversarial examples through editing methods including translation, attribution-based edits, and autoencoders.
  • Related work connects fairness, text generation, and robustness by modeling confounding attributes or editing gender representations.

Problem Definition

The paper defines counterfactual fairness for text classifiers through generated examples that perturb sensitive attributes, then specializes it to identity-token substitutions. It also bounds the metric’s scope and recognizes that symmetric predictions are not always appropriate.

  • The task is binary text classification: a classifier fθ maps a token sequence x to a prediction ŷ while minimizing prediction error.
  • Counterfactual fairness requires predictions for generated counterfactuals Φ(x) to remain within a specified error while maintaining model performance.
  • Counterfactual Token Fairness (CTF): For identity tokens a and a′, Φa,a′ substitutes all occurrences of one token with the other and returns no counterfactual when neither appears.
  • Counterfactual Token Fairness (CTF): Counterfactual token fairness requires counterfactual fairness with respect to the generation function ΦA over a specified set of identity tokens A.
  • Counterfactual Token Fairness (CTF): The metric captures a subset of problematic counterfactual-fairness issues involving sensitive-group content rather than the full semantic space.
  • Asymmetric Counterfactuals: Equal predictions are inappropriate for asymmetric counterfactuals where identity affects toxicity or vulnerability, and the framework can exclude such pairs through Φ(x).
  • Counterfactual fairness complements equality of odds because a classifier may satisfy one notion while failing the other.

Methods

The paper proposes three methods for improving counterfactual fairness: blindness, counterfactual augmentation, and counterfactual logit pairing. These methods use identity-token counterfactuals to encourage fairer predictions, with CLP adding a tunable robustness objective.

  • The paper proposes blindness, counterfactual augmentation, and counterfactual logit pairing to improve counterfactual fairness.
  • Blindness: Blindness replaces every identity token with a special IDENTITY token, preserving identity presence while removing identity-specific information.
  • Counterfactual Augmentation: Counterfactual augmentation adds generated counterfactual examples to the training set and assigns them the original examples’ labels.
  • Counterfactual Logit Pairing: Counterfactual logit pairing adds a robustness term that penalizes absolute logit differences between inputs and their counterfactuals.
  • Counterfactual Logit Pairing: During training, CLP randomly samples one counterfactual for each input and combines the robustness term with the original loss.
  • Counterfactual Logit Pairing: CLP can use restricted or sophisticated counterfactual generators, while λ tunes the degree of counterfactual fairness.

Experiments

The experiments evaluate counterfactual token fairness, generalization, accuracy, and group-fairness tradeoffs for blindness, counterfactual augmentation, and counterfactual logit pairing (CLP). Blindness and sufficiently regularized CLP reduce CTF gaps, but generalization and asymmetric counterfactuals expose important tradeoffs.

  • Experimental setup: The study uses 50 identity terms, splitting 35 for training and 12 for hold-out evaluation, while also testing three bigrams and synthetic inputs.CNN toxicity classifiers are trained with cross-entropy; models are averaged over ten runs, with CLP varying only its fairness regularizer λ.
  • Counterfactual token fairness: Blindness achieves zero CTF gaps by design, while CLP with λ ≥1 reaches near-zero gaps on non-toxic and synthetic examples.Counterfactual augmentation reduces gaps relative to baseline but does not reach zero; the synthetic models were not trained on synthetic data.
  • Generalization: CLP with λ = 5 generalizes best to hold-out identity terms, although its gaps remain much larger than on training terms; blindness shows no generalization benefit.A model is counted as generalizing when its hold-out gap is below the baseline gap of 0.091.
  • Overall performance: 0.962-0.964: all methods produce consistent test-set ROC AUC, indicating no substantial accuracy harm across the evaluated approaches.The reported range covers blindness, counterfactual augmentation, CLP variants, and the baseline.
  • Error analysis: Methods that reduce CTF gaps improve true-negative identification but worsen true-positive identification, especially for toxic examples with asymmetric counterfactuals.The analysis attributes a large portion of the TPR loss to toxic examples whose toxicity depends on a specific identity term.
  • Group fairness: Counterfactual augmentation and CLP with λ = 0.05 improve both TPR and TNR gaps over baseline, whereas CLP with λ ≥1 substantially improves TNR gaps while harming TPR gaps.The results support choosing λ according to the task’s relative priorities among CTF, TPR, and TNR.

Conclusions and Future Work

The paper advances counterfactual token fairness for text classification and reports that counterfactual logit pairing generalizes better to held-out identity tokens without reducing overall accuracy. Future work focuses on identifying asymmetric counterfactuals and improving counterfactual generation.

  • Conclusions: Counterfactual logit pairing optimizes robustness to different identity tokens and generalizes better to held-out tokens than blindness while preserving overall accuracy.The paper reports varying tradeoffs between false positives and false negatives.
  • Future Work: Asymmetric counterfactuals limit fairness training and evaluation because token substitutions may legitimately require different predictions.Examples include stereotypes associated with one group and comments targeting particularly vulnerable groups.
  • Future Work: Future work should improve counterfactual generation for polysemous identity terms, asymmetric counterfactuals, and multiple references to one identity group.Suggested directions include word-vector analogies and generative models that modify selected text attributes.

Appendix

The appendix includes tables reporting CTF gaps for toxic examples and toxicity scores for counterfactuals across different models and identity tokens.

  • Table 4: Table 4 reports CTF gaps on toxic evaluation examples for both training terms and held-out terms.
  • Table 5: Table 5 lists counterfactuals and toxicity scores for different models, using four training identity tokens and one held-out token.
Loading 1809.10610v2…