TL;DR
Minimal Contrastive Editing (MiCE) is a novel framework that explains NLP model predictions by generating the smallest possible fluent edits to an input that flip the model's output to a specific alternative (the "contrast case"). By answering "Why $p$ instead of $q$?", MiCE provides human-like explanations that help developers debug incorrect model behavior and uncover hidden dataset biases.
What Problem Does This Paper Address?
Most current NLP explanation methods, such as saliency maps or rationales, focus on identifying which parts of an input were "important" for a prediction. However, cognitive science suggests that human explanations are naturally contrastive: we don't just ask "Why did this happen?", but "Why did this happen instead of that?".
Existing methods often fail to provide this contrastive context. Furthermore, many current techniques for generating counterfactuals (alternative inputs) rely on manually curated rules or produce text that is either non-fluent or requires changing large portions of the input, making the explanation hard to interpret. MiCE aims to bridge this gap by automatically generating targeted, minimal, and fluent edits.
Methods
MiCE employs a two-stage approach to generate these explanations:
- Stage 1: Training the EDITOR. The authors fine-tune a pre-trained T5 model (the "EDITOR") to perform targeted span infilling. During training, they use gradient attribution to identify tokens most responsible for a prediction, mask them, and train the EDITOR to reconstruct them given the original label. This teaches the EDITOR to associate specific text changes with specific output labels.
- Stage 2: Finding the Minimal Edit. To explain a specific prediction, MiCE searches for the smallest edit that flips the output to a target contrast label. It uses binary search to find the optimal percentage of tokens to mask and beam search to generate and rank candidate edits from the EDITOR. The goal is to find an edit $e(x)$ such that the predictor's output flips to the contrast case while minimizing the Levenshtein distance from the original input.
Datasets
The authors evaluated MiCE across three distinct English-language tasks:
- IMDB: Binary sentiment classification of movie reviews.
- NEWSGROUPS: A 6-class version of the 20 Newsgroups topic classification task.
- RACE: A complex multiple-choice question-answering dataset.
Key Insights and Ideas
- Contrastivity is Context-Dependent: The explanation for why a model didn't pick "Choice A" should be different from why it didn't pick "Choice B." MiCE successfully generates different edits for different contrast cases.
- Gradient Masking is Essential: Using gradient information to decide which tokens to mask (Stage 1) significantly outperforms random masking, leading to more effective and minimal edits.
- Targeted Infilling Matters: Conditioning the EDITOR on the target label during both training and generation is crucial. Without this "signal," the model struggles to find edits that actually flip the prediction at low masking percentages.
- Artifact Discovery: MiCE can reveal "bugs" in models. For example, it showed that an IMDB classifier relied heavily on numerical ratings (e.g., "7/10") rather than the actual text of the review.
Key Results
MiCE achieved high performance across all metrics, as shown in the table below:
- Flip Rate: MiCE successfully flipped predictions in 91.5% to 100% of test instances across the three tasks.
- Minimality: On average, MiCE only needed to change 17% to 33% of the original tokens to achieve a flip.
- Fluency: The generated edits were highly fluent, with language modeling loss ratios near 1.0, meaning the edited text looked natural to a secondary model.
- Human Comparison: On the IMDB dataset, MiCE edits were found to be comparable in size and fluency to edits manually created by humans.
Limitations and Future Work
- Computational Cost: The search process in Stage 2 is expensive, requiring hundreds of forward and backward passes through the models to find the optimal minimal edit.
- Search Efficiency: The authors note that finding truly "minimal" edits in the massive search space of natural language remains an open challenge. Future work could focus on more efficient search algorithms.
- Strict Minimality: The current method doesn't strictly guarantee that no smaller subset of the edit would also flip the prediction; it only finds the best edit within its search parameters.
- Adversarial Risks: Like many interpretability tools, MiCE could potentially be repurposed by malicious actors to generate minimal adversarial attacks that fool classifiers while remaining fluent.
Summary updated