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 become the backbone of decision-making—from chatbots to sentiment analysis—the "black-box" nature of these systems creates a significant trust gap. While existing tools can highlight which words were important for a specific prediction (feature attribution), users often require recourse: an understanding of what specific changes would be necessary to achieve a different outcome. Generating these "counterfactual" or "contrastive" explanations for text is notoriously difficult; random edits often result in gibberish, while excessive changes cause the explanation to lose focus. Existing methods often produce edits that flip a label but lack a clear semantic theme, leaving users confused about the underlying logic of the model.

The CAT Framework

To address these challenges, we introduce CAT (Contrastive Attributed explanations for Text), a framework that treats explanation generation as a constrained optimization problem. CAT ensures that edits are not only minimal and fluent but also semantically meaningful by attributing changes to specific high-level topics.

Overview of the CAT framework architecture.

The CAT process follows three primary stages:

  1. Search for Importance: The system utilizes Integrated Gradients to identify the specific tokens in the original text most responsible for the current model prediction.
  2. Minimal Perturbation: These important words are masked, and a pre-trained BERT model is employed to suggest fluent replacements, insertions, or deletions.
  3. The Attributed Objective Function: This core innovation selects the optimal replacement by balancing four factors: a Contrastive Score (ensuring the label flips), Fluency (maintaining natural language), Proximity (minimizing Levenshtein distance), and Attribute Change (ensuring the edit corresponds to a meaningful shift in subtopics).

To power the attribute-driven search, the framework incorporates 42 separate binary classifiers trained on external datasets (Huffpost News and 20 Newsgroups). These classifiers recognize topics such as Politics, Medicine, or Cryptography, guiding the search toward edits that represent clear semantic shifts rather than nonsensical "adversarial" changes.

Experimental Setup

CAT was evaluated across four diverse benchmarks: AgNews (news topic classification), DBPedia (Wikipedia ontology), Yelp (sentiment analysis), and NLI (Natural Language Inference). A key advantage of the CAT approach is its transferability; the attribute classifiers do not need to be trained on the same data as the black-box model being explained. For instance, attributes learned from news data can effectively explain models trained on Wikipedia or legal documents.

Key Results

In quantitative evaluations, CAT achieved a 100% flip rate across all datasets, consistently finding edits that changed the model's prediction. It outperformed state-of-the-art methods like GYC and MICE in both fluency and content preservation while requiring a lower edit distance. Furthermore, CAT proved to be approximately 4.5x faster than GYC.

Human accuracy and qualitative evaluation results across two user studies.

Human-centric evaluations further validated the framework's effectiveness. In a study involving 75 participants, users shown CAT's attributed explanations were significantly more accurate at predicting the black-box model's behavior compared to those using baseline methods. Qualitatively, users rated CAT higher in terms of completeness, sufficiency, and overall understandability, confirming that attributing edits to specific semantic themes provides a more intuitive mental model of the classifier.

Conclusion and Future Work

CAT demonstrates that contrastive explanations are most effective when they are grounded in human-understandable attributes. While the framework's performance is currently tied to the quality of its attribute classifiers, it opens new avenues for generating Counterfactually Augmented Data (CAD) to train more robust, less biased models. Future work will focus on expanding the attribute vocabulary and refining the optimization process to ensure even more diverse and global contrasts.

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