# Xplique and the TensorFlow-first explainability toolbox with five method families

> deel-ai/xplique gathers attribution methods, feature visualization, concept extraction, explainability metrics and example-based explanations into one Python package. The breadth is the point, and so is the gap between what its documentation promises on paper and what its pinned dependencies and compatibility note actually deliver.

**deel-ai/xplique** — 👋 Xplique is a Neural Networks Explainability Toolbox

- Repository: https://github.com/deel-ai/xplique
- Website: https://deel-ai.github.io/xplique
- Stars: 760 · Forks: 65
- Language: Python
- License: NOASSERTION
- Published: 2026-10-21 · Updated: 2026-10-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/deel-ai-xplique

## Five method families in one importable package

Xplique is a Python toolkit dedicated to explainability, and the repository describes its goal as gathering the state of the art of Explainable AI so that a complex neural network can be understood. The package is organised into named modules, and the README names them one by one.

The Attributions Methods module implements individual techniques such as Saliency, Grad-CAM, FEM and Integrated-Gradients, each shipped with explanations, examples and links to the official papers. The Feature Visualization module finds inputs that maximise neurons, channels, layers or compositions of them, which shows how a network builds its internal representation of an image. The Concepts module extracts human concepts from a model and tests their usefulness with respect to a class. The Metrics module covers the metrics used in explainability, and it is meant to be used together with the Attributions module to test methods or evaluate the explanations a model produces.

A fifth family, Example-based, is newer and works differently. Instead of gradients or perturbations, it retrieves relevant examples from a dataset, covering similar examples, contrastive examples (counter-factuals and semi-factuals) and prototypes. The grouping matters for adoption: a team can take only the module it needs, but the metric layer is what makes the attribution layer testable rather than decorative.

## TensorFlow is the native target and PyTorch support is partial

The README is explicit about the centre of gravity. Xplique was "Originally built for Tensorflow's model" and "also works for PyTorch models partially", and the project description in the package metadata reads "Explanations toolbox for TensorFlow 2". The dependency list backs that up: tensorflow is a direct requirement, while torch, torchvision and overcomplete sit in an optional extra group named torch.

That split tells you what to expect from a PyTorch workflow. The extra exists, so the code paths are there, but the project does not claim parity, and the phrase "partially" is doing real work in that sentence. If your model is trained in PyTorch, you should assume that some explainers work and others do not, and that which ones is something the documentation has to tell you rather than something the package metadata promises.

The tutorial list reinforces the TensorFlow centre. The hands-on notebooks cover attribution methods for tabular data and regression, object detection, semantic segmentation, a FORGrad session, and several metric-based sessions including sanity checks, complexity metrics, randomization metrics and average drop, increase and gain fidelity metrics. These are research and review workflows rather than an inference-time explanation service.

## The Keras 3 warning collides with the pinned TensorFlow range

This is the sharpest internal contradiction in the project, and it decides how you install it. The README carries an important note: since Keras 3 shipped with TensorFlow 2.16, "some methods may not function as expected", the maintainers say they are working on a fix, and they recommend using TensorFlow 2.15 or earlier for optimal compatibility.

The dependency metadata says the opposite. pyproject.toml requires tensorflow>=2.18,<=2.20.0 on non-Linux platforms and tensorflow[and-cuda]>=2.18,<=2.20.0 on Linux, so the lower bound is 2.18, which is three minor versions above the version the README recommends. There is no dependency range that satisfies both statements, so a fresh install will land you on a TensorFlow version the project warns about.

The Python constraint has a similar mismatch. The README badge advertises Python 3.10 through 3.14, while pyproject.toml sets requires-python to >=3.10,<3.14, which excludes 3.14 from installability. The distribution metadata is the part your resolver reads, so the badge should be treated as an aspiration rather than a guarantee.

The practical consequence for an engineering team is that the pinned environment and the documented safe environment differ, and the choice between them is yours to make and to pin deliberately.

## The published package metadata and the dependency set

The package is distributed on PyPI under the name xplique, and the build metadata lives in pyproject.toml. The project block looks like this:

```toml
[project]
name = "xplique"
version = "2.0.2"
description = "Explanations toolbox for TensorFlow 2"
readme = "README.md"
requires-python = ">=3.10,<3.14"
license = "MIT"
license-files = ["LICENSE"]
classifiers = [
  "Development Status :: 4 - Beta",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3",
  "Operating System :: OS Independent"
]
```

The classifier marks the project as Beta, which is a fair signal for an API that has already changed shape once at the 2.0 line.

The runtime dependency list is wide, which is what an explainability toolbox costs in practice:

```toml
dependencies = [
    "deprecated>=1.1.0",
    "einops>=0.1.0",
    "matplotlib>=3.5",
    "numpy>=2.0.0",
    "opencv-python>=3.4.11.39",
    "ruff>=0.15.0",
    "scikit-image>=0.14.1,<=0.25.2",
    "scikit-learn>=0.14.1,<=1.7.2",
    "scipy>=1.0.0,<=1.15.3",
    "tensorflow>=2.18,<=2.20.0; sys_platform != 'linux'",
    "tensorflow[and-cuda]>=2.18,<=2.20.0; sys_platform == 'linux'",
    "tensorflow-probability[tf]>=0.20.1,<=0.25.0",
]
```

