Explaining Text Classifiers with Counterfactual Representations

Pirmin Lemberger, Antoine Saillenfest
2/1/2024
cs.LGcs.CL

No official code found. Best implementation: ToineSayan/counterfactual-representations-for-explanation (1 star, PyTorch, last commit 2025-01-13).

Abstract

One well motivated explanation method for classifiers leverages counterfactuals which are hypothetical events identical to real observations in all aspects except for one feature. Constructing such counterfactual poses specific challenges for texts, however, as some attribute values may not necessarily align with plausible real-world events. In this paper we propose a simple method for generating counterfactuals by intervening in the space of text representations which bypasses this limitation. We argue that our interventions are minimally disruptive and that they are theoretically sound as they align with counterfactuals as defined in Pearl's causal inference framework. To validate our method, we conducted experiments first on a synthetic dataset and then on a realistic dataset of counterfactuals. This allows for a direct comparison between classifier predictions based on ground truth counterfactuals - obtained through explicit text interventions - and our counterfactuals, derived through interventions in the representation space. Eventually, we study a real world scenario where our counterfactuals can be leveraged both for explaining a classifier and for bias mitigation.

View on arXivView PDF

Code Implementations(1)

PyTorch

Pytorch implementation of 'Explaining text classifiers with counterfactual representations' (Lemberger & Saillenfest, 2024), ECAI 2024 - 27th European conference on AI

10PythonFeb 1, 20241 years ago
bias-correctionbias-detectionbias-mitigationbias-reductioncausality+7 more

Similar Papers

Cite this paper

@article{lemberger2024explaining,
  title  = {Explaining Text Classifiers with Counterfactual Representations},
  author = {Pirmin Lemberger and Antoine Saillenfest},
  year   = {2024},
  eprint = {2402.00711},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.00711v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.00711.svg)](https://codeofpaper.com/paper/2402.00711)

Discussion