VarGrad is a method that quantifies the epistemic uncertainty of a feature attribution map by adding isotropic Gaussian noise to the input and computing the variance of the resulting gradient vectors. Unlike standard saliency maps that provide a single point estimate of feature importance, VarGrad produces a pixel-wise uncertainty map that reveals where the model's gradient signal is unstable or unreliable, effectively distinguishing between robust and fragile explanations.
Glossary
VarGrad

What is VarGrad?
VarGrad is a technique for measuring the uncertainty of a gradient-based saliency map by computing the variance of gradients obtained from multiple noisy copies of the same input.
The technique operates by sampling N noisy versions of the input x + ε where ε ~ N(0, σ²), computing the gradient of the target class with respect to each noisy input, and then calculating the variance across these gradient samples. This variance map highlights regions where small input perturbations cause large fluctuations in the gradient, indicating low local Lipschitz continuity and potentially unreliable attributions. VarGrad is closely related to SmoothGrad, which averages gradients to reduce visual noise, but VarGrad specifically isolates the uncertainty component rather than the smoothed signal.
Key Characteristics of VarGrad
VarGrad is a technique that measures the uncertainty of a gradient-based saliency map by computing the variance of the gradients obtained from multiple noisy versions of the same input. It distinguishes reliable feature attributions from noise.
Core Mechanism: Variance of Noisy Gradients
VarGrad operates by adding isotropic Gaussian noise to the input multiple times and computing the gradient of the model's output with respect to each noisy copy. The final saliency map is the variance of these sampled gradients, not the mean. This highlights features where the model's sensitivity is inconsistent under small perturbations, effectively suppressing background noise and sharpening the explanation.
Distinction from SmoothGrad
While both methods add noise to the input, their objectives are opposite:
- SmoothGrad: Computes the mean of the gradients to reduce visual noise and create a sharper map.
- VarGrad: Computes the variance of the gradients to measure the uncertainty of the attribution itself. VarGrad answers 'How reliable is this saliency map?' rather than just 'What is important?'
Uncertainty Quantification for Explanations
VarGrad provides a pixel-wise or feature-wise uncertainty estimate for any gradient-based saliency method. A high variance indicates that the model's gradient is unstable in that region, suggesting the attribution may be unreliable or an artifact of the network's non-linearities. This is critical for high-stakes applications like medical imaging where explanation trustworthiness is paramount.
Detecting Shattered Gradients
Deep neural networks often suffer from shattered gradients, where the gradient with respect to the input resembles white noise. VarGrad naturally identifies this phenomenon: if the variance map is uniformly high and unstructured, it indicates that the underlying saliency map is dominated by noise rather than meaningful features. This serves as a diagnostic tool for explanation quality.
Computational Considerations
VarGrad requires multiple forward and backward passes (typically 20-50 samples) per input to compute a stable variance estimate. This increases computational cost linearly with the number of noise samples. However, the process is embarrassingly parallel and can be batched efficiently on GPUs. The trade-off is acceptable when explanation reliability is more critical than real-time latency.
Integration with Other Attribution Methods
VarGrad is a meta-method that can wrap any gradient-based attribution technique:
- Vanilla Gradients: VarGrad on raw gradients reveals basic sensitivity uncertainty.
- Integrated Gradients: Applying VarGrad to IG attributions quantifies the stability of the path integral.
- Grad-CAM: VarGrad on Grad-CAM gradients assesses the reliability of localization maps. This composability makes it a versatile tool in the explainability toolkit.
Frequently Asked Questions
Clear answers to common questions about VarGrad, a technique for quantifying the uncertainty and stability of gradient-based saliency maps.
VarGrad is a technique for measuring the uncertainty of a gradient-based saliency map by computing the variance of the gradients obtained from multiple noisy versions of the same input. It works by adding isotropic Gaussian noise to the input image multiple times, computing the standard saliency map (e.g., vanilla gradient or Gradient × Input) for each noisy copy, and then calculating the pixel-wise variance across these maps. A high variance at a pixel location indicates that the model's attribution for that feature is highly sensitive to small input perturbations, signaling low confidence in its importance. Conversely, low variance suggests a stable, reliable attribution. This process effectively disentangles the signal of true feature importance from the noise caused by the model's non-linear loss surface.
VarGrad vs. Related Gradient-Based Techniques
A feature-level comparison of VarGrad against other gradient-based saliency methods that address visual noise and uncertainty in feature attribution maps.
| Feature | VarGrad | SmoothGrad | Integrated Gradients | Expected Gradients |
|---|---|---|---|---|
Primary Objective | Quantify uncertainty of saliency maps via variance | Sharpen saliency maps by reducing visual noise | Satisfy axiomatic properties (completeness, sensitivity) | Unify Integrated Gradients with SHAP framework |
Core Mechanism | Computes variance of gradients across multiple noisy samples | Averages gradients from noisy copies of the same input | Integrates gradients along a straight-line path from baseline to input | Averages gradients over a distribution of background samples |
Output Type | Mean saliency map + uncertainty map (variance) | Single denoised saliency map | Single attribution map with completeness guarantee | Single attribution map approximating SHAP values |
Noise Model | Additive Gaussian noise with multiple samples | Additive Gaussian noise with multiple samples | No noise; uses linear interpolation path | Gaussian noise added to background distribution samples |
Uncertainty Quantification | ||||
Satisfies Completeness Axiom | ||||
Satisfies Implementation Invariance | ||||
Computational Cost | High (requires many noisy forward/backward passes) | Moderate (requires multiple noisy backward passes) | Moderate to high (requires multiple interpolated backward passes) | High (requires sampling from background distribution) |
Baseline Dependency | No baseline required | No baseline required | Requires user-defined baseline input | Requires background distribution of samples |
Shattered Gradient Mitigation | Quantifies noise rather than removing it | Partially mitigates via averaging | Mitigates via path integration | Mitigates via expectation over background |
Best Use Case | Auditing model reliability and identifying ambiguous features | Generating visually clean saliency maps for presentation | Regulatory compliance requiring axiomatic guarantees | Unified feature importance with SHAP-like properties |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core techniques and concepts that contextualize VarGrad's approach to measuring attribution uncertainty through gradient variance.
SmoothGrad
The direct precursor to VarGrad. SmoothGrad averages the gradients computed from multiple noisy copies of the same input to reduce visual noise in saliency maps. While SmoothGrad returns only the mean saliency map, VarGrad extends this by computing the variance across those noisy samples, quantifying the model's local sensitivity and the reliability of the attribution itself.
Saliency Map
A heatmap visualization that highlights the input features (pixels, words) that most influence a neural network's prediction. VarGrad operates directly on these maps, using the variance of the gradient to identify regions where the saliency value is unstable. A high VarGrad value indicates that the saliency map's intensity at that pixel is highly sensitive to small input perturbations.
Shattered Gradient
A phenomenon where the gradient of a deep network with respect to its input resembles white noise, providing no visually coherent saliency map. VarGrad is a diagnostic tool for this problem: a uniformly high variance across the entire input suggests the gradients are shattered and the model's local decision boundary is excessively noisy, rendering standard attributions meaningless.
Uncertainty Quantification
The broader field of measuring and decomposing a model's confidence. VarGrad provides a specific form of predictive uncertainty localized to the input space. Unlike methods that estimate output confidence intervals, VarGrad quantifies epistemic uncertainty in the explanation itself, answering: 'How much do I trust this saliency map?'
Integrated Gradients
An axiomatic attribution method that computes feature importance by accumulating gradients along a straight-line path from a baseline to the input. VarGrad's variance-based approach is complementary; it can be applied to the gradient operator within Integrated Gradients to measure the stability of the path integral, identifying features whose attributions fluctuate significantly with the choice of integration steps.
Local Lipschitz Estimate
A robustness metric that measures the maximum change in an explanation under small, adversarial input perturbations. VarGrad's variance computation is a practical, stochastic approximation of this concept. A high VarGrad value at a pixel indicates a large local Lipschitz constant for the saliency map, flagging explanations that are brittle and unreliable for high-stakes decisions.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us