---
title: Integrated Gradients for Model Explanations
url: https://www.emergentmind.com/topics/integrated-gradients-ig
type: topic
---

# Integrated Gradients for Model Explanations

Integrated Gradients (IG) is a rigorously axiomatized feature attribution method for explaining predictions of differentiable models, especially deep neural networks. IG attributes to each input feature the portion of the model output that accrues along the path from a chosen baseline input to the actual input, summing local gradients in feature space. Its mathematical, algorithmic, and axiomatic properties, together with a variety of enhancements addressing computational and statistical fidelity, have established IG as a central method in Explainable AI (XAI).

## 1. Mathematical Formulation and Axiomatic Foundations

IG assigns to each input feature $i$ an attribution based on the integral of the gradient of the model output along the straight-line path from a reference baseline $x' \in \mathbb{R}^d$ to the input $x \in \mathbb{R}^d$:

\[
\mathrm{IG}_i(x; x', F) = (x_i - x'_i)\int_{0}^{1} \frac{\partial F(x' + \alpha(x-x'))}{\partial x_i} \, d\alpha
\]

In discrete form, using $m$ evenly spaced steps $\alpha_k = k/m$ over the interval $[0,1]$:

\[
\mathrm{IG}_i(x; x', F) \approx (x_i - x'_i)\frac{1}{m} \sum_{k=1}^{m} \frac{\partial F(x' + \frac{k}{m}(x-x'))}{\partial x_i}
\]

IG satisfies several key axioms under mild regularity conditions:

- **Implementation Invariance**: Attributions depend only on the input–output functional mapping.
- **Sensitivity**: Features with no effect on the output receive zero attribution.
- **Completeness**: $\sum_i \mathrm{IG}_i(x; x', F) = F(x) - F(x')$.
- **Linearity**: Attributions decompose linearly for ensembles of models.
- **Symmetry-Preservation**: Attributions are equal for features that are symmetric in both the function and inputs.

Advanced characterization theorems show IG is the unique path-based attribution method that is symmetry-preserving, scale-invariant, affinely invariant, and proportionally splits credit among features for monomial functions, provided one restricts to straight-line paths and, in the most general function classes, adds a non-decreasing positivity axiom [2306.13753][2103.13533][2202.11912].

## 2. Discrete Approximation and Optimized Integration Grids

Since the IG path integral is usually intractable, numerical integration via Riemann sums is standard. Uniformly spaced steps are commonly used, but two key concerns arise:

- **Computational Overhead**: Typical implementations require $m \sim 200$–$1\,000$ forward and backward passes.
- **Discretization Noise**: Uniform grids waste steps in flat regions, contributing minimal value to the integral while increasing noise, and may converge slowly in regions where the model output rapidly changes [2410.04118].

Recent methods optimize the placement of interpolation points to accelerate convergence:

| Method               | Core Idea                                                      | Sample Allocation                          | Speedup       |
|----------------------|---------------------------------------------------------------|--------------------------------------------|---------------|
| Uniform IG           | Riemann sum with equal α-step intervals                       | $m$ uniform steps                          | Baseline      |
| Non-uniform IG [2302.11107] | Allocate more steps to intervals with large output change            | $m_j \propto \sqrt{|\Delta f_j|}$ across $n_{\mathrm{int}}$ intervals | $2.6$–$3.6\times$ |
| RiemannOpt [2410.04118]    | Optimize Riemann grid by minimizing error upper bound             | Solve $\min_{\{\alpha_j\}} \sum_j |g'(\alpha_j)|(\Delta\alpha_j)^2$   | $2$–$4\times$   |

These approaches permit empirical speedups of $2.6$–$3.6\times$ without loss of attribution accuracy, with negligible pre-processing cost (≤$3.2\%$ overhead) [2302.11107]. Error bounds depend on the smoothness of the gradient along the path; adaptive methods concentrate steps where $|\partial F/\partial\alpha|$ or its derivative is large, thereby reducing discretization error [2410.04118].

## 3. Path Selection, Model-Specific and Data-Manifold Paths

The standard IG uses a fixed, straight-line path from $x'$ to $x$. However, several phenomena motivate data- or model-adaptive path selection:

- **Off-manifold and regionally flat paths**: Straight-line paths may traverse irrelevant or low-density regions, accumulating spurious gradients, especially in vision models with hard data manifolds or in NLP models with inherently discrete input spaces [2108.13654][2405.09800][2502.12108].
- **Noise accumulation**: Uniform paths may accumulate noise where the gradient norm is high but orthogonal to the decision boundary, yielding attributions that highlight distractor or background regions [2106.09788][2303.14242].

Proposed remedies include:

- **Guided IG**: Selects adaptive, model-dependent paths that move features with minimal sensitivity, thereby avoiding noisy or off-manifold regions, and preserving IG completeness and symmetry properties [2106.09788].
- **Geodesic Paths/GIG/MIG**: Integrate along geodesics with respect to a Riemannian metric induced either by the model's Jacobian [2502.12108] or by a data manifold learned by generative models [2405.09800]. These methods minimize the total "energy" or path-length with respect to the model's geometry, yielding attributions that better respect the statistical support of the input distribution and, in some settings, satisfying "strong completeness" (sum of absolute attributions equals the output difference).
- **Discretized IG for NLP**: In discrete spaces, such as word embeddings, non-linear or monotone paths traversing valid words/anchors improve faithfulness by reducing out-of-distribution errors relative to naive linear interpolation [2108.13654].

