Skip to content

Integration of Multiple XAI Metrics and Multi-Target Explainability into Captum #1631

@saifullah3396

Description

@saifullah3396

Feature

I'd like to propose the integration of a diverse set of Explainable AI (XAI) evaluation metrics and multi-target explainers into Captum. Over the past few months, I’ve developed batch-wise implementations of 19 widely-used XAI metrics, designed to be directly compatible with Captum’s input/output formats.

The implementations are available in my library, https://github.com/saifullah3396/torchxai/, and were built with inspiration from existing Captum metrics like Infidelity and Sensitivity.

1. Axiomatic

  1. Completeness
  2. Input Invariance
  3. Non-sensitivity

2. Complexity

  1. Complexity
  2. Effective Complexity
  3. Sparseness
  4. Sundararajan Complexity

3. Faithfulness

  1. Faithfulness Correlation
  2. Faithfulness Estimate
  3. Monotonicity
  4. Monotonicity Correlation
  5. Selectivity
  6. Sensitivity-N
  7. Infidelity
  8. AOPC
  9. Sufficiency

4. Robustness

  1. Avg-Sensitivity
  2. Max-Sensitivity

5. Localization

  1. Attribution Localization

Motivation

Captum has become one of the most popular libraries for model interpretability in PyTorch, yet it currently offers only a limited set of evaluation metrics. Given the rapid development in the XAI research space, I believe Captum would greatly benefit from supporting a broader and more standardized set of evaluation tools.

Furthermore, many users face challenges when trying to evaluate explainability methods for multi-output or multi-target models (e.g., NER, multi-label classification). My work also introduces multi-target explainer support which provides a more efficient approach to handling such models, for instance, using Jacobian-based backpropagation rather than separate backward passes for each target for gradient-explainers. On the other hand, perturbation-based approaches are directly updated to support explanations of multiple targets in a single forward pass.


Pitch

  • Direct support for 19 evaluation metrics, organized by their evaluation properties (axiomatic, faithfulness, robustness, etc.)
  • Compatibility with both simple and complex model types, including CNNs and Transformer-based models
  • Introduction of a feature-masking mechanism that generalizes explanations across token/patch-level features
  • Support for multi-target explainers that:
    • Reduce computational cost (e.g., in NER tasks)
    • Integrate cleanly with Captum’s design philosophy
  • All metrics are designed to plug into the current Captum framework with minimal change

At the moment, TorchXAI does not have detailed documentation. However, I am happy to prioritize writing comprehensive docs, usage examples, and API references if there’s interest from the Captum team.


Alternatives

To the best of my knowledge, there is currently no unified implementation of these metrics available for PyTorch-based XAI pipelines. While there is work done by Quantus, it does not directly integrate with captum well and does not provide efficient batch-wise/multi-target batched implementations. If you are aware of any such efforts, I would be happy to learn more and possibly collaborate or adapt the work accordingly.


I would greatly appreciate your feedback on the feasibility and direction of integrating this work into Captum, either in full or in parts. Looking forward to your feedback and happy to collaborate on the next steps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions