Layer-wise Relevance Propagation
Description
Layer-wise Relevance Propagation (LRP) explains a neural network's prediction by working backwards from the output to the inputs. It treats the prediction score as a quantity called relevance, then passes that relevance back through each layer in proportion to how much each neuron contributed in the forward pass. The rules for this redistribution are chosen to keep the total relevance roughly constant from layer to layer, so the input scores add up to the prediction apart from small amounts absorbed by bias terms and stabilisers. Different rules can be used for different types of layer. The result is a relevance score for each input, such as a pixel or a feature, with positive values for inputs that supported the prediction and negative values for inputs that counted against it.
Example Use Cases
Explainability
Identifying which pixels in chest X-rays contribute to pneumonia detection, helping radiologists verify AI diagnoses by highlighting anatomical regions the model considers relevant.
A perception team investigating a misclassified traffic-sign image draws the relevance map for the wrong class. The map shows the relevance sitting on a sticker and the background rather than on the sign itself, which tells the team to add training images with such clutter before the model is retested.
Transparency
A bank's model-risk reviewers receive LRP relevance scores for a sample of declined applications scored by a neural network. They check that the inputs with the most relevance for the decline output are affordability measures and not proxy fields such as postcode, and file the scores with the decision record for audit.
Limitations
- Each layer type needs its own propagation rule, and a new layer type has none until someone derives one, so adapting LRP to a new architecture takes expertise and testing.
- Rule selection (LRP-ε, LRP-γ and others) changes the resulting maps, so two analysts can produce different explanations of the same prediction, and choosing among them takes expertise.
- Heatmaps are hard to validate. The original paper judges them by eye and with a pixel-flipping test, and notes that quality beyond visual assessment is an open question, so a plausible-looking map does not prove the model relies on the highlighted inputs.
- Standard rules do not cover attention layers. Extensions for transformers, such as AttnLRP in the LXT library, exist but are recent and specific to certain architectures, so users of transformers or large language models must adopt them and confirm they match their model.
- Bias handling and epsilon stabilisation can absorb or inject relevance, so input scores do not always sum exactly to the selected output. A report should document the accounting residual before claiming conservation.
Resources
Research Papers
On Pixel-Wise Explanations for Non-Linear Classifier Decisions by Layer-Wise Relevance Propagation
Understanding and interpreting classification decisions of automated image classification systems is of high value in many applications, as it allows to verify the reasoning of the system and provides additional information to the human expert. Although machine learning methods are solving very successfully a plethora of tasks, they have in most cases the disadvantage of acting as a black box, not providing any information about what made them arrive at a particular decision. This work proposes a general solution to the problem of understanding classification decisions by pixel-wise decomposition of nonlinear classifiers. We introduce a methodology that allows to visualize the contributions of single pixels to predictions for kernel-based classifiers over Bag of Words features and for multilayered neural networks. These pixel contributions can be visualized as heatmaps and are provided to a human expert who can intuitively not only verify the validity of the classification decision, but also focus further analysis on regions of potential interest. We evaluate our method for classifiers trained on PASCAL VOC 2009 images, synthetic image data containing geometric shapes, the MNIST handwritten digits data set and for the pre-trained ImageNet model available as part of the Caffe open source package.
Software Packages
LRP-eXplains-Transformers
Layer-wise Relevance Propagation for Large Language Models and Vision Transformers [ICML 2024]
lrp_toolbox
The LRP Toolbox provides simple and accessible stand-alone implementations of LRP for artificial neural networks supporting Matlab and Python. The Toolbox realizes LRP functionality for the Caffe Deep Learning Framework as an extension of Caffe source code published in 10/2015.