## 4. Baseline Selection and Shapley-Value Connections

Choice of baseline $x'$ is critical for producing unbiased and interpretable attributions:

- **Single baseline**: Commonly, black images or all-zero vectors are used, but these may lie far from the data manifold and inject artifacts.
- **Multiple baselines and Shapley IG**: By connecting IG to the Aumann–Shapley value from cooperative game theory, a distribution over baselines (sampling from coalitions) better approximates Shapley values and yields more robust and semantically focused explanations. The Shapley Integrated Gradients (SIG) method samples baselines according to coalition size and averages the resulting IG attributions [2310.04821].

Completeness holds in expectation over the baseline distribution.

## 5. Noise Mitigation and Enhanced Attribution Fidelity

Several recent extensions address both the statistical and visual fidelity of IG:

- **Important-Direction Integration (IDGI)**: Allocates more integration effort to path segments where directional sensitivity is highest, reducing discretization noise and empirically improving metrics such as insertion/deletion AUC and infidelity [2303.14242].
- **Pattern-Guided IG (PGIG)**: Multiplies input gradients by feature-wise pattern weights encoding input–target covariances (from PatternAttribution), suppressing noise dimensions while retaining path-based sensitivity [2007.10685].
- **Path-Weighted IG (PWIG)**: Incorporates a nonnegative weight function along the interpolation parameter to selectively emphasize critical portions of the path, which can enhance sparsity, stability, or focus, at the cost of strict completeness unless normalization is carefully maintained [2509.17491].

## 6. Specialized and Domain-Adapted Applications

IG has been adapted for a wide spectrum of tasks and domains:

- **Vision**: Low-latency hardware-aware IG with non-uniform interpolation for real-time explanations [2302.11107]. Attributions in image classification and medical imaging (e.g., MRI diagnosis) [2509.17491].
- **Natural Language Processing**: Word-level and phrase-level attributions for sentiment, agency, and other sociopsychological markers, with task-driven postprocessing for interpretability [2503.04989]. Overfitting small-label classifiers to bootstrap dictionaries of marker-vocabulary.
- **Graphs**: Graph-based IG (GB-IG) averages discrete pathwise gradients over shortest-paths in node-feature space, circumventing the absence of a unique straight-line interpolation on discrete structures [2509.07648].
- **Photonic Inverse Design**: Pixel-wise IG attributions for CNN surrogates yield physically meaningful design insights in nanophotonics [2510.22176].
- **Knowledge Distillation**: Precomputed IG maps from teacher models serve as an effective data-augmentation for model compression, improving student–teacher alignment and empirical test accuracy [2506.14440].
- **Adversarial Robustness**: IG and its variants are deployed to generate or defend against transferable adversarial examples. Path diversity, monotonicity, and the use of multiple baselines, as in MuMoDIG, sharply enhance transferability in attacks [2412.18844].

## 7. Practical Recommendations and Limitations

- **Step count $m$**: Use adaptive or optimized step allocation (e.g., non-uniform, RiemannOpt) to attain high-fidelity attributions with reduced computational burden [2302.11107][2410.04118].
- **Path choice**: In vision and text settings, model- or data-aware paths yield more reliable attributions, especially when data distribution or functional geometry is highly non-linear [2502.12108][2405.09800][2106.09788].
- **Baseline selection**: Sophisticated baseline strategies (e.g., sampling from meaningful coalitions or the data manifold) align attributions with human expectations and reduce bias [2310.04821].
- **Noise handling**: Employ direction-aware, pattern-guided, or path-weighted extensions to mitigate discretization or gradient noise [2007.10685][2303.14242][2509.17491].
- **Domain adaptation**: For graph data, discrete path-based averaging is necessary; for NLP, maintain on-manifold paths to legitimate word embeddings [2108.13654][2509.07648].
- **Limitations**: IG attributions' faithfulness is contingent on path, baseline, and step-count choices. Attribution completeness can be affected in weighted or non-canonical variants unless normalization is enforced. Noise reduction and path adaptation introduce hyperparameters (e.g., number or proportion of directions, weight function $w(\alpha)$) requiring tuning.

## References

- Non-Uniform Interpolation IG: [2302.11107]
- Riemann-optimized Integration: [2410.04118]
- Four Axiomatic Characterizations, Uniqueness: [2306.13753][2103.13533][2202.11912]
- Geodesic Path and Manifold IG: [2502.12108][2405.09800]
- Guided IG for Noise Reduction: [2106.09788][2303.14242]
- Path-Weighted and Pattern-Guided IG: [2509.17491][2007.10685]
- Shapley Baselines: [2310.04821]
- Discretized IG in NLP: [2108.13654][2503.04989]
- Graph-Structured Data: [2509.07648]
- Photonic Inverse Design: [2510.22176]
- Knowledge Distillation via IG: [2506.14440]
- Transferable Adversarial Examples: [2412.18844]

IG and its extensions constitute a mature, theoretically anchored approach to model attribution. Advanced path, baseline, and integration grid adaptations are essential to deploy IG as a robust XAI methodology in diverse and demanding application settings.

Source: https://www.emergentmind.com/topics/integrated-gradients-ig