Proto-lm: A Prototypical Network-Based Framework for Built-in Interpretability in Large Language Models

Sean Xie, Soroush Vosoughi, Saeed Hassanpour

Introduction

Large Language Models (LLMs) such as BERT, RoBERTa, and BART have set new benchmarks across natural language processing (NLP) tasks. However, their internal decision-making processes remain largely opaque. This "black-box" nature is problematic in high-stakes domains where understanding why a model reached a specific conclusion is as important as the conclusion itself. Traditional interpretability methods are typically post-hoc, meaning they analyze the model after a decision is made. These methods often suffer from computational overhead and "unfaithfulness," where the explanation does not accurately reflect the model's actual logic.

To address these challenges, researchers have introduced Proto-lm, a framework that embeds interpretability directly into the LLM architecture. By utilizing case-based reasoning, Proto-lm provides faithful, human-readable explanations without compromising predictive accuracy.

The Proto-lm Architecture

The Proto-lm framework transforms standard LLMs into "white-box" models by adding specialized layers that facilitate transparent reasoning. The architecture consists of three primary components integrated on top of a base LLM:

  1. Token-level Attention Layer: This layer identifies the most salient words or tokens within the input text, providing granular, low-level interpretability.
  2. Prototypical Layer: The heart of the framework, this layer maintains a set of trainable "prototypes"—representative vectors for each classification category. The model calculates the similarity (using $L_2$ distance) between the input's embedding and these prototypes.
  3. Classification Head: A fully connected layer that uses the similarity scores to make the final decision.
Architectural overview of the Proto-lm framework, showing the integration of the base LLM with the attention and prototypical layers.

During training, the model optimizes a multi-objective loss function. Beyond standard cross-entropy for accuracy, it includes cohesion loss (to ensure inputs are close to prototypes of their true class) and separation loss (to ensure prototypes of different classes are distinct).

Case-Based Reasoning and Interpretability

Proto-lm operates on the principle of case-based reasoning: it classifies a new input by comparing it to known "prototypes" learned from the training data. To make these abstract mathematical vectors interpretable, the model employs "prototype projection," where each learned prototype is mapped to the nearest actual training example.

Visualizing the similarity-based classification process: an input is classified as 'Very Positive' based on its proximity to positive prototypes.

This approach allows the model to provide explanations such as: "This review is classified as 'Positive' because it is highly similar to these specific training examples." This provides both word-level (via attention) and sentence-level (via prototypes) transparency.

Experimental Evaluation

The authors evaluated Proto-lm across several benchmarks, including GLUE tasks (SST-2, QNLI, MNLI, RTE, WNLI), large-scale sentiment analysis (IMDb, SST5), and specialized biomedical datasets (HoC, BIOSSES).

Performance and Faithfulness

A key finding is that Proto-lm achieves competitive accuracy compared to standard black-box LLMs. For instance, on the SST-2 dataset, a RoBERTa-large based Proto-lm reached 96.5% accuracy, slightly outperforming the 96.4% baseline.

Furthermore, the model demonstrated superior "simulatability." In human trials, participants shown Proto-lm's prototypical explanations could predict the model's final decision with 90-92% accuracy, significantly higher than those using LIME (87%) or Integrated Gradients (84%). This suggests that Proto-lm's explanations are more intuitive and faithful to the model's actual logic.

Discussion and Future Directions

Proto-lm represents a significant step toward inherently interpretable NLP. By visualizing the "Prototypical Space," researchers can diagnose misclassifications—often occurring when an input falls between clusters or contains features associated with multiple classes.

However, some limitations remain. The quality of interpretability is still tied to the underlying LLM's semantic representation. Additionally, while accuracy plateaus at approximately 1,000 prototypes, managing such a large number of examples for complex tasks poses a challenge for human review. Future work may focus on "decoding" prototype vectors directly or improving the scalability of the prototype projection method.

In conclusion, Proto-lm proves that we do not need to sacrifice performance for transparency. By building interpretability into the core of the model, we can move closer to trustworthy and accountable AI.

Summary updated

BibTeX
@inproceedings{xie2023proto,
  author = {Sean Xie and Soroush Vosoughi and Saeed Hassanpour},
  title = {{Proto-lm: A Prototypical Network-Based Framework for Built-in Interpretability in Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.261},
}
Figure