Explaining text classifiers through progressive neighborhood approximation with realistic samples

Yi Cai, Arthur Zimek, Eirini Ntoutsi, Gerhard WunderarXiv 2023 · DOI

Abstract

Local model-agnostic explanations for text classifiers, such as LIME, often suffer from "spongy" neighborhoods created by random word deletion. These out-of-distribution samples lead to unreliable surrogate models. This paper introduces XPROA and XPROB, two methods that generate realistic neighboring samples through latent space interpolation and probability-based editing. By ensuring synthetic samples remain on the data manifold, these approaches provide more faithful, stable, and human-interpretable explanations of black-box model decisions.

Introduction

To understand why a complex Deep Neural Network (DNN) classifies a text as "negative," researchers typically use local surrogate models. These surrogates mimic the black box's behavior within a small "neighborhood" of the target instance. However, standard text perturbation methods—like randomly deleting words—often produce ungrammatical fragments that the black box was never trained to handle. This paper addresses this gap by proposing methods to construct neighborhoods using semantically meaningful and grammatically correct samples.

Methodology

The authors propose two distinct approaches to neighborhood construction, moving away from random sampling toward structured approximation.

XPROA: Progressive Neighborhood Approximation

XPROA (local eXplainer with PROgressive neighborhood Approximation) utilizes a Denoising Adversarial Autoencoder (DAAE) to map text into a continuous latent space. The core of XPROA is a two-stage interpolation process designed to "scout" the decision boundary effectively.

Algorithm 2: The two-stage interpolation process used by XPROA to generate realistic neighbors in latent space.

As shown in the algorithm above, XPROA first identifies "landmarks" (real-world counterfactuals) and then performs a dual interpolation: first between landmarks to explore the general space, and second between those points and the target instance to find the precise transition point where the model's prediction flips.

XPROB: Probability-Based Edition

To avoid the potential opacity of a generative model, the authors developed XPROB. This method uses simple n-gram probabilities to iteratively edit "prototype" sentences. By swapping or inserting words that are contextually appropriate, XPROB creates a path of realistic neighbors that gradually transform a counterfactual into the target text without requiring a neural generator.

Experimental Setup

The methods were evaluated on two sentiment analysis benchmarks: Yelp Reviews and Amazon Review Polarity. The researchers utilized a downsampled external corpus of 20,000 instances to initialize the landmarks and prototypes used in the neighborhood search.

Table 1: Dataset statistics, black-box model accuracies, and DAAE reconstruction loss.

As seen in Table 1, the generative DAAE achieved low reconstruction loss ($\mathcal{L}_{rec}$), a critical requirement for ensuring that latent space interpolations correspond to meaningful text.

Key Results and Insights

  • Correctness and Fidelity: XPROA achieved $R^2$ scores as high as 0.928, significantly outperforming LIME. This indicates that the surrogate model built on realistic neighbors is a much more accurate reflection of the underlying black box.
  • Stability: XPROB proved to be the most stable method, providing consistent explanations for semantically similar inputs. In contrast, LIME's explanations often fluctuated wildly with minor phrasing changes.
  • Intrinsic vs. Extrinsic Words: Unlike traditional methods that only rank words present in the original sentence, XPROA and XPROB can identify "extrinsic" words—terms not in the original text that would most effectively flip the model's prediction.
  • Efficiency: While XPROA provides high fidelity, XPROB offers a faster, more transparent alternative by avoiding the computational overhead of neural text generation.

Conclusion

By shifting from random word-dropping to progressive neighborhood approximation, XPROA and XPROB bridge the gap between synthetic perturbations and real-world data. These methods ensure that explanations are grounded in realistic text, leading to higher trust and better diagnostic utility for complex NLP models.

Summary updated

BibTeX
@misc{cai2023explaining,
  author = {Yi Cai and Arthur Zimek and Eirini Ntoutsi and Gerhard Wunder},
  title = {{Explaining text classifiers through progressive neighborhood approximation with realistic samples}},
  year = {2023},
  eprint = {2302.07733},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.07733},
}
Figure