Practical overview
When it fits
Use Inseq when you need post-hoc, token-level attribution analysis for sequence-generation outputs and want to work with the results in Python, notebooks, a browser or the command line.
Who it is for
- Researchers analyzing how inputs contribute to generated text or translations.
- Developers incorporating attribution analysis into sequence-to-sequence or language-generation research workflows.
- Practitioners working with supported Hugging Face encoder-decoder and decoder-only models.
Documented uses
- Attribute input tokens in a generated sequence using a feature-attribution method.
- Inspect attribution scores through notebook, browser or command-line visualizations.
- Process an individual example or a Hugging Face dataset through the CLI.
- Post-process, filter or merge attribution maps with aggregator classes.
Requirements & limits
The repository identifies Inseq as open source under the Apache-2.0 license. Installation instructions specify Python 3.10 through 3.13.
- The documented model scope covers most Hugging Face Transformers ForConditionalGeneration and ForCausalLM models.
- The project supports multiple attribution methods, including methods extending those available in Captum.
- Visualization options include notebooks, browser and command line; dataset attribution is available through the CLI.
- Notebook visualization and Hugging Face datasets attribution are documented as optional installation extras.
- The installation FAQ notes extra system dependencies for some packages: Rust for tokenizers and build packages for sentencepiece.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Attribute a translation with Integrated Gradients
Produce and display token-level attribution scores for a translation input using the documented Python example.
Before you start
- Python 3.10 through 3.13
- Inseq installed with pip
- A supported Hugging Face sequence-generation model
Steps
Install Inseq with the command below.
pip install inseqImport
inseqand loadHelsinki-NLP/opus-mt-en-frwith theintegrated_gradientsmethod.Call
model.attribute()with the example sentence andn_steps=100.Call
.show()on the returned attribution output.
Expected outcome
Displays attribution scores for tokens in the input sentence; the example describes automatic token-level aggregation.
Guide limitations
- The guide follows the repository's translation example and does not establish suitability for every model or task.
- Some dependencies may require additional tooling, including Rust for tokenizers and system build packages for sentencepiece.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- inseq-team/inseq · Official homepage title · retained in its source language

