Let the CAT out of the bag: Contrastive Attributed explanations for Text

Saneem A. Chemmengath, Amar Prakash Azad, Ronny Luss, Amit Dhurandhar

Introduction

As deep learning models increasingly govern critical decision-making processes—ranging from recruitment filters to automated customer support—the demand for Explainable AI (XAI) has intensified. Contrastive (or counterfactual) explanations are particularly valuable, as they address the question: "What minimal change to the input would result in a different model prediction?"

In the context of text, providing such recourse is challenging because minor edits can easily compromise grammatical fluency or semantic coherence. This paper introduces CAT (Contrastive Attributed explanations for Text), a framework designed to generate counterfactuals that are not only minimal but also semantically meaningful through the use of high-level attribute classifiers.

Methodology

The CAT framework employs a multi-stage optimization process to derive explanations. The workflow begins with Importance Identification, utilizing Integrated Gradients to pinpoint tokens that most significantly influence the black-box model's current output. These tokens are then subjected to Masking and Infilling, where a pre-trained BERT language model suggests replacements that preserve sentence fluency.

The CAT framework architecture, illustrating the pipeline from input text to contrastive output via mask creation and infilling guided by attribute classifiers.

The core innovation of CAT lies in its Attribute Classifiers. The authors integrated 42 separate classifiers trained on external datasets (e.g., Huffpost, 20 Newsgroups) to detect latent subtopics such as "Politics," "Medicine," or "Space." The optimization objective seeks a candidate sentence that simultaneously flips the target model's prediction, alters a minimal yet significant set of semantic attributes, maintains high fluency, and minimizes the Levenshtein distance from the original input.

Experimental Setup

CAT was evaluated across four benchmark datasets: AgNews (news classification), DBPedia (ontology classification), Yelp (sentiment analysis), and NLI (Natural Language Inference). To ensure the robustness of the attribute-based approach, the attribute classifiers were trained on data distinct from the primary task datasets, demonstrating the transferability of high-level semantic concepts.

Results and Discussion

CAT was benchmarked against state-of-the-art methods, including GYC (Generate Your Counterfactuals) and MICE (Minimal Contrastive Editing).

Quantitative Performance

CAT achieved a near-perfect 100% flip rate across the majority of datasets, indicating superior reliability in finding counterfactual examples. Furthermore, it consistently outperformed baseline methods in terms of edit distance and content preservation, suggesting that the attribute-guided search effectively identifies the most efficient path to a prediction flip.

Human Evaluation

A user study involving 75 participants highlighted a strong preference for CAT's explanations. As shown in the evaluation metrics, participants found CAT's outputs significantly more helpful for predicting model behavior.

Human evaluation results across two user studies, showing CAT's superior performance in human accuracy (a, b) and qualitative metrics like completeness and understandability (c, d).

Qualitatively, CAT received higher ratings for understandability, sufficiency, and completeness. By bridging word-level edits with high-level attributes (e.g., identifying that a change in NLI entailment was driven by the removal of an "electronics" concept), CAT provides a more intuitive "why" for end-users and developers alike.

Conclusion

CAT represents a significant step forward in text XAI by moving beyond simple word swaps to attribute-level explanations. While challenges remain regarding hyperparameter tuning and computational overhead, the framework's modularity and high success rate make it a promising tool for developing more transparent and fair NLP systems. Future research will explore the use of CAT for counterfactual data augmentation to improve model robustness.

Summary updated

BibTeX
@inproceedings{chemmengath2022let,
  author = {Saneem A. Chemmengath and Amar Prakash Azad and Ronny Luss and Amit Dhurandhar},
  title = {{Let the CAT out of the bag: Contrastive Attributed explanations for Text}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.484},
}
Figure