Inferensys

Glossary

Integrated Gradients

An axiomatic attribution method that assigns importance scores to input features by integrating the gradients of the model's output along a straight-line path from a baseline input.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
AXIOMATIC ATTRIBUTION

What is Integrated Gradients?

A foundational explainability method that satisfies mathematical axioms of sensitivity and implementation invariance to assign importance scores to input features.

Integrated Gradients is an axiomatic attribution method that computes the contribution of each input feature to a deep learning model's prediction by accumulating the gradients of the output with respect to the input along a straight-line path from a baseline input to the actual input. The method satisfies two fundamental axioms: Sensitivity, where a feature that differs from the baseline and changes the prediction receives a non-zero attribution, and Implementation Invariance, ensuring identical attributions for functionally equivalent networks regardless of their architecture.

The technique addresses a critical limitation of simple gradient-based saliency maps, which suffer from gradient saturation—where features that strongly influence a prediction receive near-zero gradients. By integrating gradients along a continuous path, Integrated Gradients captures the cumulative effect of each feature. The choice of baseline, often a black image or zero-embedding vector representing an informationless input, is crucial and must be carefully selected to ensure attributions are meaningful for the specific diagnostic or clinical decision support context.

AXIOMATIC ATTRIBUTION

Key Properties of Integrated Gradients

Integrated Gradients is defined by a set of mathematical properties that make it a theoretically sound and practically useful feature attribution method. These axioms ensure the explanations are consistent, faithful, and uniquely determined.

01

The Completeness Axiom

