Transformers Interpret is an open-source explainability library for Hugging Face Transformers models: it explains a model’s prediction in about two lines of code, showing which words or image regions drove the output. It has about 1,420 stars on GitHub and is built on Captum, Meta’s model interpretability library for PyTorch.
Transformer models are powerful but opaque, and debugging why a classifier flagged a sentence โ or which tokens pushed a sentiment score โ normally requires specialist interpretability code. Transformers Interpret wraps Captum’s attribution methods behind a simple API matched to common Transformers tasks. For language models it produces word-level attributions you can visualize, highlighting the tokens that most influenced a prediction; for vision transformers it can show which parts of an image mattered. The library works with models loaded through the standard Hugging Face pipeline style, so adding explanations to an existing project is a small step rather than a rewrite. It supports text classification and other common tasks across NLP and computer vision, making model behavior inspectable during development, error analysis, and stakeholder demos. The repository was last updated in 2023 and remains a widely referenced entry point into transformer explainability.
Transformers Interpret is free and open source under the Apache-2.0 license. There are no plans or hosted services; you install the library from PyPI and run explanations wherever your models run.
ML practitioners and data scientists who need to understand, debug, and communicate transformer model behavior โ for error analysis, bias checks, compliance questions, or simply building intuition about what their models have learned.