Note that the CUDA build of TensorFlow is pulled in on Linux, which affects image size and installation time on any machine that installs the package by default rather than through an extra.

## Preparing a working environment with uv, tox and mkdocs

The README does not give a pip install command, so the practical starting point the project points to is its documentation site at deel-ai.github.io/xplique, its Colab tutorials, and the published package itself. For contributors, the repository ships a Makefile whose prepare-dev target creates the environment:

```bash
prepare-dev:
	@command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh;
	uv venv
	. .venv/bin/activate && uv sync
```

That target installs uv if it is missing, creates a virtual environment and syncs the dependencies from the lock file into it. The test and documentation targets follow the same activate-then-run pattern:

```bash
test-disable-gpu:
	. .venv/bin/activate && CUDA_VISIBLE_DEVICES=-1 tox
```

```bash
doc:
	. .venv/bin/activate && mkdocs build
```

The GPU-disabled variant is worth noticing, because explainability runs on gradient and perturbation workloads that are heavy on a laptop without a discrete GPU. The repo also carries tox.ini, a .pre-commit-config.yaml and a Makefile pc_check target that runs pre-commit over all files, which tells you that lint and format checks are part of the normal contribution loop rather than an afterthought.

## Why the metric layer matters more than the method count

The number of explainers in the box is not the reason to adopt this package. The reason is the Metrics module, which the README describes as covering the current metrics used in explainability and being used in conjunction with the Attributions module to test the different methods or evaluate the explanations of a model.

That framing puts Xplique on the side of the discussion that treats an attribution map as a claim to be checked rather than a picture to be pasted into a slide. The tutorial catalogue backs it up: there is a session on the sanity checks paper, one on complexity metrics, one on randomization metrics, and one on average drop, increase and gain fidelity metrics. These are evaluation instruments, and they are packaged alongside the instruments they evaluate.

The alternative approach, for teams who already have TensorFlow code, is to hand-roll one attribution in a few lines of gradient code and trust it. The difference is not the gradient, it is the audit trail. Xplique gives you a place to run a randomization check on the same method you ship, and an example-based module that can produce a counterfactual from your own dataset when a gradient map is not the right explanation for a non-expert user. Both are unavailable to a bespoke implementation, unless you write them yourself.

## The 2.0 line moved from images to detection and concepts

The release history shows where the project is going. Version 2.0.0, published on 2026-07-27, was titled "Craft for Object Detection". Version 2.0.1 followed on 2026-08-28 as "Miscellaneous fixes for v2.0.0". Version 2.0.2, published on 2026-09-25, added "Concept Localization via Black-box Attributions", and the matching pyproject version string is 2.0.2.

Two things follow from that sequence. The first is that object detection and semantic segmentation are now first-class use cases rather than experiments, which is what the matching tutorials suggest. The second is that the project is no longer strictly gradient-based: a release explicitly named for black-box attributions means part of the concept tooling can work when you cannot ask the model for gradients at all.

The last push was on 2026-10-13, roughly two weeks before this article was written, and the repository is not archived, so the commit activity is current. The public documentation is published through a dedicated workflow and the site is served from the master branch, with a Makefile target for building it locally.

On licensing, the situation needs a note rather than a claim. The README badge and the pyproject license field both say MIT, while GitHub could not classify the licence field and points at the LICENSE file as the authority instead. Treat the LICENSE file as the governing text and have it reviewed by whoever handles licence questions at your organisation.

## Conclusion

Xplique fits teams that want several published attribution methods, a metric layer to check them and example-based explanations in the same codebase, and that can hold their TensorFlow version at 2.15 or earlier for now. It does not fit a team that needs full PyTorch coverage, a documented Keras 3 path or a clean licence file to hand to legal, since the repository metadata classifies the LICENSE as custom while the README badge and pyproject both say MIT. Verify the exact attribution API in the published documentation before porting existing explanation code, and pin TensorFlow deliberately rather than accepting the resolver's choice.

## FAQ

### Which TensorFlow version should I use with Xplique?

The README recommends TensorFlow 2.15 or earlier because some methods may not work as expected since Keras 3 shipped with TensorFlow 2.16. The package metadata however requires tensorflow>=2.18,<=2.20.0, so a default install lands on a version the README warns about and you will need to pin deliberately.

### Does Xplique work with PyTorch models?

The README says the library was originally built for TensorFlow models and works for PyTorch models partially. A torch extra group exists in pyproject.toml with torch, torchvision and overcomplete, but parity with the TensorFlow path is not claimed.

### What does the Xplique Metrics module add to attribution methods?

It covers the metrics used in explainability and is used together with the Attributions module to test methods or evaluate explanations. The tutorial list includes sessions on sanity checks, complexity metrics, randomization metrics and average drop, increase and gain fidelity metrics.

### What is included in the Xplique example-based module?

It explains a model by retrieving relevant examples from a dataset and covers similar examples, contrastive examples such as counter-factuals and semi-factuals, and prototypes.

## Sources

- [deel-ai/xplique on GitHub](https://github.com/deel-ai/xplique)
- [Issues](https://github.com/deel-ai/xplique/issues)
- [Project website](https://deel-ai.github.io/xplique)
- [README](https://github.com/deel-ai/xplique/blob/master/README.md)
- [Releases](https://github.com/deel-ai/xplique/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/deel-ai-xplique
