Inferensys

Glossary

Integrated Gradients

A model-agnostic attribution method that computes the path integral of gradients from a baseline state to the actual input to identify influential features.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
AXIOMATIC ATTRIBUTION

What is Integrated Gradients?

A model-agnostic feature attribution method that satisfies the axioms of Sensitivity and Implementation Invariance by computing the path integral of gradients from a baseline to the input.

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

The attribution for a feature is formally defined as the path integral of the model's gradient with respect to that feature, scaled by the difference between the input and the baseline. In practice, this integral is approximated using a Riemann sum over a finite number of interpolated steps. By selecting an appropriate baseline—such as a black image for vision tasks or a zero-embedding vector for text—the method provides a theoretically grounded decomposition of the output prediction, making it a widely adopted standard for debugging and auditing neural network decisions.

AXIOMATIC ATTRIBUTION

Key Properties of Integrated Gradients

Integrated Gradients is defined by a set of mathematical axioms that guarantee its attributions are both theoretically sound and practically reliable for auditing deep networks.

01

Sensitivity (Completeness)

The sum of all feature attributions equals the difference between the model's output at the input and the baseline. This conservation law ensures no attribution is artificially created or destroyed.

  • If two inputs differ in exactly one feature and produce different predictions, that feature receives non-zero attribution.
  • Guarantees that the explanation accounts for the total output change.
  • A constant function always receives zero attributions for all features.
02

Implementation Invariance

Two functionally equivalent networks—models that produce identical outputs for all possible inputs—will always receive identical attributions. This property is critical for model-agnostic auditing.

  • The explanation depends solely on the mathematical function, not its architecture.
  • Prevents explanation manipulation through functionally neutral architectural changes.
  • Distinguishes Integrated Gradients from gradient-only methods like vanilla saliency maps.
03

Linearity

If a model is a linear combination of two sub-models, the attribution is the same linear combination of the individual attributions. This enables compositional debugging of ensemble systems.

  • Supports attribution for ensembles and stacked architectures.
  • Allows decomposing a complex model's explanation into interpretable sub-components.
  • Preserves the mathematical structure of the model in the explanation space.
04

Symmetry

Symmetric variables—features that play identical roles in the model and are swapped without changing the output—receive identical attributions. This ensures fair treatment of functionally equivalent inputs.

  • Two pixels with identical color values in a symmetric image region get equal attribution.
  • Prevents explanation bias toward arbitrary input ordering.
  • Essential for explaining models with permutation-invariant architectures like Deep Sets.
05

Path Integral Formulation

Attributions are computed by accumulating gradients along a straight-line path from a baseline (representing absence of signal) to the actual input. This captures how each feature incrementally contributes to the prediction.

  • The baseline is typically a zero embedding vector or black image.
  • The integral is approximated via Riemann sum with 20–300 steps.
  • Choosing a meaningful baseline is critical: a black image baseline explains why an object is present, not why it is dark.
06

Completeness Axiom

The completeness axiom mathematically guarantees that Integrated Gradients is the unique path method satisfying both sensitivity and implementation invariance. This foundational result from cooperative game theory provides theoretical grounding.

  • Formally: Σᵢ IGᵢ(x) = F(x) − F(x′), where x′ is the baseline.
  • Links directly to the Aumann-Shapley value in cost-sharing theory.
  • Provides a rigorous alternative to heuristic attribution methods lacking axiomatic guarantees.
INTEGRATED GRADIENTS EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the Integrated Gradients attribution method, its mathematical foundations, and its practical application in auditing deep learning models.

Integrated Gradients is a model-agnostic feature attribution method that computes the contribution of each input feature to a model's prediction by accumulating gradients along a straight-line path from a baseline input to the actual input. The method satisfies two fundamental axioms: Sensitivity (if a feature change alters the output, that feature receives non-zero attribution) and Implementation Invariance (functionally equivalent networks produce identical attributions).

Mathematically, the attribution for feature i is defined as:

code
IntegratedGrads_i(x) = (x_i - x'_i) × ∫_{α=0}^{1} ∂F(x' + α(x - x'))/∂x_i dα

where x is the input, x' is the baseline, and F is the model. In practice, the integral is approximated using a Riemann sum over m interpolation steps, typically 20 to 300. The baseline is chosen to represent a neutral or information-free input—for images, a black image; for text, zero embeddings; for tabular data, a vector of feature means. The method's path integral formulation ensures that attributions sum to the difference between the model's output at the input and at the baseline, a property known as Completeness.

ATTRIBUTION METHOD COMPARISON

Integrated Gradients vs. Other Attribution Methods

A feature-level comparison of Integrated Gradients against Gradient*Input, DeepLIFT, LIME, and SHAP across key properties for model interpretability.

FeatureIntegrated GradientsGradient*InputDeepLIFTLIMESHAP

Axiom: Completeness

Axiom: Sensitivity(a)

Axiom: Implementation Invariance

Requires Baseline Input

Model-Agnostic

Computational Cost

High (50-300 steps)

Low (single pass)

Medium (single pass)

High (sampling)

Very High (sampling)

Handles Discrete Features

Theoretical Foundation

Path Integral

Gradient*Input

Reference-Based Rules

Local Surrogate

Shapley Values

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.