PyTorch models can finally explain themselves
Captum gives PyTorch models a vocabulary for explaining their own predictions.

What it does
Captum is an interpretability library for PyTorch. It collects general-purpose implementations of attribution methods—Integrated Gradients, saliency maps, SmoothGrad, and others—into one package that plugs into standard PyTorch models and domain-specific libraries like torchvision. It also includes tools for concept-based analysis (TCAV), influence functions (TracIn), and adversarial perturbations for counterfactual explanations.
The interesting bit
Most interpretability libraries are either research prototypes or opaque cloud services. Captum tries to be both a research workbench—researchers can benchmark new algorithms against its built-in baselines—and a production troubleshooting layer, helping engineers explain specific predictions to end users.
Key highlights
- Ships with feature-attribution staples (
IntegratedGradients,DeepLift,GradientShap) plus newer methods likeTCAVandTracIninfluence functions. - Includes adversarial-attack and minimal-perturbation utilities for counterfactual explanations, going beyond simple post-hoc attribution.
- Integrates with domain-specific PyTorch ecosystems (
torchvision,torchtext) without forcing model rewrites. - Exposes convergence deltas and approximation-error proxies so you can sanity-check whether an attribution is mathematically sound.
Caveats
- The
DeepLiftimplementation currently supports only theRescalerule and not all non-linear activation types. - Requires Python >= 3.10 and PyTorch >= 2.3, so older pipelines may need upgrading.
Verdict
Useful if you are building, debugging, or auditing PyTorch models and need to justify predictions to users or stakeholders. Not relevant if you are outside the PyTorch ecosystem or have no use for model explanations.
Frequently asked
- What is meta-pytorch/captum?
- Captum gives PyTorch models a vocabulary for explaining their own predictions.
- Is captum open source?
- Yes — meta-pytorch/captum is open source, released under the BSD-3-Clause license.
- What language is captum written in?
- meta-pytorch/captum is primarily written in Python.
- How popular is captum?
- meta-pytorch/captum has 5.7k stars on GitHub.
- Where can I find captum?
- meta-pytorch/captum is on GitHub at https://github.com/meta-pytorch/captum.