Interpretable by Design: Wrapper Boxes Combine Neural Performance with Faithful Explanations

Yiheng Su, Junyi Jessy Li, Matthew Lease

Abstract

Can we preserve the accuracy of neural models while also providing faithful explanations? We present wrapper boxes, a general approach to generate faithful, example-based explanations for model predictions while maintaining predictive performance. After training a neural model as usual, its learned feature representation is input to a classic, interpretable model to perform the actual prediction. This simple strategy is surprisingly effective, with results largely comparable to those of the original neural model, as shown across three large pre-trained language models, two datasets of varying scale, four classic models, and four evaluation metrics. Moreover, because these classic models are interpretable by design, the subset of training examples that determine classic model predictions can be shown directly to users.

Introduction

Modern deep learning models, particularly Large Language Models (LLMs), have achieved remarkable accuracy but remain "black boxes." Their internal decision-making processes are often inscrutable, which poses a significant barrier to their adoption in high-stakes domains like healthcare or law. While post-hoc explanation methods like LIME or SHAP attempt to interpret these models, they often suffer from "unfaithfulness"—the explanation provided may not accurately reflect the model's actual reasoning.

To address this, we propose Wrapper Boxes, a framework that achieves interpretability-by-design. Instead of guessing why a model made a decision, Wrapper Boxes use classic, transparent algorithms to make the final prediction based on neural features, ensuring that every output is explicitly tied to specific training examples.

The Wrapper Box Pipeline

The Wrapper Box approach follows a three-step process to bridge the gap between neural power and "white box" transparency:

  1. Neural Encoding: A standard neural model (e.g., DeBERTa or BART) is trained or fine-tuned on a target task.
  2. Feature Extraction: The model's final classification head is discarded. Instead, high-dimensional vector representations (embeddings) are extracted from the penultimate layer.
  3. Classic "Wrapper": These embeddings serve as inputs for a classic, inherently interpretable model. The framework supports various algorithms, including k-Nearest Neighbors (kNN), Decision Trees (DT), and L-Means clustering.
The Wrapper Box pipeline: Neural embeddings from a black box model are passed to a classic interpretable model to generate predictions and example-based explanations.

Because the classic model is the actual predictor, the training examples it "consults" during inference provide a 100% faithful, example-based explanation. This allows users to understand a prediction through analogy—comparing the current input to similar historical cases.

Experimental Results

We evaluated Wrapper Boxes on two distinct tasks: toxic speech detection (ToxiGen) and large-scale natural language inference (E-SNLI). We tested the pipeline across several Transformer architectures, including BART-large, DeBERTa-large, and Flan-T5-large.

Predictive Performance

A key concern with using simpler models is a potential drop in accuracy. However, our results show that when fed the high-quality feature space learned by a fine-tuned Transformer, classic models become highly competitive. In many cases, the performance of the Wrapper Box was within a very narrow margin of the original "black box" model.

Performance comparison of Wrapper Boxes (KNN, DT, L-Means) against original neural models across BART, DeBERTa, and Flan-T5.

Algorithmic Recourse

Beyond simple explanations, Wrapper Boxes excel at algorithmic recourse—identifying the minimal subset of training data that, if removed, would flip the model's decision. Using a greedy algorithm, the kNN Wrapper Box achieved 100% coverage and correctness in identifying these influential points, significantly outperforming traditional influence function methods which are often computationally expensive and less reliable.

Discussion and Tradeoffs

While Wrapper Boxes offer high faithfulness, they introduce a tradeoff between faithfulness and simplicity. A fully faithful explanation might require showing a user dozens of influential examples, which can lead to information overload. Conversely, showing only the single most similar example is simpler but may not capture the full reasoning of the model.

Additionally, while this method is efficient—requiring no retraining of the underlying neural model—it does necessitate storing training embeddings for inference, which can be a consideration for massive datasets. Future work will explore scaling these methods to billions of points using approximate nearest neighbor techniques.

Conclusion

Wrapper Boxes demonstrate that we do not have to sacrifice neural performance for transparency. By repurposing the rich representations learned by deep models as inputs for classic algorithms, we can create systems that are accurate, attributable, and interpretable by design. This approach provides a robust path forward for deploying trustworthy AI in sensitive applications.

Summary updated

Abstract

Can we preserve the accuracy of neural models while also providing faithful explanations? We present wrapper boxes, a general approach to generate faithful, example-based explanations for model predictions while maintaining predictive performance. After training a neural model as usual, its learned feature representation is input to a classic, interpretable model to perform the actual prediction. This simple strategy is surprisingly effective, with results largely comparable to those of the original neural model, as shown across three large pre-trained language models, two datasets of varying scale, four classic models, and four evaluation metrics. Moreover, because these classic models are interpretable by design, the subset of training examples that determine classic model predictions can be shown directly to users.
BibTeX
@inproceedings{su2024interpretable,
  author = {Yiheng Su and Junyi Jessy Li and Matthew Lease},
  title = {{Interpretable by Design: Wrapper Boxes Combine Neural Performance with Faithful Explanations}},
  booktitle = {BlackBoxNLP ARR Commitment @ EMNLP},
  year = {2024},
  url = {https://openreview.net/forum?id=cRNicP5q20},
}
Figure