Fair Text Classification via Transferable Representations

Thibaud Leteno, Michael Perrot, Charlotte Laclau, Antoine Gourru, Christophe Gravier

TL;DR

The authors introduce Wasserstein Fair Classification (WFC), a novel framework that uses the Wasserstein Dependency Measure to decouple target labels from sensitive attributes (like gender or race) in text classifiers. By utilizing a surrogate "demonic model" and domain adaptation, WFC achieves state-of-the-art group fairness without requiring sensitive attribute annotations on the target dataset during training—making it fully compliant with strict privacy regulations like GDPR.

What Problem Does This Paper Address?

Ensuring group fairness in Natural Language Processing (NLP) means preventing text classifiers from making predictions based on protected attributes such as gender, age, or ethnicity. Traditional debiasing methods face two major hurdles:

  1. The Differentiability Problem: Fairness constraints are usually defined on final "hard" model predictions. However, the argmax step used to generate these predictions is non-differentiable, making it difficult to train neural networks directly using standard gradient descent.
  2. The Privacy/Data Problem: Most fairness techniques require explicit sensitive attribute annotations during training. In the real world, privacy regulations (such as GDPR in Europe) strictly limit or outright forbid the collection of such demographic data.

This paper tackles both challenges simultaneously: providing strong mathematical fairness guarantees while removing the need for sensitive labels on the dataset you want to clean.

Methods

The authors propose Wasserstein Fair Classification (WFC), which relies on three core components:

  • Wasserstein Dependency Measure ($I_W$): Instead of Mutual Information, which is notoriously difficult to compute in deep learning, the authors use $I_W$ to measure and minimize the statistical dependence between classification representations and sensitive attributes.
  • The "Demonic Model": To bypass the lack of sensitive labels on the target dataset, they train a separate, frozen surrogate network (the demonic model) on an independent, fully annotated source dataset to learn what bias looks like.
  • Latent Space Optimization: To solve the non-differentiability problem, WFC minimizes the $I_W$ between the hidden latent representations of the classification network and the demonic network, rather than their final outputs. The authors mathematically prove that minimizing dependency in the latent space effectively upper-bounds the dependency of the final predictions.
  • Cross-Domain Adaptation: If the dataset used to train the demonic model differs significantly from the target dataset, WFC uses Wasserstein-distance-based domain adaptation to align the text embeddings, ensuring the demonic model can accurately flag bias in the new domain.
[Input Text] ---> [Text Encoder (BERT/Mistral)] ---> Latent Space (Zy) ---> Classifier ---> [Fair Prediction]
                                                          |
                                               (Minimize Wasserstein Distance)
                                                          |
[Proxy Data] ---> [Demonic Model]               ---> Latent Space (Za)

Datasets

The framework was evaluated using several widely recognized benchmarks:

  • Bias in Bios: A dataset of online biographies used to predict 28 occupations (target label) while ensuring fairness across genders (sensitive attribute).
  • Moji: A collection of tweets annotated for positive/negative sentiment (target label) and African American English (AAE) vs. Standard American English (SAE) dialects (sensitive attribute).
  • Equity Evaluation Corpus (EEC) & Marked Personas (MP): Synthetic and generated datasets used as source domains to train the demonic model for cross-domain transfer experiments.

Key Insights and Ideas

  • Fairness Transferability: You don't need to know the demographics of your users to build a fair model. WFC proves that bias-detection capabilities can be trained on simple, synthetic toy datasets and successfully transferred to complex, real-world target tasks.
  • The Latent Bounding Trick: By proving that latent space dependency acts as a mathematical upper bound for prediction dependency, the authors elegantly sidestep the non-differentiable argmax bottleneck that plagues other adversarial fairness methods.
  • Architecture Agnostic: WFC operates entirely on the embeddings generated by text models. It works equally well on traditional encoder-only models (BERT) and modern, massive decoder-based models (such as Mistral-7B/SFR-Embedding-2_R).

Key Results

  • Top-Tier Fairness-Utility Balance: On the Moji dataset, WFC achieved a Fairness score of 91.4 (outperforming all baselines including ADV and GATE) while maintaining a high balanced accuracy of 75.2%.
  • Excellent Cross-Domain Performance: When the demonic model was trained on completely different datasets (EEC or Marked Personas) and applied to Bias in Bios without seeing any target gender labels, WFC achieved a Distance To Optimum (DTO) score of 2.30, nearly identical to the in-domain baseline (2.22).
  • Decoder Robustness: When paired with state-of-the-art Mistral-7B embeddings, WFC successfully boosted fairness to 90.0% while incurring the smallest accuracy penalty among all tested debiasing methods.

Limitations and Future Work

  • Binary Restriction in Practice: While the mathematical theory supports multi-class and continuous sensitive attributes (like age), the empirical evaluation was limited to binary attributes (men vs. women, AAE vs. SAE) due to current dataset availability.
  • The Privacy-Fairness Paradox: The authors noted that tightening fairness constraints sometimes increased "leakage"—meaning the sensitive attributes actually became more recoverable from the model's internal states. Resolving this tension between privacy and fairness remains an open challenge.
  • Extension Beyond Classification: Future work includes adapting this transferable representation framework to regression tasks, unsupervised learning, and computer vision.

Summary updated

BibTeX
@article{leteno2025fair,
  author = {Thibaud Leteno and Michael Perrot and Charlotte Laclau and Antoine Gourru and Christophe Gravier},
  title = {{Fair Text Classification via Transferable Representations}},
  journal = {Journal of Machine Learning Research},
  year = {2025},
  url = {https://openreview.net/forum?id=VNj1eZIslY},
}
Figure