Interpreto: An Explainability Library for Transformers

Antonin Poché, Thomas Mullor, Gabriele Sarti, Frédéric Boisnard, Corentin Friedrich, Charlotte Claye, François Hoofd, Raphael Bernas, Nicholas Asher, Céline Hudelot, Fanny Jourdan

TL;DR

INTERPRETO is a new open-source Python library designed to make HuggingFace Transformer models—ranging from BERT to modern LLMs—more transparent. It uniquely bridges the gap between traditional attribution methods (which tokens matter?) and concept-based explanations (what high-level ideas is the model using?), providing a unified, end-to-end pipeline for both text classification and generation.

What Problem Does This Paper Address?

As Transformer models become the backbone of AI, understanding why they make specific predictions is critical for safety, debugging, and bias detection. However, the interpretability landscape is currently fragmented. Practitioners usually have to juggle multiple libraries: some handle "attributions" (assigning importance scores to input tokens), while others focus on "mechanistic interpretability" (analyzing internal activations).

Furthermore, many existing tools are tailored to specific tasks (like classification) and struggle with the complexities of text generation in LLMs. INTERPRETO addresses this by providing a single, cohesive API that handles the entire workflow—from extracting raw activations to generating human-readable labels for discovered internal concepts.

Methods

The library is organized into two primary modules:

  1. interpreto.attributions: This module focuses on local explanations. It supports 10 different methods categorized into:
  2. Perturbation-based: Modifying the input and measuring the change in output (e.g., KernelSHAP, LIME, Occlusion).
  3. Gradient-based: Using model derivatives to find salient features (e.g., Integrated Gradients, Saliency, SmoothGrad).
  4. Key Innovation: It allows for "granularity control," letting users view importance at the token, word, or sentence level, which is often more intuitive for human analysis than raw sub-token fragments.
  5. interpreto.concepts: This provides an end-to-end pipeline for unsupervised concept discovery:
  6. Model Splitting: Uses the nnsight library to "surgicaly" access internal activations.
  7. Concept Learning: Employs dictionary learning techniques (like NMF, PCA, or Sparse Autoencoders) to find recurring patterns in activations.
  8. Interpretation: Automatically labels these discovered patterns using LLM-based annotators (e.g., identifying a cluster of activations as representing "Financial references").
  9. Scoring: Quantifies how much each discovered concept actually contributes to the final model output.

Datasets

The authors demonstrated the library's utility using several standard NLP benchmarks:

  • AG-News: Used for multi-class text classification.
  • IMDB: Used for sentiment analysis.
  • Emotion: A BERT-based model fine-tuned for emotion recognition.
  • Generative Tasks: Evaluated using state-of-the-art LLMs including GPT-2, Qwen3-0.6B, and Llama 3.1 8B.

Key Insights and Ideas

  • Unified API for Gen and Cls: One of the biggest "aha" moments is that the same interpretability logic can be applied to both a sentiment classifier and a causal LLM. By treating the next-token prediction of an LLM as a classification task over the entire vocabulary, INTERPRETO provides a consistent experience across different model architectures.
  • Beyond "Heatmaps": While attributions show where a model is looking, concepts show what it is thinking. INTERPRETO’s ability to turn abstract activation vectors into human-readable labels (like "Proper Noun Indicators" or "Market Focus") moves interpretability from "math-heavy" to "human-centric."
  • Modular Customization: The library is designed for researchers to plug in their own custom "perturbators" or "aggregators," making it a flexible framework for developing new interpretability research.

Key Results

  • Comprehensive Coverage: In a comparison with existing libraries like Captum, Ferret, and SAELens, INTERPRETO was the only one to support the full concept-based pipeline (splitting, learning, interpretation, and scoring) while also maintaining a unified API for generation and classification.
  • Efficiency: For standard attribution tasks, the library produces results in seconds. Even complex concept discovery pipelines on medium-sized datasets (like 100 samples of AG-News) can run in under 3 minutes on a consumer-grade GPU (RTX 3080).
  • Qualitative Success: The paper showcases how a practitioner can use the library to debug an emotion model, discovering that the model fails because it hasn't properly separated the concepts of "fear" and "sadness" in its internal representation.

Limitations and Future Work

  • Modality: Currently, the library is strictly focused on text. The authors plan to extend it to multi-modal models (e.g., vision-language models) in the future.
  • LLM Sensitivity: The automated labeling of concepts relies on an external LLM, which can be sensitive to prompt design and may introduce its own biases.
  • Computational Cost: While small runs are fast, training large-scale Sparse Autoencoders (SAEs) for massive LLMs remains computationally expensive.
  • Planned Features: Future updates aim to include supervised concept options (like Concept Activation Vectors) and tighter integration between the attribution and concept modules.

Summary updated

BibTeX
@inproceedings{poche2026interpreto,
  author = {Antonin Poché and Thomas Mullor and Gabriele Sarti and Frédéric Boisnard and Corentin Friedrich and Charlotte Claye and François Hoofd and Raphael Bernas and Nicholas Asher and Céline Hudelot and Fanny Jourdan},
  title = {{Interpreto: An Explainability Library for Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-demo.1},
}

Loading related content...

Figure