Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Zhong Guan, Likang Wu, Hongke Zhao, Ming He, Jianping Fan
Abstract
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: LLM4Exploration
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
5 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Efficient Streaming Language Models with Attention Sinks cites Language Models are Few-Shot Learners
- GraphFormers: GNN-nested Transformers for Representation Learning on Textual Graph cites Language Models are Few-Shot Learners
- Pure Transformers are Powerful Graph Learners cites Language Models are Few-Shot Learners
- CITE: Benchmarking Heterogeneous Text-Attributed Graph Models cites GraphFormers: GNN-nested Transformers for Representation Learning on Textual Graph
- Actions Speak Louder than Prompts: A Large-Scale Study of LLMs for Graph Inference cites Language Models are Few-Shot Learners
- Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
Cited by top-tier papers5
- Actions Speak Louder than Prompts: A Large-Scale Study of LLMs for Graph InferenceBen Finkelshtein, Silviu Cucerzan, Sujay Kumar Jauhar, Ryen W WhiteICLR 2026 · 5 citations
- Formalizing and Mitigating Structural Distortion in LLM Attention for Graph ReasoningDonald Loveland, Puja Trivedi, Ari Weinstein, Edward W. Huang et al.KDD 2026
- CITE: Benchmarking Heterogeneous Text-Attributed Graph ModelsChenghao Zhang, Qingqing Long, Ludi Wang, Wenjuan Cui et al.ACL 2026
- D-RAG: Differentiable Retrieval-Augmented Generation for Knowledge Graph Question AnsweringGuangze Gao, Zixuan Li, Chunfeng Yuan, Jiawei Li et al.EMNLP 2025
- CoT is Not the Chain of Truth: An Empirical Internal Analysis of Reasoning LLMs for Fake News GenerationZhao Tong, Chunlin Gong, Yiping Zhang, Haichao Shi et al.ICML 2026
Builds on17
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han et al.ICLR 2024 · 1,714 citations
- Pure Transformers are Powerful Graph LearnersJinwoo Kim, Dat Nguyen, Seonwoo Min, Sungjun Cho et al.NeurIPS 2022 · 311 citations
- GraphFormers: GNN-nested Transformers for Representation Learning on Textual GraphJunhan Yang, Zheng Liu, Shitao Xiao, Chaozhuo Li et al.NeurIPS 2021 · 262 citations
Related papers
- Each graph is a new language: Graph Learning with LLMsHuachi Zhou, Jiahe Du, Chuang Zhou, Chang Yang et al.ACL Findings 2025 · 1 citation
- Talk like a Graph: Encoding Graphs for Large Language ModelsBahare Fatemi, Jonathan Halcrow, Bryan PerozziICLR 2024 · 194 citations
- Efficient Code Analysis via Graph Representation Learning-Guided Large Language ModelsHang Gao, Tao Peng, Baoquan Cui, Hong Huang et al.ICML 2026 · 1 citation
- SLASH the Sink: Sharpening Structural Attention Inside LLMsYiming Liu, Bin Lu, Xinbing Wang, Chenghu Zhou et al.ICML 2026
- Digest the Knowledge: Large Language Models empowered Message Passing for Knowledge Graph Question AnsweringJunhong Wan, Tao Yu, Kunyu Jiang, Yao Fu et al.ACL 2025 · 4 citations
