---
title: Path-Weighted Integrated Gradients
url: https://www.emergentmind.com/topics/path-weighted-integrated-gradients-pwig
type: topic
---

# Path-Weighted Integrated Gradients

Searching arXiv for recent and foundational papers on Path-Weighted Integrated Gradients and closely related Integrated Gradients variants.
Path-Weighted Integrated Gradients (PWIG) is a path-integral attribution method that generalizes Integrated Gradients (IG) by inserting a nonnegative weighting function along the path from a baseline \(x'\) to an input \(x\). In its generic straight-line form, the attribution for feature \(i\) is
\[
\mathrm{PWIG}_i(x;x')
=(x_i-x'_i)\int_0^1 g(\alpha)\,
\frac{\partial F\!\bigl(x'+\alpha(x-x')\bigr)}{\partial x_i}\,d\alpha,
\]
so standard IG is recovered when \(g(\alpha)=1\) [2509.17491]. The method arose from analyses of saturation effects in IG, where the model output often increases sharply at small \(\alpha\) and then flattens out, causing saturated regions to contribute disproportionately to the computed attribution [2010.12697]. Later work broadened PWIG into a family of weighting schemes, path choices, and equivalent stochastic formulations, and applied it to ImageNet evaluation, dementia classification, manifold-aware attribution, and layer-wise transformer analysis [2305.20052] [2405.09800] [2604.14338] [2606.29693].

## 1. Emergence from saturation analysis

The immediate precursor to PWIG is the saturation analysis of Miglani et al., who studied how different regions of the IG path contribute to attribution [2010.12697]. For a scalar target \(F:\mathbb{R}^n\to\mathbb{R}\), input \(x\), and baseline \(x'\), standard IG assigns
\[
IG_i(x;x')
=(x_i-x'_i)\int_0^1
\frac{\partial F\!\bigl(x'+\alpha(x-x')\bigr)}{\partial x_i}\,d\alpha,
\]
and satisfies completeness:
\[
\sum_{i=1}^n IG_i(x;x')=F(x)-F(x').
\]

Their central observation is that along the straight-line path \(x'+\alpha(x-x')\), the scalar output \(F\!\bigl(x'+\alpha(x-x')\bigr)\) often rises rapidly for small \(\alpha\) and then becomes flat. This motivates a partition of the path into an “unsaturated” region and a “saturated” region. Defining \(\Delta F \equiv F(x)-F(x')\), choosing a saturation threshold \(v\in(0,1)\) such as \(v=0.9\), and setting
\[
\alpha^*=\inf\{\alpha\in[0,1]\;:\;F(x'+\alpha(x-x'))\ge F(x')+v\Delta F\},
\]
one obtains an early segment \(\alpha<\alpha^*\) where the output has not yet reached \(v\Delta F\) above baseline, and a later segment \(\alpha>\alpha^*\) where the output is beyond that threshold. In practice, \(\alpha^*\) is found by evaluating \(F\) on a grid of \(\alpha\) values and selecting the smallest \(\alpha\) meeting the criterion.

This saturation-based decomposition led directly to reweighted variants of IG. In the simplest construction, the path weight is piecewise constant: \(w(\alpha)=1\) on the unsaturated region and \(w(\alpha)=\epsilon\ll1\) on the saturated region, with the extreme case \(\epsilon=0\) completely ignoring the saturated tail. When \(w(\alpha)=1\) for \(\alpha\le\alpha^*\) and \(0\) otherwise, PWIG reduces to “Left IG,” the unsaturated-only variant evaluated in the original study [2010.12697].

## 2. Formal definition and weighting families

A more general formalization defines PWIG on the straight-line path \(\gamma(\alpha)=x'+\alpha(x-x')\), \(\alpha\in[0,1]\), using a continuous weighting function \(g(\alpha)\ge 0\) [2509.17491]. The practical Riemann-sum approximation with \(m\) steps is
\[
\mathrm{PWIG}_i^{(m)}(x;x')
=(x_i-x'_i)\sum_{k=1}^m
g\!\left(\frac{k}{m}\right)
\frac{\partial F\!\bigl(x'+\tfrac{k}{m}(x-x')\bigr)}{\partial x_i}
\frac{1}{m}.
\]
In this formulation, the weighting function determines which parts of the path dominate the attribution.

Several weighting families have been explicitly proposed. Uniform weighting, \(g(\alpha)=1\), recovers IG and satisfies completeness. Exponential weighting, \(g(\alpha)=e^{c\alpha}\) with \(c>0\), emphasizes gradients near the input end \((\alpha\approx1)\); in the dementia-classification paper, \(c=1.0\) [2509.17491]. Polynomial or Beta-shaped weights, \(g(\alpha)=\alpha^p(1-\alpha)^q\), can emphasize early-path, late-path, or mid-path contributions. Custom shapes such as triangular functions, Gaussian bumps, or user-defined heuristics are intended to down-weight “noisy” regions of the interpolation.

A distinct but closely related construction appears in “Integrated Decision Gradients,” where the path-weighting function is taken to be the derivative of the output logit along the path,
\[
w(t)=\frac{d}{dt}F(x_t)=\nabla_x F(x_t)\cdot(x-x_{\rm ref}),
\qquad
x_t=x_{\rm ref}+t(x-x_{\rm ref}),
\]
and the attribution becomes
\[
A_i^{\rm PWIG}(x)
=\int_0^1
w(t)\,
\frac{\partial F(x_t)}{\partial x_i}\,
(x_i-x_{{\rm ref},i})\,dt
=\int_0^1
\frac{\partial F(x_t)}{\partial x_i}
\frac{dF(x_t)}{dt}\,dt.
\]
This specific weighting emphasizes the “decision region,” defined as the portion of the path where the output logit rapidly transitions from zero to its final value [2305.20052].

## 3. Axioms, completeness, and conceptual distinctions

In its generic form, PWIG retains several of IG’s axiomatic properties. The dementia-classification formalization states Implementation Invariance, Linearity, the Dummy Axiom / Sensitivity(b), and Symmetry–Preserving [2509.17491]. Implementation Invariance means that if two networks agree on all inputs, then their PWIG attributions agree. Linearity states that attributions distribute over affine combinations of networks. The Dummy Axiom assigns zero attribution to a feature on which \(F\) does not depend. Symmetry–Preserving equates attributions of symmetric inputs when the function and the baseline respect that symmetry.

Completeness is the main property that changes under arbitrary weighting. For general \(g\),
\[
\sum_i \mathrm{PWIG}_i(x)
=
\int_0^1 g(\alpha)\,
\frac{d}{d\alpha}F(\gamma(\alpha))\,d\alpha,
\]
which equals \(F(x)-F(x')\) if and only if \(g(\alpha)=1\) almost everywhere [2509.17491]. The path-sampled formulation makes the deviation explicit through the completeness residual
\[
R(g)=\Delta F-\sum_i \mathrm{PWIG}_i
=\int_0^1 (1-g(\alpha))\,F'(\alpha)\,d\alpha,
\]
where \(F'(\alpha)=\frac{d}{d\alpha}F(\gamma(\alpha))\) [2604.14338].

A recurring point of confusion is that not all papers use “PWIG” to denote the same mathematical object. The generic framework treats \(g\) as an externally chosen nonnegative function and therefore generally loses completeness unless \(g\equiv1\). By contrast, the IDG formulation argues that weighting by \(\frac{dF}{dt}\) is a bona-fide path integral and inherits Completeness, Sensitivity, Implementation-Invariance and Linearity under mild monotonicity assumptions, because the integral can be interpreted after reparameterizing by \(F\) [2305.20052]. This suggests that completeness claims in the PWIG literature depend on whether weighting is regarded as an arbitrary deformation of IG or as a special reparameterized path integral.

## 4. Numerical realization and algorithmic variants

A saturation-oriented PWIG implementation follows a fixed sequence of operations [2010.12697]. One first computes \(\Delta x=x-x'\), then evaluates \(z_k=x'+\alpha_k\Delta x\) and \(f_k=F(z_k)\) on a grid \(\alpha_k=k/m\), \(k=0,\ldots,m\). After setting \(\Delta F=f_m-f_0\), one finds the smallest \(k^*\) such that \(f_{k^*}\ge f_0+v\Delta F\), with \(\alpha^*=\alpha_{k^*}\). The weights are then chosen as \(w_k=1\) for \(k\le k^*\) and \(w_k=\epsilon\) otherwise, gradients \(g_k=\nabla_x F(z_k)\) are computed, and the integral is approximated by
\[
S_i=\sum_{k=1}^m w_k\,g_k[i]\frac{1}{m},
\qquad
PWIG_i=\Delta x[i]\cdot S_i.
\]
An optional renormalization step can enforce \(\sum_i PWIG_i\approx F(x)-F(x')\). The reported complexity is \(O(m\cdot\mathrm{cost}(F)+m\cdot n)\) per input.

The generic straight-line implementation in the dementia-classification formulation uses discretization \(\alpha_k=k/m\), evaluates \(\nabla F(x'+\alpha_k(x-x'))\) for \(k=1,\dots,m\), samples the analytic weight \(g(\alpha_k)\), and requires \(O(m)\) backward-passes; in those experiments, \(m=50\) [2509.17491]. Post-processing may include clipping or percentile filtering to suppress outliers.

IDG adds an adaptive sampling strategy designed to reduce Riemann-sum error in regions where uniform sampling wastes steps on flat segments [2305.20052]. The interval \([0,1]\) is first partitioned into \(N\) coarse bins, logit gains \(\Delta F_i=F(x_{(i+1)/N})-F(x_{i/N})\) are measured, and \(M\) fine samples are allocated proportionally as
\[
m_i=\mathrm{round}\!\left(
\frac{\Delta F_i}{F(x_1)-F(x_0)}\,M
\right).
\]
This concentrates evaluations where the output grows fastest. The paper recommends \(M=50\)–\(100\) as a quality/runtime trade-off and notes that setting \(N=M\) yields \(O(M)\) total evaluations.

## 5. Empirical behavior across vision and medical imaging

On ImageNet classification networks, Miglani et al. compared “Left IG,” “Right IG,” and standard IG on Inception-v3, ResNet-50, and VGG-19 using model faithfulness (ABPC) and noise sensitivity (Sens), with \(v=0.9\) and \(\alpha^*\) typically \(<0.5\) [2010.12697]. Averaged over 2500 ImageNet samples, LeftIG improved both faithfulness and stability relative to full IG.

| Model | LeftIG ABPC | Full IG ABPC |
|---|---:|---:|
| Inception-v3 | 0.2837 | 0.2486 |
| ResNet-50 | 0.1708 | 0.1464 |
| VGG-19 | 0.1417 | 0.1282 |

| Model | LeftIG Sens | Full IG Sens |
|---|---:|---:|
| Inception-v3 | 0.5341 | 0.5711 |
| ResNet-50 | 0.7706 | 0.8074 |
| VGG-19 | 0.5970 | 0.7122 |

In the same evaluation, RightIG was reported as much lower in faithfulness and substantially more sensitive to noise. Within the saturation-based interpretation, this supports the claim that unsaturated, early-path gradients better explain model behavior than gradients from flat regions [2010.12697].

The more explicitly decision-focused IDG evaluation used ImageNet 2012 validation, sampling 5 images per class across 1000 classes for 5000 images, and compared PWIG/IDG against IG, Left-IG, Guided IG, and adversarial gradient integration on ResNet-101, ResNet-152, and ResNeXt [2305.20052]. For ResNet-101, the reported metrics were: AIC \(0.571, 0.589, 0.626, 0.675, 0.701\); SIC \(0.498, 0.522, 0.559, 0.609, 0.638\); insertion \(0.498, 0.535, 0.547, 0.561, 0.592\); deletion \(0.181, 0.148, 0.155, 0.172, 0.108\) for IG, LIG, GIG, AGI, and PWIG respectively. Similar consistent improvements of approximately \(5\)–\(10\) points were observed on ResNet-152 and ResNeXt.

A separate application to dementia classification used the OASIS-1 MRI dataset with four labels—non-demented, very mild, mild, moderate—and a convolutional neural network with four conv-blocks, ReLU, max-pool, dropout \(0.5\), three fully connected layers, and softmax over 4 classes [2509.17491]. The scans were preprocessed to \(224\times224\) and normalized to ImageNet statistics. In that study, PWIG used \(g(\alpha)=e^\alpha\), \(m=50\), and clipping at the 60th and 95th percentiles. The reported validation accuracy was \(99.80\%\). Attribution maps were described as sharper than unweighted IG, with reduced spurious noise, and as emphasizing hippocampal, cortical, and subcortical atrophy in mild/moderate dementia; non-demented maps were diffuse, whereas moderate dementia maps concentrated on known pathology sites.

## 6. Extensions, equivalent formulations, and broader PWIG frameworks

One major extension replaces the straight-line path rather than only reweighting it. “Manifold Integrated Gradients” formulates attribution along an arbitrary path \(\gamma(t)\), with completeness \(\sum_i IG_i=F(x)-F(x')\), and then chooses \(\gamma\) to be a geodesic on a learned Riemannian data manifold [2405.09800]. In this setting, a general path-weighted form is
\[
PWIG_i(x;\gamma,w)
=
\int_0^1
w(t)\,
\frac{\partial F(\gamma(t))}{\partial \gamma_i(t)}\,
\dot\gamma_i(t)\,dt.
\]
The paper notes that one may take \(w(t)=\|\dot\gamma(t)\|_{G(\gamma(t))}\) so that contributions are proportional to manifold arc-length, and it reports improvements on Oxford-IIIT Pets and Oxford-102 Flowers in SENS\(_{\max}\), explanation infidelity, and SSI under targeted attribution attacks [2405.09800].

A second development establishes an exact connection between deterministic weighting and stochastic baseline sampling. “Path-Sampled Integrated Gradients” defines
\[
PSIG_i(x;x';p)=\mathbb{E}_{s\sim p}[IG_i(x;b_s)],
\qquad
b_s=x'+s(x-x'),
\]
and proves that if \(G(\alpha)=\int_0^\alpha p(s)\,ds\), then
\[
PSIG_i(x;x';p)=PWIG_i(x;x';g)
\quad\text{with}\quad
g(\alpha)=G(\alpha).
\]
This equivalence yields a deterministic CDF-weighted Riemann sum with \(O(m^{-1})\) error for smooth models, compared with Monte Carlo RMSE \(O(m^{-1/2})\), and gives a variance-reduction result under a white-noise model of gradient perturbations: for uniform sampling, \(G(\alpha)=\alpha\), so \(\mathrm{Var}_{PS}=\mathrm{Var}_{IG}/3\) [2604.14338].

A third extension adapts path-weighting ideas to internal model states rather than input space. “IG-Lens” constructs a piecewise-linear path through transformer hidden states and attributes each segment to the layer it terminates at [2606.29693]. For a scalar softmax-probability readout \(f(h)\), the exact segment integral satisfies
\[
IG_{L_j}=f(h_{L_j})-f(h_{L_{j-1}}),
\]
and the sum over layers telescopes to \(p_{\rm final}-p_{\rm baseline}\). The default estimator is “prediction-aware”: each discrete step is credited its observed change in target probability rather than its raw gradient. According to the paper, this removes Riemann discretization error, suppresses steps that show gradient sensitivity without a change in output, and admits a single-pass batched implementation with no backward call.

Taken together, these developments position PWIG less as a single algorithm than as a general design space for attribution. Within that design space, one may alter the weighting function \(g\), the path \(\gamma\), the sampling scheme, or the state space over which integration is performed. The common theme is selective emphasis: early versus late path segments, saturated versus unsaturated regions, decision regions, manifold-respecting trajectories, sampled intermediate baselines, or layer-wise hidden-state transitions.

Source: https://www.emergentmind.com/topics/path-weighted-integrated-gradients-pwig