A Python library that explains why your model guessed that
Alibi collects black-box and white-box explanation algorithms under one scikit-learn-style API so you can stop hand-waving about model predictions.

What it does
Alibi is a source-available Python library for inspecting and interpreting machine learning models. It wraps a broad catalog of explanation methods—local and global, black-box and white-box—into a consistent three-step API: initialize, fit, explain. You pass it a prediction function (or a white-box model), and it returns structured Explanation objects with metadata and computed results.
The interesting bit The library doesn’t just dump SHAP values and call it a day. It covers counterfactuals, anchors, accumulated local effects, prototype-based explanations, and even reinforcement-learning-driven counterfactuals. The README’s giant compatibility matrix is the real signal: someone actually thought about which methods work for tabular vs. text vs. images, whether you need training data, and whether you can distribute the computation with Ray.
Key highlights
- Supports black-box explainers (Anchors, Kernel SHAP, ALE) that only need a prediction function, plus white-box methods (Tree SHAP, Similarity explanations) that peek inside the model
- Handles tabular, text, and image data across classification and regression
- Optional Ray integration for distributed explanation computation
- Optional SHAP support via
pip install alibi[shap] - Sister project
alibi-detecthandles outlier detection and concept drift if you need the full forensic toolkit
Caveats
- Some methods require TensorFlow/Keras (CEM, Counterfactuals, Integrated Gradients), so it’s not framework-agnostic everywhere
- The README notes that exact explanation fields vary by method, so you’ll need to consult the docs per-algorithm
Verdict Worth a look if you’re shipping models to stakeholders who ask “but why?” and you need more than a single LIME plot. Less useful if you’re already embedded in the SHAP/LIME ecosystem and happy there.