arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2402.15055cs.CLcs.AIcs.LG
收藏

解读 Transformer 中的上下文查找:探究注意力与 MLP 的交互

Interpreting Context Look-ups in Transformers: Investigating Attention-MLP Interactions

School of Informatics, University of Edinburgh(爱丁堡大学信息学院);Apart Research;Nanyang Technological University(南洋理工大学);University of Oxford(牛津大学)

Clement Neo, Shay B. Cohen, Fazl Barez

AI总结:

本文研究 LLMs 中注意力头与下一 token 神经元的交互机制,提出识别下一 token 神经元、定位上游注意力头并自动生成解释的方法,发现注意力头可识别特定上下文并激活下游预测神经元,为理解 LLMs 内部工作机制提供新基础。

摘要:

理解大型语言模型(LLMs)的内部工作机制对于推进其理论基础和实际应用至关重要。虽然注意力机制和多层感知器(MLPs)已被分别研究,但它们之间的交互在很大程度上仍未被探索。本研究调查了 LLMs 中注意力头与下一 token 神经元如何交互以预测新词。我们提出了一种方法来识别下一 token 神经元,找到能高度激活它们的提示,并确定负责的上游注意力头。随后,我们以自动化方式生成并评估这些注意力头活动的解释。我们的发现表明,某些注意力头能够识别与预测某个 token 相关的特定上下文,并相应地激活下游的 token 预测神经元。这一机制为理解注意力头如何与 MLP 神经元协同执行下一 token 预测提供了更深入的认识。我们的方法为进一步研究 LLMs 的复杂工作机制及其对文本生成和理解的影响奠定了基础。

英文摘要:

Understanding the inner workings of large language models (LLMs) is crucial for advancing their theoretical foundations and real-world applications. While the attention mechanism and multi-layer perceptrons (MLPs) have been studied independently, their interactions remain largely unexplored. This study investigates how attention heads and next-token neurons interact in LLMs to predict new words. We propose a methodology to identify next-token neurons, find prompts that highly activate them, and determine the upstream attention heads responsible. We then generate and evaluate explanations for the activity of these attention heads in an automated manner. Our findings reveal that some attention heads recognize specific contexts relevant to predicting a token and activate a downstream token-predicting neuron accordingly. This mechanism provides a deeper understanding of how attention heads work with MLP neurons to perform next-token prediction. Our approach offers a foundation for further research into the intricate workings of LLMs and their impact on text generation and understanding.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