Table of Contents
Fetching ...

Riemann Sum Optimization for Accurate Integrated Gradients Computation

Swadesh Swain, Shree Singhi

TL;DR

RiemannOpt tackles noise and computational cost in gradient-based attributions by precomputing model-specific optimal sampling points for Riemann-sum integration along attribution paths. By deriving a 1D upper bound on left-Riemann-sum error $|R-I| \lesssim \tfrac{1}{2} \sum_i |g'(\alpha_i)|(\alpha_{i+1}-\alpha_i)^2$ and generalizing to multi-dimensional line integrals, it selects a small set of optimal sampling positions $\{\alpha_i\}$ using a subset of images and Powell's method, then applies these points across the full dataset. The method enhances IG, BlurIG, and Guided IG attributions, achieving up to a $20\%$ improvement in Insertion Scores and up to a $4\times$ reduction in computation, with particularly strong gains for BlurIG. It also demonstrates that the optimal sampling points generalize across images, enabling practical deployment in real-time or resource-constrained settings. Future work includes extending the approach to additional adaptive-path attribution methods and exploring augmentation-driven shifts in optimal sampling.

Abstract

Integrated Gradients (IG) is a widely used algorithm for attributing the outputs of a deep neural network to its input features. Due to the absence of closed-form integrals for deep learning models, inaccurate Riemann Sum approximations are used to calculate IG. This often introduces undesirable errors in the form of high levels of noise, leading to false insights in the model's decision-making process. We introduce a framework, RiemannOpt, that minimizes these errors by optimizing the sample point selection for the Riemann Sum. Our algorithm is highly versatile and applicable to IG as well as its derivatives like Blur IG and Guided IG. RiemannOpt achieves up to 20% improvement in Insertion Scores. Additionally, it enables its users to curtail computational costs by up to four folds, thereby making it highly functional for constrained environments.

Riemann Sum Optimization for Accurate Integrated Gradients Computation

TL;DR

RiemannOpt tackles noise and computational cost in gradient-based attributions by precomputing model-specific optimal sampling points for Riemann-sum integration along attribution paths. By deriving a 1D upper bound on left-Riemann-sum error and generalizing to multi-dimensional line integrals, it selects a small set of optimal sampling positions using a subset of images and Powell's method, then applies these points across the full dataset. The method enhances IG, BlurIG, and Guided IG attributions, achieving up to a improvement in Insertion Scores and up to a reduction in computation, with particularly strong gains for BlurIG. It also demonstrates that the optimal sampling points generalize across images, enabling practical deployment in real-time or resource-constrained settings. Future work includes extending the approach to additional adaptive-path attribution methods and exploring augmentation-driven shifts in optimal sampling.

Abstract

Integrated Gradients (IG) is a widely used algorithm for attributing the outputs of a deep neural network to its input features. Due to the absence of closed-form integrals for deep learning models, inaccurate Riemann Sum approximations are used to calculate IG. This often introduces undesirable errors in the form of high levels of noise, leading to false insights in the model's decision-making process. We introduce a framework, RiemannOpt, that minimizes these errors by optimizing the sample point selection for the Riemann Sum. Our algorithm is highly versatile and applicable to IG as well as its derivatives like Blur IG and Guided IG. RiemannOpt achieves up to 20% improvement in Insertion Scores. Additionally, it enables its users to curtail computational costs by up to four folds, thereby making it highly functional for constrained environments.
Paper Structure (13 sections, 9 equations, 4 figures, 1 table, 1 algorithm)

This paper contains 13 sections, 9 equations, 4 figures, 1 table, 1 algorithm.

Figures (4)

  • Figure 1: Visual comparison of Integrated Gradient methods with and without RiemannOpt. For IG, RiemannOpt suppresses the noise around the Spoonbill and also slightly concentrates stronger attribution scores on the mouse trap. Applying RiemannOpt to BlurIG significantly increases concentration on the subjects of images. GIG saliency maps remain perceptually similar.
  • Figure 2: Estimated $|g'(\alpha)|$ and comparison of 16 linearly spaced samples and 16 optimal samples chosen by RiemannOpt. High values of $|g'(\alpha)|$ indicate regions of the path where the gradients of the model are rapidly changing, i.e. regions where the image becomes perceptible to the model.
  • Figure 3: We compare RiemannOpt against the baseline methods using the Insertion Score and Normalized Insertion Score. We observe noticeable improvement for BlurIG and IG.
  • Figure 4: $|g'(\alpha)|$ plots for individual images. The shapes of the plots and the generated optimal points are similar, highlighting the generalizability of the algorithm to images across the dataset.