Guided backpropagation

On this page 7

Guided backpropagation is a gradient-based saliency method for convolutional neural networks that computes how input pixels affect a chosen output while letting only positive gradients pass through ReLU layers, which yields sharp, high-resolution visualizations of image detail. In explainable AI, it belongs to the family of post hoc, local feature attribution techniques that explain a single prediction of an already trained model.

The method was introduced in 2014 alongside the all-convolutional network architecture as a way to visualize what individual neurons respond to. It became popular because its maps look far cleaner than plain gradients, but later research showed that this clarity comes at a price: the maps are often insensitive to the model and to the predicted class, so they must be interpreted with care.

How guided backpropagation modifies the backward pass

Guided backpropagation changes one rule in the backward pass: at every ReLU, a gradient is propagated only where both the forward activation was positive and the incoming gradient is positive. Everything else is set to zero, so negative evidence is discarded on the way back to the input.

The procedure starts by running a normal forward pass and selecting a target, usually the logit of the predicted class or the activation of a single neuron. The backward pass then multiplies local derivatives as in standard backpropagation, except at rectifiers, where the combined masking rule applies. The result is an attribution tensor with the same shape as the input image, normally shown as a color or grayscale map.

The table below shows how the three classic ReLU backward rules differ, which is the whole distinction between these methods.

MethodCondition for passing the gradientEffect on the map
Plain gradientForward activation was positiveNoisy, speckled map
Deconvolution (deconvnet)Incoming gradient is positiveEdges, weak dependence on input
Guided backpropagationBoth conditions are trueSharp, edge-like detail
Backward rules at a ReLU layer

Because the double mask suppresses everything that would reduce the target, the output highlights features that excite the network. This is why the maps resemble crisp edge drawings of the object.

Properties of guided backpropagation maps

Guided backpropagation maps are high-resolution, low-noise and largely class-agnostic, and each of these properties follows directly from the masking rule. Knowing them helps practitioners decide what the visualization can and cannot support.

The following table summarizes the main properties and their practical meaning.

PropertyValue or behaviorPractical consequence
ResolutionFull input resolutionFine textures and edges visible
Sign of attributionPositive evidence onlyNo view of counter-evidence
Class sensitivityWeak in practiceMaps for different classes look similar
CostOne forward and one backward passFast enough for interactive use
Model accessWhite-box gradients requiredNot usable on API-only models
Key properties of guided backpropagation

Theoretical analysis has shown that guided backpropagation largely performs partial image reconstruction: with the double mask, the backward signal tends to recover the input’s edges regardless of what the upper layers learned. This explains why its maps can look convincing even for networks with randomized weights.

Guided backpropagation sits among several gradient-based attribution methods that trade resolution, class specificity and faithfulness differently. The comparison below positions it against neighboring techniques often used for convolutional networks.

MethodResolutionClass discriminativeFaithfulness reputation
Guided backpropagationPixel levelWeakFails common sanity checks
Grad-CAMCoarse, last convolutional layerStrongPasses common sanity checks
Guided Grad-CAMPixel levelStrongInherits some guided weaknesses
SmoothGradPixel levelModerateReduces noise, depends on base method
Integrated gradientsPixel levelModerateSatisfies completeness axiom
Layer-wise relevance propagationPixel levelModerateConservation of relevance
Guided backpropagation compared with neighboring methods

The most common practical pairing is Guided Grad-CAM, which multiplies the guided backpropagation map element-wise with an upsampled Grad-CAM heatmap. Grad-CAM supplies where the class evidence lies, and guided backpropagation supplies fine-grained detail inside that region.

Using guided backpropagation in practice

Guided backpropagation is best used as a qualitative debugging aid for vision models, not as evidence of model reasoning in audits or regulated decisions. Libraries such as Captum provide ready implementations that override ReLU gradients through hooks.

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

GoalRecommended approachReason
Inspect textures a filter responds toGuided backpropagation on a neuronSharp detail at input resolution
Show which object drove a classGrad-CAM or Guided Grad-CAMClass-specific localization
Provide evidence for an auditIntegrated gradients or occlusionBetter tested faithfulness
Explain non-ReLU or transformer modelsAttention rollout or gradient × inputGuided rule assumes rectifiers
When to use guided backpropagation
  • Apply the guided rule only to ReLU-type activations; for GELU or SiLU the masking is ad hoc and results are hard to compare.
  • Normalize maps consistently, for example by clipping at the 99th percentile, before comparing images.
  • Always run a model randomization sanity check before trusting the visual output.

Limitations and misconceptions

The central limitation of guided backpropagation is that visual sharpness is not faithfulness. Its maps can remain almost unchanged when the network’s weights are randomized layer by layer or when a different target class is chosen, which means they describe the image more than the model.

  • Misconception: a crisp map proves the model uses those pixels. In reality, the masking reconstructs edges largely on its own.
  • Misconception: it explains why a class was chosen. It shows positive evidence only and ignores what argued against the class.
  • Risk: human reviewers find the maps persuasive, which can create unjustified trust in a flawed classifier.
  • Risk: results can change with small input perturbations, so single maps should not be over-interpreted.

These findings do not make the method useless. Guided backpropagation remains a fast way to see which visual patterns a single neuron or filter amplifies, and it is valuable in teaching and exploratory analysis. Its outputs should, however, be paired with a quantitative faithfulness test such as deletion curves or occlusion before any conclusion about the model reaches stakeholders, regulators or end users.

Understanding it simply

Guided backpropagation tries to show which parts of a picture made a neural network react. It traces the network’s decision backward to the pixels. On the way, it keeps only the signals that pushed the decision up.

The result looks like a neat pencil sketch of the object. That sketch is pleasant to look at. However, it often looks almost the same no matter what the network learned. So it is a helpful first look, not proof of how the model thinks.

Applied in practice

A team building a defect detection model for printed circuit boards uses a ResNet classifier with ReLU activations. When the model flags a board as defective, engineers generate a guided backpropagation map to see which solder joints and traces contributed. The maps clearly outline a cracked joint on many correctly flagged boards, which helps operators locate faults quickly on the inspection screen.

During validation, the team runs a sanity check by randomizing the top layers of the network. The guided maps barely change, while Grad-CAM heatmaps become meaningless as expected. The team therefore switches the operator display to Guided Grad-CAM and uses integrated gradients for its formal validation report. As a result, the visual aid stays sharp, while claims about model behavior rest on a method that passed the checks.