[论文解读] AttnLRP: Attention-Aware Layer-Wise Relevance Propagation for Transformers
AttnLRP 将分层相关传播扩展到非线性变换器注意力,为输入和潜在表示提供忠实、高效的归因,并实现神经元级别的理解。
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.
研究动机与目标
- 为包含潜在表示的大型变换器模型提供忠实的归因。
- 将 LRP 扩展以处理变换器中的非线性注意力。
- 提供一个开源的 AttnLRP 实现并展示在忠实度和效率方面的提升。
- 展示 AttnLRP 如何揭示并在 flax 的模型推理中与潜在神经元交互。
提出的方法
- 在 Deep Taylor Decomposition 框架内推导用于非线性注意力的新型高效 LRP 规则。
- 将 epsilon- 和 gamma-LRP 变体应用于线性层,并对注意力组件有选择地应用。
- 为 softmax、矩阵乘、归一化层开发专门规则,以保持守恒性和稳定性。
- 实现对注意力模块内外的潜在神经元的归因。
- 在 GitHub 上提供开源实现。
- 通过与 AttnLRP 配对的 Activation Maximization 展示神经元级理解。
实验结果
研究问题
- RQ1与最先进的归因方法相比,AttnLRP 的解释在变换器模型中的忠实度有多高?
- RQ2在时间和内存方面,AttnLRP 的效率与基于扰动的解释相比如何?
- RQ3AttnLRP 是否能够揭示并操控潜在神经元表示以理解模型推理?
- RQ4AttnLRP 是否提升 ViTs 与 LLMs 的输入标记和潜在特征的归因质量?
主要发现
- 在 ViT、Llama 2 和 Flan-T5 设置中,AttnLRP 在忠实度方面持续优于基线方法。
- Gamma-LRP 变体提升视觉变换器的保真度,减少归因中的噪声。
- AttnLRP 能实现对潜在神经元的可靠归因,便于基于概念的解释和神经元级操作。
- 与基于扰动的方法相比,基于 LRP 的解释在计算效率(基于反向传播)和内存特性方面更有优势。
- 在 AttnLRP 的 ActMax 指导分析揭示可解释的编码,并实现对潜在神经元的有针对性干预。
- 开源的 AttnLRP 实现可在项目代码库中获取。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。