arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.02130cs.AIcs.CL
收藏

注意力机制视角:探索大语言模型对图结构数据的处理

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data

Zhong Guan(钟冠);Likang Wu(吴立康);Hongke Zhao(赵宏凯);Ming He(何明)

Zhong Guan, Likang Wu, Hongke Zhao, Ming He, Jianpin Fan

AI总结:

本文从注意力机制视角实证研究大语言模型处理图结构数据的能力,揭示其在节点关系建模和拓扑适应上的不足,并提出中间状态注意力窗口以提升训练与推理性能。

摘要:

注意力机制是大语言模型(LLMs)成功的关键,推动了多个领域的重大进展。然而,对于需要强调拓扑连接的图结构数据,与在固定链路上运行的消息传递机制(如图神经网络(GNNs)所采用的机制)相比,注意力机制表现不足。这引出了一个问题:“在自然语言场景下,注意力对图数据是否失效?”基于这些观察,我们从注意力机制的视角开展了一项实证研究,以探索LLMs如何处理图结构数据。目标是更深入地理解LLMs在图结构上的注意力行为。我们发现了LLMs如何对图结构数据施加注意力的独特现象,并分析了这些发现以改进LLMs对此类数据的建模。我们研究的主要发现是:1)虽然LLMs能够识别图数据并捕捉文本-节点交互,但由于固有的架构限制,它们难以建模图结构内部的节点间关系。2)LLMs在图节点上的注意力分布与理想的结构模式不一致,表明其未能适应图拓扑的细微差别。3)全连接注意力和固定连接都不是最优的;每种方式在其应用场景中都有特定的局限性。相反,中间状态的注意力窗口能够提升LLM的训练性能,并在推理过程中无缝过渡到全连接窗口。源代码:\href{https://github.com/millioniron/LLM_exploration}{LLM4Exploration}

英文摘要:

Attention mechanisms are critical to the success of large language models (LLMs), driving significant advancements in multiple fields. However, for graph-structured data, which requires emphasis on topological connections, they fall short compared to message-passing mechanisms on fixed links, such as those employed by Graph Neural Networks (GNNs). This raises a question: ``Does attention fail for graphs in natural language settings?'' Motivated by these observations, we embarked on an empirical study from the perspective of attention mechanisms to explore how LLMs process graph-structured data. The goal is to gain deeper insights into the attention behavior of LLMs over graph structures. We uncovered unique phenomena regarding how LLMs apply attention to graph-structured data and analyzed these findings to improve the modeling of such data by LLMs. The primary findings of our research are: 1) While LLMs can recognize graph data and capture text-node interactions, they struggle to model inter-node relationships within graph structures due to inherent architectural constraints. 2) The attention distribution of LLMs across graph nodes does not align with ideal structural patterns, indicating a failure to adapt to graph topology nuances. 3) Neither fully connected attention nor fixed connectivity is optimal; each has specific limitations in its application scenarios. Instead, intermediate-state attention windows improve LLM training performance and seamlessly transition to fully connected windows during inference. Source code: \href{https://github.com/millioniron/LLM_exploration}{LLM4Exploration}

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

↑