A Modularized Framework for Explaining Black Box Classifiers for Text Data

Mahtab Sarvmaili, Riccardo Guidotti, Anna Monreale, Amílcar Soares, Zahra Sadeghi, Fosca Giannotti, Dino Pedreschi, Stan Matwin

Abstract

Modern Natural Language Processing (NLP) often relies on complex "black box" models that, while accurate, lack transparency. Existing explanation frameworks like LIME and SHAP often produce unreliable results for text data by creating nonsensical input perturbations. This paper introduces DICTA, a modularized, model-agnostic framework that leverages linguistic ontologies to generate semantically sound local explanations. By identifying influential sentences and generating synthetic neighborhoods through WordNet-based variations, DICTA provides human-readable decision rules that maintain high fidelity to the original model's behavior.

Introduction

As deep learning architectures become the standard for NLP tasks, the need for interpretability has grown. When a model classifies a document—such as flagging a tweet as offensive or a review as negative—stakeholders need to understand the underlying reasoning. Current tools typically perturb inputs by deleting random words, which often results in "gibberish" sentences. This creates a distribution shift, leading to explanations that are statistically unfaithful to the model's actual training data. DICTA addresses this by ensuring that local perturbations remain linguistically and semantically plausible.

Methodology

DICTA (modularizeD model-agnostic framework for the explanatIon of black box Classifiers for Text dAta) operates through a three-stage pipeline designed to maximize both interpretability and linguistic integrity.

The DICTA framework architecture (a) and its comparative approach to word-level perturbations versus LIME and SHAP (b).
  1. Influential Sentence Extraction: To manage computational complexity, DICTA first identifies the most impactful sentences in a document. It calculates influence by measuring the drop in model confidence when specific sentences are removed.
  2. Semantic Neighborhood Generation: Instead of random deletion, DICTA uses WordNet to replace words in influential sentences with synonyms, antonyms, or definitions. This preserves grammatical structure and ensures the synthetic samples are "plausible" to the black-box model.
  3. Local Surrogate Training: A simple, interpretable Decision Tree is trained on this synthetic neighborhood. This allows the framework to output clear logic paths rather than abstract saliency scores.

Experimental Setup

The framework was evaluated across four sentiment analysis benchmarks: IMDB (movie reviews), Yelp (business reviews), Amazon (product reviews), and U.S. Airline Tweets. These datasets were tested against a variety of classifiers, including BiLSTM, BiGRU, CNN1d, and Random Forest models.

Key Insights: Rules Over Scores

A primary advantage of DICTA is its shift from saliency scores to explicit decision rules. While many explainers indicate that a word is "important," DICTA explains how it is important within a specific context. For example, a decision rule might state: "If 'unfriendly' is present AND 'staff' is present, the model predicts a low rating." This categorical approach aligns more closely with human reasoning than numerical importance weights.

An example of an interpretable decision tree and the resulting logic-based decision rules generated by DICTA.

Results and Discussion

Experimental results demonstrated that DICTA significantly outperforms LIME in terms of fidelity, meaning the surrogate decision tree more accurately mimics the black-box model's local behavior. Statistical analysis using Wilcoxon tests confirmed these improvements were highly significant ($p < 10^{-43}$ in several cases).

Furthermore, using the Local Outlier Factor (LOF) metric, the researchers proved that DICTA’s synthetic documents are more plausible and less likely to be treated as outliers compared to the random deletions used by traditional methods. Finally, the words identified as important by DICTA showed higher alignment with human-labeled sentiment lexicons (like VADER) across most datasets.

Limitations and Future Work

While DICTA offers a robust improvement over existing methods, it currently relies on WordNet, which may lack coverage for technical jargon or rapidly evolving internet slang. Future research will focus on extending the framework to handle the complex attention mechanisms of Transformer models (e.g., BERT, GPT) and optimizing the influential sentence heuristic for extremely long documents, such as legal or medical texts.

Summary updated

BibTeX
@inproceedings{sarvmaili2022modularized,
  author = {Mahtab Sarvmaili and Riccardo Guidotti and Anna Monreale and Amílcar Soares and Zahra Sadeghi and Fosca Giannotti and Dino Pedreschi and Stan Matwin},
  title = {{A Modularized Framework for Explaining Black Box Classifiers for Text Data}},
  booktitle = {Canadian AI},
  year = {2022},
  doi = {10.21428/594757db.7e75dcdf},
}
Figure