Layer-wise relevance propagation

Also known as: LRP

On this page 7

Layer-wise relevance propagation (LRP) is a feature attribution method that explains a single prediction of a neural network by propagating the output score backward through the layers and distributing it among the neurons of each layer, until every input feature receives a relevance score. In Explainable AI, it is one of the classic techniques for producing pixel-level heatmaps and token-level attributions for deep models.

LRP was introduced in 2015 for image classifiers and later grounded in deep Taylor decomposition. Its defining idea is relevance conservation: the total relevance assigned to the inputs approximately equals the model output being explained, so the explanation shows how much each feature contributed, not only where the gradient is large.

How LRP redistributes relevance

LRP works by running a normal forward pass, selecting the output neuron to explain, and then applying a local redistribution rule at every layer on the way back. Each neuron passes its relevance to the neurons of the previous layer in proportion to how much they contributed to its activation.

For a dense or convolutional layer, the contribution of lower neuron j to upper neuron k is the product of its activation and the connecting weight. The basic rule assigns neuron j the share a_j * w_jk / sum_j(a_j * w_jk) of the relevance of neuron k, summed over all upper neurons. Because the shares at each neuron add up to one, relevance is conserved layer by layer.

The method needs only one forward and one backward pass, so its cost is close to that of computing a gradient. This makes LRP far cheaper than perturbation methods such as occlusion sensitivity or KernelSHAP, which require hundreds or thousands of model evaluations per explanation.

Propagation rules and when to use them

The choice of propagation rule determines the quality of an LRP explanation. The basic rule produces noisy results in deep networks, so practitioners apply different rules to different layer types, an approach often called composite LRP.

RuleKey ideaTypical placement
LRP-0Plain proportional redistributionRarely used alone; equals gradient × input
LRP-epsilonAdds a small stabilizer to the denominatorUpper dense layers
LRP-gammaFavors positive contributions by a factor gammaMiddle convolutional layers
LRP-alpha-betaWeights positive and negative parts separatelyConvolutional layers, often alpha 2, beta 1
z-beta ruleRespects bounded input ranges such as pixelsFirst layer on image inputs
Flat or w-squared ruleSpreads relevance by weights onlyInput layer for non-pixel data
Main LRP propagation rules

The epsilon parameter absorbs weak or contradictory contributions and typically ranges from about 0.01 to 0.25; larger values give sparser, cleaner maps. A common composite for image classifiers uses epsilon at the top, gamma in the middle and the z-beta rule at the input.

LRP compared with other attribution methods

LRP belongs to the family of backpropagation-based explanations, together with gradient-based saliency and DeepLIFT. It differs from them mainly in how it handles nonlinearities and in its conservation property.

MethodSignal propagatedConservationCost per explanation
LRPRelevance via layer rulesApproximate, by designOne backward pass
Gradient × inputLocal gradient times inputNoOne backward pass
DeepLIFTDifference from a reference inputYes, relative to referenceOne backward pass
Integrated gradientsGradients along an input pathYes, completeness axiom20 to 300 passes
KernelSHAPSampled feature coalitionsYes, Shapley efficiencyHundreds to thousands of passes
Grad-CAMGradient-weighted feature mapsNoOne backward pass, coarse map
LRP and neighboring attribution methods

With LRP-0 on a ReLU network without biases, LRP is mathematically equivalent to gradient × input. Its advantage appears with the stabilized rules, which suppress the gradient shattering that makes raw gradients noisy in deep architectures.

Applying LRP in practice

LRP is practical when the model is a differentiable network whose layers are accessible, and when fast, fine-grained attributions are needed at scale. Open-source implementations exist in libraries such as Zennit, iNNvestigate and Captum, which provide ready-made rule composites.

SituationRecommendationReason
CNN image classifierComposite LRP with z-beta inputSharp, well-studied heatmaps
Transformer language modelLRP with attention-specific rulesNaive rules break conservation in softmax and LayerNorm
Tree ensemble or black-box APIUse TreeSHAP or a model-agnostic methodLRP needs internal layers
Auditing a dataset for shortcutsLRP heatmaps plus clusteringReveals spurious features across many samples
Choosing LRP for a given situation

LRP heatmaps are most useful when aggregated. Clustering thousands of explanations, an approach known as spectral relevance analysis, has exposed Clever Hans behavior, such as classifiers that recognized horses by a copyright watermark rather than by the animal.

Limitations and common misconceptions

LRP explanations are only as reliable as the chosen rules, and different composites can yield visibly different heatmaps for the same prediction. Several pitfalls are worth knowing.

  • Rule dependence: there is no single correct rule set; choices should be validated with pixel-flipping or deletion tests.
  • Architecture coverage: layers such as attention, normalization and gating need special handling, otherwise conservation fails.
  • Bias and residual terms absorb part of the relevance, so conservation is approximate rather than exact.
  • Heatmaps are not causal proof: high relevance shows contribution under the model, not real-world causation.
  • Explanation faithfulness must be measured, because a visually pleasing map can still misrepresent the model.

In everyday language

Imagine a team project that earned a final grade. Layer-wise relevance propagation splits that grade back among the team members. Each person gets credit in proportion to what they actually contributed. The credit then passes further down to the people who helped them.

For a neural network, the grade is the prediction. The team members are the neurons, and the first helpers are the pixels or words of the input. The result is a map. It shows which parts of the input drove the decision, and the credit always adds up to the original score.

Seen in the real world

A hospital research group builds a convolutional network that flags pneumonia on chest X-rays and reaches high accuracy on its validation set. Before a clinical pilot, the team runs composite LRP on 5,000 test images and clusters the resulting heatmaps.

One large cluster shows relevance concentrated on text markers in the image corner rather than on the lungs. The markers indicate portable scanners, which are used more often for severely ill patients, so the network had learned a shortcut tied to the scanner type.

The team masks the markers, retrains the model and confirms with new heatmaps that relevance now falls on lung tissue. Accuracy on an external hospital dataset rises noticeably, and the clinical review board approves the next evaluation stage.