SmoothGrad

On this page 7

SmoothGrad is a feature attribution technique that produces cleaner saliency maps by averaging the gradients of a model’s output over many copies of an input perturbed with Gaussian noise. Introduced in 2017 by researchers at Google, it is one of the standard tools of Explainable AI for image and text classifiers, where plain gradient maps often look speckled and hard to interpret.

The method rests on a simple observation: the gradient of a deep network fluctuates sharply at small scales, so a single gradient reflects local noise as much as meaningful sensitivity. Averaging over a small neighborhood of the input smooths out these fluctuations and leaves the pixels or tokens that consistently influence the prediction.

How SmoothGrad averages noisy gradients

SmoothGrad starts from a vanilla gradient saliency map, the derivative of the class score with respect to each input feature. Instead of computing it once, the method draws n noisy samples of the input, each formed by adding independent Gaussian noise with standard deviation sigma, computes the gradient for every sample, and returns their arithmetic mean.

Formally, the smoothed map approximates the expected gradient under a Gaussian distribution centered on the input. This expectation is equivalent to the gradient of a Gaussian-blurred version of the model’s score function, which explains why the result looks less jagged: SmoothGrad effectively explains a smoothed copy of the model rather than the raw, highly nonlinear function.

Because the procedure only needs gradients, it is model-specific but architecture-agnostic: it works with any differentiable network, including convolutional networks, transformers and multimodal encoders. It also acts as a wrapper, so the averaging step can be applied on top of other gradient-based attribution methods.

Key parameters and typical settings

Two parameters control SmoothGrad: the noise level and the number of samples. The noise level is usually expressed as a fraction of the input range, for example sigma divided by the difference between the maximum and minimum pixel values.

The table below gives commonly used ranges and their effect on the resulting map.

ParameterTypical rangeEffect when too lowEffect when too high
Noise level10% to 20% of input rangeMap stays noisyMap blurs and loses detail
Sample count n20 to 100High variance between runsLinear growth in compute cost
Squared variantOptionalNot applicableEmphasizes strong features, hides weak ones
Absolute valueCommon for imagesSigned map hard to readLoses direction of influence
SmoothGrad parameters and their effects

In the original experiments, a noise level of about 10% to 20% gave the best visual balance, and improvements largely saturated after roughly 50 samples. These values are starting points; data scaling, model depth and the input modality all shift the optimum.

SmoothGrad belongs to the family of gradient-based saliency methods and is often combined with them. It differs from neighbors mainly in what it averages and which property of explanations it targets.

The following comparison places SmoothGrad among methods that practitioners frequently evaluate side by side.

MethodCore ideaMain strengthMain weakness
Vanilla gradientSingle derivative of outputFast, one backward passVery noisy maps
SmoothGradAverage gradients over noisy inputsVisually coherent mapsn times the cost
Integrated GradientsIntegrate gradients along a baseline pathSatisfies completeness axiomDepends on baseline choice
Gradient × inputMultiply gradient by input valueSimple, sign-awareInherits gradient noise
Grad-CAMWeight feature maps by pooled gradientsClass-discriminative regionsCoarse spatial resolution
SmoothGrad and neighboring saliency techniques

Variants such as SmoothGrad combined with Integrated Gradients, sometimes called SmoothGrad-IG, and VarGrad, which uses the variance of the noisy gradients rather than the mean, extend the same idea. Libraries such as Captum expose SmoothGrad as a generic noise tunnel around any supported attribution method.

When to use SmoothGrad in practice

SmoothGrad is most useful when engineers need a quick, visual sanity check of what a differentiable model attends to. It suits debugging, dataset audits and communication with domain experts, but it should not be the only evidence in high-stakes decisions.

The decision table below matches common goals with a recommended approach.

GoalRecommendationReason
Spot spurious cues in imagesSmoothGrad with absolute valuesClear maps reveal background shortcuts
Quantitative attribution scoresIntegrated Gradients or SHAPAxiomatic properties and additivity
Coarse object localizationGrad-CAMRegion-level maps from deep layers
Noisy Integrated Gradients outputWrap it with SmoothGradCombines completeness with smoothing
Non-differentiable modelOcclusion or KernelSHAPSmoothGrad requires gradients
Choosing SmoothGrad by explanation goal

Limitations and faithfulness concerns

The main limitation is that visual clarity does not guarantee faithfulness. Sanity-check studies have shown that some gradient-based maps change little when model weights are randomized, which means they partly reflect the input’s edges rather than the learned function. SmoothGrad performs better than many guided methods in these tests, but its maps still require validation.

  • Explains a smoothed model: the averaged gradient describes the model’s behavior in a neighborhood, not exactly at the input.
  • Noise may leave the data distribution: heavy Gaussian noise creates inputs the network never saw during training.
  • Compute cost scales linearly: 50 samples mean about 50 backward passes per explanation.
  • Run-to-run variance: a small sample count produces maps that differ between runs unless the random seed is fixed.
  • No completeness property: attributions do not sum to the output score, unlike Integrated Gradients.

Good practice pairs SmoothGrad with quantitative faithfulness metrics, such as deletion and insertion curves, and with randomization tests that confirm the map depends on the trained weights.

The idea in brief

A heat map can show which parts of a picture a neural network used to make its decision. The basic version is often grainy and confusing. SmoothGrad fixes this by asking the same question many times. Each time, it adds a little random static to the picture.

It then averages all the answers. Random speckles cancel out. The parts that matter every time stay bright. It is similar to taking many photos of a starry sky and stacking them to remove sensor noise. The result is a cleaner, more readable map.

A practical scenario

A medical imaging team builds a convolutional network that flags pneumonia on chest X-rays. Plain gradient maps look like scattered dots across the whole image, so radiologists cannot judge them. The engineers apply SmoothGrad with 50 samples and a noise level of 15% of the pixel range.

The smoothed maps show that, for a noticeable share of positive cases, the model highlights a hospital text marker in the image corner instead of the lungs. The team masks the markers, retrains the model and repeats the analysis. The new maps concentrate on the lung fields, and accuracy on scans from an external hospital improves, confirming that SmoothGrad exposed a shortcut the validation score alone had hidden.