Table of Contents
Fetching ...

A Comparative Analysis of Counterfactual Explanation Methods for Text Classifiers

Stephen McAleese, Mark Keane

TL;DR

Five methods for generating counterfactual explanations for a BERT text classifier on two datasets using three evaluation metrics suggest that established white-box substitution-based methods are effective at generating valid counterfactuals that change the classifier's output.

Abstract

Counterfactual explanations can be used to interpret and debug text classifiers by producing minimally altered text inputs that change a classifier's output. In this work, we evaluate five methods for generating counterfactual explanations for a BERT text classifier on two datasets using three evaluation metrics. The results of our experiments suggest that established white-box substitution-based methods are effective at generating valid counterfactuals that change the classifier's output. In contrast, newer methods based on large language models (LLMs) excel at producing natural and linguistically plausible text counterfactuals but often fail to generate valid counterfactuals that alter the classifier's output. Based on these results, we recommend developing new counterfactual explanation methods that combine the strengths of established gradient-based approaches and newer LLM-based techniques to generate high-quality, valid, and plausible text counterfactual explanations.

A Comparative Analysis of Counterfactual Explanation Methods for Text Classifiers

TL;DR

Five methods for generating counterfactual explanations for a BERT text classifier on two datasets using three evaluation metrics suggest that established white-box substitution-based methods are effective at generating valid counterfactuals that change the classifier's output.

Abstract

Counterfactual explanations can be used to interpret and debug text classifiers by producing minimally altered text inputs that change a classifier's output. In this work, we evaluate five methods for generating counterfactual explanations for a BERT text classifier on two datasets using three evaluation metrics. The results of our experiments suggest that established white-box substitution-based methods are effective at generating valid counterfactuals that change the classifier's output. In contrast, newer methods based on large language models (LLMs) excel at producing natural and linguistically plausible text counterfactuals but often fail to generate valid counterfactuals that alter the classifier's output. Based on these results, we recommend developing new counterfactual explanation methods that combine the strengths of established gradient-based approaches and newer LLM-based techniques to generate high-quality, valid, and plausible text counterfactual explanations.

Paper Structure

This paper contains 14 sections, 1 equation, 2 figures, 2 tables.

Figures (2)

  • Figure 1: An example of a counterfactual explanation.
  • Figure 2: Figure illustrating the results of our comparative analysis. Error bars are bootstrapped 95% confidence intervals.