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.
| Rule | Key idea | Typical placement |
|---|---|---|
| LRP-0 | Plain proportional redistribution | Rarely used alone; equals gradient × input |
| LRP-epsilon | Adds a small stabilizer to the denominator | Upper dense layers |
| LRP-gamma | Favors positive contributions by a factor gamma | Middle convolutional layers |
| LRP-alpha-beta | Weights positive and negative parts separately | Convolutional layers, often alpha 2, beta 1 |
| z-beta rule | Respects bounded input ranges such as pixels | First layer on image inputs |
| Flat or w-squared rule | Spreads relevance by weights only | Input layer for non-pixel data |
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.
| Method | Signal propagated | Conservation | Cost per explanation |
|---|---|---|---|
| LRP | Relevance via layer rules | Approximate, by design | One backward pass |
| Gradient × input | Local gradient times input | No | One backward pass |
| DeepLIFT | Difference from a reference input | Yes, relative to reference | One backward pass |
| Integrated gradients | Gradients along an input path | Yes, completeness axiom | 20 to 300 passes |
| KernelSHAP | Sampled feature coalitions | Yes, Shapley efficiency | Hundreds to thousands of passes |
| Grad-CAM | Gradient-weighted feature maps | No | One backward pass, coarse map |
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.
| Situation | Recommendation | Reason |
|---|---|---|
| CNN image classifier | Composite LRP with z-beta input | Sharp, well-studied heatmaps |
| Transformer language model | LRP with attention-specific rules | Naive rules break conservation in softmax and LayerNorm |
| Tree ensemble or black-box API | Use TreeSHAP or a model-agnostic method | LRP needs internal layers |
| Auditing a dataset for shortcuts | LRP heatmaps plus clustering | Reveals spurious features across many samples |
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.