nlp-shap

Multimodal explainability for NLP and multimodal models based on Shapley-style cooperative game theory. The library separates what you measure (estimands), how you sample coalitions (estimators), and how you score outputs (value functions).

Getting started

Install nlp-shap and run your first Shapley vs Banzhaf comparison in a few lines of Python.

Getting started
User guide

Work with estimand aggregators, explain results, and run-archive manifests.

Using estimand aggregators
Theory

Shapley axioms, cooperative games, estimands, and when they diverge.

Shapley values and axioms
Applications

Business, compliance, and LLM operations use cases for attribution.

Business and compliance applications
API reference

Typed public modules, protocols, and re-exported symbols.

API reference
Examples

Runnable Jupyter notebooks: estimand toy game, masking views, runtime core, and exact estimation.

Examples
Release notes

Per-version changelog for published releases.

Release notes

Quick install

pip install nlp-shap

Requires Python 3.12. See Getting started for a full walkthrough.