Inferensys

Glossary

Quantus

Quantus is an open-source Python toolkit designed for the quantitative evaluation of neural network explanations, providing a comprehensive suite of metrics to measure properties like faithfulness, robustness, and complexity of attribution methods.
Data scientist reviewing AI evaluation metrics on dashboard, comparison charts visible, casual WeWork analytics setup.
EXPLANATION EVALUATION FRAMEWORK

What is Quantus?

Quantus is an open-source Python toolkit designed for the rigorous, quantitative evaluation of neural network explanation methods, providing a comprehensive suite of metrics to measure properties like faithfulness, robustness, and complexity.

Quantus is an open-source Python toolkit for the quantitative evaluation of neural network explanations. It provides a comprehensive, standardized suite of metrics to measure critical properties of attribution methods—such as faithfulness, robustness, and complexity—moving the field beyond subjective visual inspection of saliency maps toward reproducible, evidence-based validation.

The framework unifies dozens of evaluation metrics from fragmented research into a single API, enabling direct comparison of explanation techniques like Integrated Gradients, SHAP, and Grad-CAM. By quantifying whether an explanation accurately reflects a model's true reasoning process, Quantus is essential for auditing post-hoc explainability methods in high-stakes domains like medical imaging, where regulatory explainability demands verifiable evidence that a diagnostic model is attending to genuine pathology rather than confounding artifacts.

TOOLKIT CAPABILITIES

Key Features of Quantus

Quantus provides a structured, reproducible framework for evaluating the quality of neural network explanations, moving beyond subjective visual inspection to rigorous quantitative measurement.

01

Faithfulness Evaluation

Measures how accurately an explanation reflects the model's true reasoning process. Faithfulness metrics perturb inputs based on attribution scores and measure the resulting change in model output.

  • Pixel Flipping: Iteratively removes the most salient pixels and plots the degradation in classification confidence
  • Region Perturbation: Replaces highly attributed image regions with random noise or a baseline value
  • Selectivity: Quantifies how quickly the model's prediction drops as the most relevant features are removed
  • IROF (Iterative Removal of Features): Evaluates faithfulness by segmenting the input and removing segments in order of decreasing attribution
02

Robustness Assessment

Evaluates the stability of explanations under small, semantically meaningless perturbations to the input. A robust explanation should not change dramatically when imperceptible noise is added.

  • Local Lipschitz Estimate: Computes the maximum rate of change of the explanation under bounded input perturbations
  • Continuity: Measures how smoothly the attribution changes as the input is continuously deformed
  • Max-Sensitivity: Finds the maximum difference in explanations for inputs within a small epsilon-neighborhood
  • Relative Input Stability: Compares the explanation's sensitivity to the model's own output sensitivity
03

Complexity Analysis

Quantifies the conciseness and human-interpretability of an explanation. Effective explanations should be sparse and avoid scattering attribution across irrelevant features.

  • Sparseness: Uses the Gini index or entropy to measure how concentrated the attribution mass is across input features
  • Effective Complexity: Counts the number of features required to explain a given fraction of the total attribution
  • Complexity-Sensitivity Trade-off: Evaluates whether an explanation achieves high faithfulness with minimal feature complexity
  • Smoothness: Measures spatial coherence, penalizing fragmented or noisy saliency maps that are difficult for clinicians to interpret
04

Randomisation & Axiomatic Tests

Applies sanity checks that any valid explanation method must pass, ensuring the attribution is genuinely dependent on the model's learned parameters and not an artifact of the input data.

  • Model Parameter Randomisation Test: Cascades randomisation of model layers from top to bottom; a valid explanation should degrade progressively
  • Data Randomisation Test: Trains the model on permuted labels; the resulting explanations should differ fundamentally from those of a properly trained model
  • Completeness: Verifies that the sum of all feature attributions equals the difference between the model output at the input and a baseline
  • Implementation Invariance: Confirms that functionally equivalent networks produce identical attributions
05

Localisation & Pointing Game

Evaluates how precisely an explanation's high-attribution regions correspond to known ground-truth bounding boxes or segmentation masks, critical for object detection and medical lesion attribution.

  • Pointing Game: Measures the fraction of highest-attribution points that fall within the ground-truth object bounding box
  • Top-k Intersection: Calculates the overlap between the k most salient pixels and the annotated region of interest
  • Relevance Mass Accuracy: Computes the proportion of total attribution that falls inside the target region versus the background
  • Energy-Based Pointing Game: Extends the pointing game with distance-weighted scoring for more nuanced localisation assessment
06

Unified Evaluation Framework

Provides a consistent API and standardised benchmarking protocol for comparing explanation methods across models, datasets, and tasks. Eliminates ad-hoc evaluation scripts and enables reproducible research.

  • Metric Taxonomy: Organises 30+ metrics into well-defined categories (faithfulness, robustness, complexity, localisation, randomisation)
  • Batch Processing: Evaluates explanations across entire datasets with configurable perturbation parameters and baseline strategies
  • Normalisation & Aggregation: Standardises metric outputs to a common scale and provides summary statistics for clean reporting
  • Extensible Architecture: Allows custom metrics to be registered and integrated into the evaluation pipeline alongside built-in metrics
QUANTUS EXPLAINED

Frequently Asked Questions

Common questions about the Quantus toolkit for evaluating and validating neural network explanations in high-stakes medical imaging applications.

Quantus is an open-source Python toolkit designed for the quantitative evaluation of neural network explanations, providing a comprehensive and standardized suite of metrics to measure the quality of feature attribution methods like Grad-CAM, Integrated Gradients, and SHAP. It works by taking a trained model, an input sample, and a generated explanation map, then computing a battery of scores across multiple evaluation dimensions—faithfulness, robustness, localisation, complexity, randomisation, and axiomatic properties. Each metric returns a numerical score that indicates how well the explanation aligns with the model's true reasoning process. For example, the Faithfulness Correlation metric iteratively removes the most salient pixels and measures whether the model's prediction probability decreases accordingly. Quantus abstracts the evaluation pipeline into a consistent API, allowing researchers and clinical AI developers to benchmark different explanation methods objectively rather than relying on subjective visual inspection of saliency maps. This is critical in regulatory explainability contexts where demonstrating that a diagnostic model is looking at the correct anatomical region is a safety requirement.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.