When we try to understand why a deep neural network made a specific prediction, our first instinct is often to look at the model's gradients. By calculating the derivative of the output with respect to the input features, we can see how a tiny change in a pixel, word, or numerical value shifts the final decision. Early interpretability methods relied heavily on these local gradients to generate feature importance heatmaps, as explored by David Baehrens et al. in How to Explain Individual Classification Decisions and Marco Melis et al. in Explaining Black-box Android Malware Detection.
However, local gradients suffer from a fundamental mathematical flaw: gradient saturation. Path-integrated gradients solve this problem by shifting our focus from a single point in the input space to a continuous trajectory.
The Saturation Problem: Why Local Gradients Blindside Us
To understand gradient saturation, imagine a simple threshold function or a non-linear activation like a sigmoid. Suppose the model outputs a high risk score if a patient's blood pressure is over 140. If a patient arrives with a blood pressure of 180, the model correctly flags them as high risk.
If we calculate the local gradient at $x = 180$, what do we find? Because the model is already completely certain, the prediction curve is perfectly flat at that point. A tiny increase to 181 or a tiny decrease to 179 changes the output probability by exactly zero. Consequently, the local gradient is zero. A naive gradient explanation would conclude that blood pressure had absolutely no impact on the model's decision, even though it was the sole reason the risk flag was triggered.
As highlighted by Alejandro Varela-Rial et al. in PlayMolecule Glimpse: Understanding Protein-Ligand Property Predictions with Interpretable Neural Networks and Julius Adebayo et al. in Local Explanation Methods for Deep Neural Networks Lack Sensitivity to Parameter Values, this flattening effect means local derivatives fail to capture the cumulative impact of features that drive a model into a saturated state.
The Core Mechanism of Path Integration
Instead of evaluating the gradient only at the final input $x$, path-based attribution methods consider the entire journey of how the feature was introduced to the model.
To do this, we choose a neutral reference point called a baseline ($x'$), which represents the absence of features (such as a completely black image, an empty text embedding, or a vector of zeros). We then define a path $\gamma(t)$ that connects the baseline to our actual input $x$, where $t$ scales from 0 (at the baseline) to 1 (at the input).
Baseline x' (t=0) ───────────────────► Target Input x (t=1)
▲
Sample gradients along
the continuous path
By integrating the gradients along this path, we capture the behavior of the model at every intermediate stage. In the blood pressure example, as our path moves from the baseline of 0 to the target of 180, it crosses the threshold of 140. At that crossing point, the gradient spikes dramatically. By integrating along the path, we capture that spike, ensuring the feature receives its rightful share of credit.
This formulation was popularized as Integrated Gradients by Mukund Sundararajan et al. in Axiomatic Attribution for Deep Networks. Mathematically, the integrated gradient for the $i$-th feature is defined as:
$$\text{IntegratedGrad}_i(x) = (x_i - x'_i) \times \int_{0}^{1} \frac{\partial F(\gamma(t))}{\partial \gamma_i(t)} dt$$
By accumulating these derivatives, the method satisfies a crucial property called Completeness (or Efficiency). Thanks to the Fundamental Theorem of Calculus, the sum of the attributions across all features is guaranteed to equal the exact difference between the model's output at the input and its output at the baseline:
$$\sum_{i} \text{IntegratedGrad}_i(x) = F(x) - F(x')$$
As shown by Huiqi Deng et al. in A Unified Taylor Framework for Revisiting Attribution Methods, this mathematical accounting ensures that high-order interaction effects and non-linear contributions are fully captured and distributed without any arbitrary loss of information.
Why It Works: The Axiomatic Guarantee
Path integration is not just an intuitive heuristic; it is a mathematically forced solution. When designing an explanation method, we want it to obey certain logical rules, or axioms:
- Sensitivity: If two inputs differ in a single feature and have different predictions, that feature must receive a non-zero attribution.
- Implementation Invariance: If two neural networks are functionally identical (i.e., they give the exact same outputs for every possible input), their explanations must be identical, regardless of how the internal layers are structured.
- Reparameterization Invariance: The explanation should remain consistent even if we change the coordinate system or units of the input features.
In their foundational work, Mukund Sundararajan et al. proved that path-integrated gradients uniquely satisfy both Sensitivity and Implementation Invariance. Expanding on this from first principles, Damien Garreau et al. in Feature Attribution from First Principles and Cenwei Zhang et al. in Axiomatic On-Manifold Shapley via Optimal Generative Flows demonstrated that when you constrain an attribution framework to satisfy these logical axioms, the solution mathematically converges to a gradient line integral.
This theoretical grounding explains why the method yields highly robust results across diverse domains, from auditing medical neuroimaging volumes (Kevin Guo et al., Anatomic Interpretability in Neuroimage Deep Learning: Saliency Approaches for Typical Aging and Traumatic Brain Injury) to identifying key environmental drivers in ecological models (Zhi Huang et al., Unveiling environmental indicators of algal blooms using interpretable AI).
From Continuous Math to Practical Computation
In a continuous mathematical space, we would evaluate an infinite number of gradients along the path. In practice, we must approximate this integral.
The standard approach uses a Riemann sum, sampling a finite number of discrete "anchor points" along the trajectory, as described by Xianquan Wang et al. in FairFS: Addressing Deep Feature Selection Biases for Recommender System. By averaging the gradients computed at these sampled steps, we obtain a close approximation of the true integral.
Continuous Path: ───────────────────────────────────────────
Discrete Samples: ───●───────●───────●───────●───────●───────►
However, sampling introduces approximation errors. To bypass this entirely for specific network architectures, Matthew Sotoudeh et al. introduced a tool called SyReNN in SyReNN: A tool for analyzing deep neural networks. Because deep ReLU networks are piecewise-linear functions, their behavior consists of a finite collection of linear segments. Instead of guessing via sampling, the authors show that you can compute exact symbolic representations over these precise linear boundaries, replacing approximations with exact mathematical values.
Choosing the Right Path
The original Integrated Gradients formulation uses a straight-line path in the input space: $\gamma(t) = x' + t(x - x')$. While computationally straightforward, a straight line can inadvertently force the model to evaluate highly unrealistic inputs that lie outside the natural data distribution (off-manifold). For instance, interpolating linearly between a blank baseline and an image of a face might create a blurry, unnatural artifact that the model was never trained to understand.
To address this, recent research focuses on changing the path itself to ensure it stays "on-manifold":
- Generative Flows: Cenwei Zhang et al. in Axiomatic On-Manifold Shapley via Optimal Generative Flows propose using kinetic-energy-minimizing generative flows (Wasserstein-2 geodesics) as the path. This ensures that every intermediate point along the trajectory looks like a valid, realistic data point.
- Adversarial Paths: The authors of Explaining Deep Neural Network Models with Adversarial Gradient Integration route the path along the trajectory of steepest ascent from an adversarial example back to the target input. This linearizes the path within the model's internal feature space rather than the raw input space, capturing the model's internal logic more accurately.
By evolving how we define the trajectory from absence to presence, path integration bridges the gap between foundational mathematical axioms and the practical need for faithful, human-interpretable AI explanations.
Key Foundational Work
How to Explain Individual Classification Decisions (2009) — contributed 1 concept elements to this direction.
Axiomatic Attribution for Multilinear Functions (2011) — contributed 1 concept elements to this direction.