The attributions for all input features must sum to the difference between the model's output for the input and its output for the baseline. This ensures no importance is lost or created during the attribution process.

  • Mathematical Form: Σᵢ IGᵢ(x) = F(x) - F(x')
  • Practical Impact: Guarantees a full accounting of the prediction, making it suitable for regulatory audits where a complete explanation is required.
  • Contrast: Simpler methods like input * gradient do not satisfy completeness, leading to potentially misleading partial explanations.
100%
Attribution Accounting
02

The Sensitivity Axiom

If an input feature and a baseline differ in exactly one feature, and changing that feature alters the model's prediction, that feature must receive a non-zero attribution. If the model is mathematically flat with respect to a feature, it receives zero attribution.

  • Core Idea: The method is sensitive to features that actually matter for a specific prediction.
  • Violation Example: A method that relies on local gradients can assign zero importance to a feature even when it is critical, if the gradient at the specific input point is flat.
Zero
Attribution for Constant Functions
03

The Implementation Invariance Axiom

Two functionally equivalent neural networks—meaning they always produce the same output for every possible input—must receive identical attributions, regardless of their internal architecture or training parameters.

  • Key Distinction: This separates Integrated Gradients from methods that rely on inspecting internal model weights or activations, such as attention weights.
  • Practical Benefit: The explanation is a property of the model's mathematical function, not its specific implementation, ensuring consistency across different versions of a model that learn the same function.
04

The Linearity Axiom

If a model is a linear combination of two sub-models, the attribution for the combined model is the same linear combination of the attributions from the sub-models.

  • Formal Definition: IGᵢ(aF₁ + bF₂) = aIGᵢ(F₁) + bIGᵢ(F₂)
  • Ensemble Models: This property is crucial for explaining ensemble models or models with residual connections, ensuring attributions decompose logically.
  • Uniqueness: Integrated Gradients is the unique path method that satisfies this axiom alongside the others.
05

The Symmetry Axiom

If a model's output is symmetric with respect to two input features—meaning swapping their values does not change the prediction—then those two features must receive identical attributions when their input and baseline values are also swapped.

  • Fairness Application: This ensures that functionally identical features are treated equally by the explanation, which is a foundational requirement for algorithmic fairness audits.
  • Example: In a model where two biomarkers are perfect proxies for each other, they must receive equal importance scores.
06

Path Integral Formulation

The attribution is computed by accumulating the gradients of the model's output along a straight-line path from a non-informative baseline to the actual input. This path integral captures how the model's sensitivity to each feature evolves.

  • Baseline Choice: The selection of the baseline is critical. A common choice is a zero-embedding or a blurred image, representing an absence of information.
  • Expected Gradients: An extension that averages over multiple baselines to reduce noise and provide a more robust explanation.
EXPLAINABILITY & ATTRIBUTION

Frequently Asked Questions

Clarifying the axiomatic attribution method that assigns importance scores by integrating gradients along a path from a baseline to the input.

Integrated Gradients is an axiomatic attribution method that assigns an importance score to each input feature by integrating the gradients of the model's output along a straight-line path from a baseline input to the actual input. It satisfies two fundamental axioms: Sensitivity (if one input differs from a baseline and causes a different prediction, it gets non-zero attribution) and Implementation Invariance (functionally equivalent networks yield identical attributions). The integral is approximated by accumulating gradients at small intervals along the path, ensuring the sum of all feature attributions equals the difference between the model's output at the input and the baseline.

ATTRIBUTION METHOD COMPARISON

Integrated Gradients vs. Other Attribution Methods

A feature-level comparison of Integrated Gradients against SHAP, LIME, and Saliency Maps for model explainability in diagnostic AI.

FeatureIntegrated GradientsSHAPLIMESaliency Maps

Axiomatic foundation

Axioms: Sensitivity, Implementation Invariance, Completeness, Linearity

Shapley values from cooperative game theory

No formal axioms; local fidelity

No formal axioms

Satisfies completeness

Satisfies implementation invariance

Satisfies sensitivity (a)

Model type support

Differentiable models only

Any model

Any model

Differentiable models only

Global explanation capability

Computational cost

High (50-300 integration steps)

Very high (exponential in features)

Moderate (per-instance sampling)

Low (single backward pass)

Baseline dependency

Requires careful baseline selection

Uses background dataset

No baseline required

No baseline required

Typical use in diagnostics

Pixel-level attribution for radiology AI

Feature importance for tabular clinical data

Local explanation for individual patient predictions

Quick heatmap visualization for CNN classifiers

INTEGRATED GRADIENTS IN PRACTICE

Applications in Diagnostic AI

Integrated Gradients provides a principled, axiomatic approach to feature attribution, making it a critical tool for explaining complex diagnostic models to clinicians and regulators.

01

Radiology Report Generation

Integrated Gradients can highlight the specific pixels in a chest X-ray that most influenced a model's finding of pneumonia. By integrating gradients from a black baseline image to the patient's scan, the method generates a saliency map that localizes the pathology. This allows a radiologist to verify that the model is focusing on the lung parenchyma and not on spurious correlations like laterality markers or chest tubes, building trust in the automated diagnosis.

02

Pathology Slide Analysis

In digital pathology, a model may classify a whole-slide image as malignant. Integrated Gradients decomposes this prediction to identify the specific clusters of cells with atypical nuclei that drove the decision. The pathologist can then review these high-attribution regions to confirm mitotic figures or architectural distortion, effectively using the explanation as a triage tool that reduces the search space on a gigapixel image.

03

Genomic Variant Prioritization

When a deep learning model predicts a pathogenic variant from a patient's genomic sequence, Integrated Gradients assigns importance scores to each nucleotide. This reveals the precise missense mutations or splice-site disruptions that contributed to the classification. For a clinical geneticist, this attribution provides a ranked list of candidate causal variants, accelerating the interpretation of complex whole-exome sequencing data.

04

Multimodal Patient Deterioration Prediction

An ICU model fusing vital signs, lab values, and clinical notes can predict sepsis onset hours in advance. Integrated Gradients attributes the risk score back to each input feature, showing that a rising lactate level and a drop in platelet count were the primary drivers, while a specific phrase in a nursing note provided secondary confirmation. This multimodal explanation gives the care team a transparent, data-driven rationale for early intervention.

05

Ophthalmology Screening

For a model detecting diabetic retinopathy in fundus photographs, Integrated Gradients generates a pixel-level heatmap overlaying the retinal image. The explanation highlights microaneurysms, hemorrhages, and exudates that the model used for its grading. This visual evidence allows an ophthalmologist to quickly validate the model's severity assessment against established clinical grading scales like the ETDRS protocol, streamlining the screening workflow.

06

Electrocardiogram Arrhythmia Classification

A 1D convolutional neural network classifies a 12-lead ECG as showing atrial fibrillation. Integrated Gradients computes the contribution of each time step in each lead, revealing that the model focused on the absence of P-waves and an irregularly irregular R-R interval in lead II. This explanation maps directly to the diagnostic criteria a cardiologist uses, demonstrating that the model has learned clinically relevant waveform morphology.

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.