TL;DR
Proto-Trex and its interactive extension, iProto-Trex, bring intrinsic interpretability to transformer language models by embedding case-based reasoning directly into the architecture via prototype networks. Instead of relying on brittle post-hoc explanations, the model classifies text by comparing it to representative prototypical sequences, allowing human users to inspect, prune, and steer these prototypes with varying degrees of certainty without degrading task accuracy.
What Problem Does This Paper Address?
State-of-the-art transformer models (e.g., BERT, GPT-2) are notorious black boxes. Traditional explainability techniques typically rely on post-hoc attributions—such as saliency maps, attention weights, or LIME—which often disagree with one another, suffer from reporting bias, and can confuse end-users. Furthermore, standard transformers are trained in a purely data-driven fashion, leaving developers with few intuitive ways to fix "Clever Hans" behavior (relying on spurious correlations) or inject human domain expertise into the model's decision process.
Methods
The authors introduce Proto-Trex, which adds an interpretable prototype layer and a linear classification head directly downstream of a pre-trained transformer:
- Case-Based Reasoning via Prototypes: For an input text, the model computes embeddings (sentence-level via models like SBERT/CLIP or word-level via BERT/GPT-2/DistilBERT). The prototype layer computes cosine or $L_2$ similarities between the input representation and a set of $m$ learned prototypes. The classification layer then uses non-negative weights to output probabilities, ensuring decisions are strictly based on similarity to representative cases.
- Multi-Objective Loss: The training objective blends standard cross-entropy with clustering ($\text{Clst}$), separation ($\text{Sep}$), distribution ($\text{Distr}$), prototype diversity ($\text{Divers}$), and $L_1$ weight sparsity.
- Word-Level Token Patching: Because testing all token subsets is computationally intractable, the authors evaluate convolutional sliding windows (with/without dilation) vs. self-attention selection to isolate candidate sequences.
- Nearest Neighbor Projection: To convert continuous prototype vectors back into human-readable text, learned sentence vectors are projected onto their nearest training-set neighbors.
- Interactive Prototype Learning (iProto-Trex): Enables human-in-the-loop intervention via:
- Strong-knowledge interactions: Directly adding, removing, or replacing prototypes.
- Weak-knowledge interactions: Pruning verbose sequences via cosine similarity thresholds, or re-initializing/fine-tuning unsatisfactory prototypes.
- Soft User Feedback: A certainty-weighted margin loss ($\mathcal{L}_{\text{interact}}$ with parameter $c \in [0, 1]$) that gently guides prototypes toward user-suggested texts based on user confidence.
Input Query ──> Transformer f ──> [Patching / Selection] ──> Prototype Layer p ──> Linear Layer g ──> Class Prediction
│
Human Interaction (iProto-Trex)
(Add / Remove / Prune / Soft-guide)
Datasets
The authors evaluated Proto-Trex across three standard classification benchmarks:
- Open Yelp Dataset: Customer restaurant reviews for sentiment classification.
- MovieReview (Pang et al., 2002 / ERASER benchmark): Sentiment classification accompanied by human-annotated rationales used to evaluate faithfulness.
- Jigsaw Toxic Comment Classification Challenge: Multi-label / binary online comment toxicity detection.
Note: No new datasets were introduced.
Key Insights and Ideas
- Intrinsic beats post-hoc: Explaining a model by pointing to tangible, representative text examples ("This review is negative because it resembles: 'They literally treat you like you are bothering them'") is more intuitive for humans than gradient heatmaps.
- Convolutions outperform self-attention for word selection: When extracting prototype candidate words, convolutional sliding windows outperformed self-attention filtering. Self-attention tended to over-select punctuation and stop words (which have highly contextualized, polysemous embeddings), whereas convolutional windows preserved coherent phrase semantics.
- No accuracy penalty for interpretability: Prototypical constraint does not hinder performance. In fact, on datasets like Yelp and Toxicity, word-level Proto-Trex with BERT and GPT-2 slightly outperformed non-interpretable baselines.
- Fast, gradient-free human steering: Unlike prior Explanatory Interactive Learning (XIL) frameworks that require computationally expensive gradient tracing during human intervention, iProto-Trex adjusts or swaps out prototypes directly.
Key Results
- Classification Performance: Proto-Trex matches or exceeds baseline transformers. On Yelp, GPT-2 Proto-Trex achieved 95.32% accuracy (baseline GPT-2: 93.78%). On Jigsaw Toxicity, GPT-2 Proto-Trex scored 84.14% (baseline: 81.56%).
- Explanation Faithfulness: Evaluated on the ERASER MovieReview benchmark:
- High comprehensiveness (0.22 for SBERT, 0.12 for GPT-2) and low sufficiency (-0.08 for SBERT, 0.02 for GPT-2) demonstrated that the models rely heavily on genuine rationale features.
- Removing the top prototype explanation caused a massive accuracy drop (SBERT fell from 80.05% to 69.66%; GPT-2 plummeted from 84.57% to 49.91%), verifying that decisions directly hinge on the prototype layer.
- User Feedback Utility: On Yelp reviews, soft-replacing a rambling negative prototype with a user-curated summary ("They offer a bad service") preserved a balanced accuracy of 93.79% (compared to 93.64% with no interaction), demonstrating that human guidance cleans up explanations without hurting accuracy.
Limitations and Future Work
- Word-Level Projection Challenges: While sentence-level prototypes can be projected onto exact training examples, discrete nearest-neighbor projection struggled for word-level prototypes due to high contextualization in token embeddings. Word-level models had to rely on nearest-neighbor approximations rather than full projection.
- Inherent Language Model Biases: Pre-trained base models (CLIP, GPT-2, BERT) inherit uncurated dataset artifacts and societal biases, which prototypes make visible but do not inherently eradicate on their own.
- Future Directions: The authors plan to investigate advanced token patching mechanisms to enable full nearest-neighbor projection for word-level prototypes without performance loss.
Summary updated