[Paper Review] AttnLRP: Attention-Aware Layer-Wise Relevance Propagation for Transformers
AttnLRP extends Layer-wise Relevance Propagation to non-linear transformer attention, providing faithful, efficient attributions for inputs and latent representations and enabling neuron-level understanding.
Large Language Models are prone to biased predictions and hallucinations, underlining the paramount importance of understanding their model-internal reasoning process. However, achieving faithful attributions for the entirety of a black-box transformer model and maintaining computational efficiency is an unsolved challenge. By extending the Layer-wise Relevance Propagation attribution method to handle attention layers, we address these challenges effectively. While partial solutions exist, our method is the first to faithfully and holistically attribute not only input but also latent representations of transformer models with the computational efficiency similar to a single backward pass. Through extensive evaluations against existing methods on LLaMa 2, Mixtral 8x7b, Flan-T5 and vision transformer architectures, we demonstrate that our proposed approach surpasses alternative methods in terms of faithfulness and enables the understanding of latent representations, opening up the door for concept-based explanations. We provide an LRP library at https://github.com/rachtibat/LRP-eXplains-Transformers.
Motivation & Objective
- Motivate faithful attributions for large transformer models including latent representations.
- Extend LRP to handle non-linear attention in transformers.
- Provide an open-source AttnLRP implementation and demonstrate improved faithfulness and efficiency.
- Showcase how AttnLRP reveals and interacts with latent neurons in flax of model reasoning.
Proposed method
- Derive new efficient LRP rules for non-linear attention within the Deep Taylor Decomposition framework.
- Apply epsilon- and gamma-LRP variants to linear layers and selectively to attention components.
- Develop specialized rules for softmax, matrix multiplication, and normalization layers to preserve conservation and stability.
- Enable attribution of latent neurons inside and outside attention modules.
- Provide an open-source implementation on GitHub.
- Demonstrate neuron-level understanding via Activation Maximization paired with AttnLRP.
Experimental results
Research questions
- RQ1How faithful are AttnLRP explanations compared with state-of-the-art attribution methods across transformer models?
- RQ2How does AttnLRP's efficiency compare to perturbation-based explanations in terms of time and memory?
- RQ3Can AttnLRP reveal and manipulate latent neuron representations to understand model reasoning?
- RQ4Does AttnLRP improve attribution quality for both input tokens and latent features in ViTs and LLMs?
Key findings
- AttnLRP consistently outperforms baseline methods in faithfulness across ViT, Llama 2, and Flan-T5 settings.
- Gamma-LRP variants improve fidelity for Vision Transformers, reducing noise in attributions.
- AttnLRP enables reliable attribution of latent neurons, facilitating concept-based explanations and neuron-level manipulation.
- Compared to perturbation-based methods, LRP-based explanations show favorable computational efficiency (backpropagation-based) and memory characteristics.
- ActMax-guided analyses with AttnLRP reveal interpretable encodings and enable targeted interventions on latent neurons.
- The open-source AttnLRP implementation is available at the project repository.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.