Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Authors: Zhong Guan
Likang Wu
Hongke Zhao
Ming He
Jianping Fan
Venue: ICML 2025 poster (2025)
Keywords: large language model
graph
attention perpective
Primary area: deep_learning->large_language_models
TL;DR: Analysis of attention distribution and windowing reveals phenomena such as the NLP-inspired "attention sink" and a novel "Skewed Line Sink" in graphs.

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. Through a series of experiments, 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 (as in LLMs) nor fixed connectivity (as in GNNs) 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://anonymous.4open.science/r/LLM_exploration-B21F}{anonymous.4open.science/LLM\_exploration-B21F}

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Zhong Guan 12 Likang Wu 123 Hongke Zhao 123
Ming He* Jianping Fan
Abstract
1. Introduction
Attention mechanisms are critical to the success of large language models (LLMs), driving sig- nificant advancements in multiple fields. How- ever, 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 ques- tion: "Does attention fail for graphs in natural language settings?" Motivated by these observa- tions, we embarked on empirical study from the perspective of attention mechanisms to ex- plore how LLMs process graph-structure data. The goal is to gain deeper insights into the at- tention 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 model- ing 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 inherent architectural con- straints. 2) The attention distribution of LLMs across graph nodes does not align with ideal struc- tural patterns, indicating a failure to adapt to graph topology nuances. 3) Neither fully connected at- tention nor fixed connectivity is optimal; each has specific limitations in its application scenarios. Instead, intermediate-state attention windows im- prove LLM training performance and seamlessly transition to fully connected windows during in- ference. Source code: LLM4Exploration
LLMs have garnered significant attention, achieving remark- able success in language processing and demonstrating ef- fective transferability to various other domains (Goyal et al., 2024; Ouyang et al., 2022: Pi et al., 2024; Singh et al., 2023; Wu et al., 2024; Zhao et al., 2024; Wu et al., 2023). This trend has inspired the graph machine learning community to delve into the application of LLMS within their field (He et al., 2024; Chen al., 2024b; Huang et al., 2024; Kong et al., 2024; He & Hooi, 2024; Liu et al., 2025; Guan et al., 2024). However, recent studies reveal that existing LLMs for graphs fail to deliver satisfactory performance on graph- structured data, pointing to undiscovered challenges that hinder the deployment of LLMs in this context (Luo et al., 2024).
Attention mechanisms are a critical component of LLMs success, effectively linking tokens to enable models to comprehend complex contexts and domain-specific knowl- edge (Xiao et al., 2024; Hsieh et al., 2024; Yu et al., 2024), Despite the vast potential of attention mechanisms, research into their application on graph graph-structured data remains largely unexplored, lacking systematic analysis. Therefore, we embarked on an investigation from the perspective of attention analysis, aiming uncover unique phenomena of LLMs attention on graph data structures and to validate hypotheses regarding LLMs' behavior on such data. Our work seeks to fill this research gap and establish a clear direction for future studies in the field.
In this paper, we conducted our study based on the following hypotheses, and uncovered new issues and phenomena.
Q1: Do the attention distribution of LLMs change before and after training with finetuning ? Can LLMs correctly utilize graph structures?
Equal contribution College of Management and Economics, Tianjin University, Tianjin, China Laboratory of Computa- tion and Analytics of Complex Management Systems Tiia- jin University, Tianjin, China ai-ddeepcube "AI Lab at Lenovo Research, Beijing, China. Correspondence to: Hongke Zhao <hongke <hongkc<rj..cdu.nn ww....du..u...........
We first compared the distribution curves of attention scores for node tokens and text tokens before and after LLMs training. We then conducted hypothesis testing to clarify the following points: whether the attention node tokens has shifted; whether the attention text tokens has shifted; and whether the attention distributions between node tokens and text tokens are consistent.
Proceedings of the 42nd International Conference Machine Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
The results showed that after training, the LLMs' attention towards node tokens indeed underwent significant shift. This suggests that the LLMs have developed an initial capa- bility to recognize graph-strum traph-structured data. Simultaneously, our hypothesis testing revealed that the attention distribution of LLMs within nodes exhibits extreme tendency. However, in subsequent experiments where we disrupted the connec- tivity information, we found that even when the topologiaa connection information was randomly shuffled, it had al- most no effect on the LLMs' performance. This indicates that the LLMs did not effectively utilize the correct connec- tivity information.
how LLMs process graph-structured data, thereby guiding the direction of future discoveries for the community.
Our contributions in this work are summarized as follows:
We conducted a visualization and analysis of LLM atten- tion on graph-structured data. To our knowledge, this is the first empirical study to investigate LLMs for graph machine learning from the perspective of attention.
Our analysis reveals that L.LSs fail to effectively leverage the connectivity information in graphs. We delve into this issue by examining two major aspects: the distribution of attention scores and the scope of attention windows.
Q2: Can LLMs allocate attention to different types of graph nodes in a manner consistent with the structural properties of the graph?
We identify "Attention Sink" issues similar to those ob- served in natural language tasks, as well as a unique phe- nomenon we term "Skewed Line Sink" specific to graph data. Drawing on the experience of the NLP commu- nity, we can explore methods to correct these biases to improve model performance.
When processing graph data inputs, LLMs calculate atten- tion scores between node tokens to weigh the importance of different nodes relative to each other. Through our visualiza- tion experiments, we found that the attention scores between different node tokens in LLMs do not adequately match the graph structure. Specifically, under sequential conditions, the attention distribution of node tokens exhibits U-shaped or long tail, which deviated from our idealized assumptions. Ideally, the model should focus more on central nodes and allocate attention in hierarchical, diminishing manner.
Through a series of experiments, we identified multi- ple phenomena and current challenges faced by LLMs in graph machine learning applications. Our work pro- vides valuable insights and guides future research ef- forts in this field.
Meanwhile, our analysis revealed that the attention paid by text tokens to node tokens more closely matches our ideal expectations. This indicates that the current limitation in LLMs lies not in the interaction between text and nodes but in the modeling of connections between nodes.
2. Related Work
2.1. Analysis of Attention in LLMs
With the remarkable attention that LLMs have garnered across various communities, pioneering studies have be- gun to focus on the attention mechanisms within LLMs and their distribution (Ruan & Zhang, 2024; Acharya et al., 2024: Makkuva et al., 2024; Liang et al., 2024). Stream- LLM (Xiao et al., 2024) was among the first to identify the phenomenon of "Attention sinks", where semantically limited initial tokens can receive disproportioonatly higher attention scores. The study suggested maintaining these special tokens during long-text inference for better perfor- mance. Building on StreamL.LM, Yu et al. (2024) found that correcting partial attention sinks can yield performance im- provements without additional training. Duan et al. (2024) explored the relationship between attention and sentence uncertainty, while Hsieh et al. (2024) investigated the "lost- in-the-middle" phenomenon in RAG, focusing on the inter- action between retrieved document ranking and attention.
Q3: Which is more suitable for LLM's graph-structured tasks: the fully connected perspective of LLMs or the fixed-link perspective of GNNs?
We introduce a specific metric, the Global Linkage Horizon (GLH), measure the visibility range between nodes in LLMs. Through extensive experiments adjusting the GLH, we found that neither the fully connected view of LLMS nor the fixed-linkage view of GNNs represented the optimal attention perspective for LLMs.
Intermediate perspectives that incorporate certain topolog- ical link information achieve superior performance during training and yield unexpected improvements when used solely for inference. Specifically, models trained with smaller linkage horizon can be effectively deployed with a larger linkage horizon. This transferability from small to large perspectives addresses practical deployment chal- lenges while enhancing model performance.
2.2. Attention Window
In this work, our primary objective is identify unique phenomena and explore the causes and potential impacts of these phenomena, aiming to provide new perspectives
We define the attention window as the visibility range be- tween tokens within a single layer of a neural network. In models like BERT (Kenton & Toutanova, 2019). the atten- tion view is bidirectionally fully connected, allowing each
2

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Density Distribution of Attention Scorejamazon, raaings)
Density Distribution of Attention Scoretroman empire)
Densily Distribution of Attention Scoretwikic))
That Toless
Thsens
Teat
hode Toens
Falned Toxt Tokors
1.4
Node Thcens
Tere Tox: Takens
Node Tosens
Trained loxt Tikens
Taited Node lokers
Taned ned Mode Tikens
Trained Node Takens
1.0
0.8
3.6
0.5
0.6
0.4
3.2
0.2
0.0
4.0
4.0
2.0
3.5
2.0
Magnitudellog)
Magritude(log)
Magnitude(log)
Figure 1. Attention distribution of different types of tokens before and after training. With Amazon- Amazon-Ratings on the left, Roman- Eaetan--mppieei in the middle, and Wikies the right. The attention values have undergone log scaling and are plotted density distribution Figure.
token to attend to all other tokens. Conversely, in GPT series models (Brown et al., 2020), unidirectional causal mask is used, restricting each token only see preceding tokens, resulting in a lower triangular attention matrix. Similarly, in GNNs, the visibility is defined by fixed connections, where each node can only see its directly linked neighbors (Kipf & Welling, 2022). In the context of applying LLMs to graph data mining. some works have simply adapted LLMs to use either fixed-link or bidirectionally fully connected attention window (Yang et al., 2024; Zhu et al., 2024b). However, these adaptations lack thorough experimental analysis and deeper exploration of the attention window's ' impact on model performance.
Table I. Statistical DistribttiossRoman- Analysis of Attention Score
Dataset). Note:
#s indicates
p-value <0.01, otherwise p >0.05 for t-test and KS test. JS Divergence values are provided this.
Comparison
T-Test
KS Test
JS
Before vs After (Text)
44.061 **
0.092**
0.0064
Before vs After (Node)
0.461
0.049**
0.0099
Node vs Text (Before)
-60.455+*
0.279
0.0753
Node vs Text (After)
-78.651**
0.
0.0791
Our analysis reveals a marked shift in the attention distri- bution for node tokens, demonstrating that LLMs begin to recognize node tokens. In a nutshell, it is observed that LLMs tend to align the attention distribution of node tokens and text tokens.
3. Empirical Study
Our experiment and analysis summary are based multiple datasets. In addition to the presentation part, some detailed settings and results can be specifically seen in Appendix.
To statistically validate these observations, we performed T-tests, Kolmogorov-Smingg (KS), and Divergence (JS) on the attention score distributions, with the results summarized in Table 1.
A1. Changes in Attention Distribution
Fine-tuned LLMs(LLaGA (Chen et al., 2024b)) show relative improvements on graph tasks. To investigate whether LLMs can recognize the differences between graph- structured data and natural language data, as well as effec- tively utilize graph structural information (Q1), we compare the changes in token attention focus before and after train- ing.
Our statistical analysis reveals a distinctive outcome when comparing the attention score distributions before and after training, specifically for node tokens. The KS test indicates significant change in the distribution of attention scores post- training, while the t-test suggests that the mean attention scores remain unchanged. Given that the KS test focuses on the overall distribution and the t-test emphasizes the mean value, this discrepancy highlights the nuanced changes in attention patterns.
Setting. Ho:
The attention focused on node tokens does not change before and after fine-tuning, H;: The attention focused on text tokens changes before and after fine-tuning. Hg: The attention distributions for node tokens and text tokens are not consistent. It is worth noting that we fol- low the recognized LLaGa guidelines. For more detailed information, see Appendix J.
Additionally, the IS distance further supports these find- ings by showing that the overall distribution of attention scores for nodes changes more significantly compared to text tokens. This implies that while the average attention levels remain consistent, the distribution of attention scores exhibits a bimodal trend, indicating that LLMs develop distinct attention patterns for certain nodes, leading to a
We compared the attention score distributions for node to- kens and text tokens before and after training in Figure
3

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
polarization in attention allocation.
Overall(Q1), while LLMs exhibit an awareness of graph- structured data, their current mechanisms limit their ability to effectively utilize this information.
A2. Structure Information Disruption Experiment
After discovering that LLMs can perceive graph-structured data, we further investigated whether they can effectively utilize this type of data. To explore this, we designed dis- ruption experiments with varying levels of connectivity in- formation alteration and observed changes in model per- formance. Ideally, the level of disruption increases, the
In the subsequent subsection, we will delve deeper into the distribution of attention scores to further explore how LLMs process graph-structured data.
B. Adaptability of Attention Distribution to Graph Data
When the graph structure is input the LLMs in natural language form, the model assigns different attention scores to each graph node. By analyzing the attention scores of different types of nodes, we aim to examine whether the LLM can effectively adapt to the graph data structure (Q2) and assess whether its attention distribution aligns with the ideal state-that is, whether it can reasonably allocate attention according to the topologiaal structure of the graph.
model's performance should deteriorate. Additionally, we collected attention scores from the model to provide new insights into its behavior in graph data.
Setting, We divided the disruption experiments into four levels: (1) Swapping entire sets of child nodes between pairs of first-order nodes. (II) Exchanging random numbers of child nodes between first-order nodes, and further disrupt- ing the information structure. (III) Randomly shuffling the positions of first-order and second-order nodes, even allow- ing original second-order nodes to become first-order nodes. (IV) Incorporating unrelated nodes and performing random substitutions. And (Raw) keeping information structure.
Setting, We emulate the most common instruction con- struction methods (such as InstrutGLM (Ye et al., 2023) and LLaGA (Chen et al., 2024b)) to describe graph link structures in natural language form shown in Figure 4. Dur- ing this process, the number of neighbors for each central node varies, meaning that fixed positions in the input se- quence may be occupied by different types of nodes text tokens. To eliminate interference from factors such as se- quence length and position, which could affect the attention scores assigned to node tokens, we introduce two operations: padding and random shufiling. These operations ensure that the input instructions and nodes have a fixed length and position, as illustrated in Figure 4.
The results of these experiments are shown in Table 2. Dis- appointingly, the LLMs showed no significant reaction to the perturbation of graph-structured connectivity informa- tion across half of the datasets. Specifically, in the majority of cases (Wikics, Pubmed), there was no significant change in model performance under disruption levels (I) and (II). Only at higher levels of disruption (III) or (IV) did we ob- serve decline in performance. However, GNNs that passed the WL-test have been continuously decreasing.
B1. Position Bias Interferes with Attention Adaptation
In contrast, only the Roman dataset presented an ideal sce- nario where the model's performance degraded progres- sively with increasing levels of disruption. This behavior aligns with our hypothesis that the model effectively lever- ages traph-structured information. The consistent degra- dation of performance on the Roman dataset suggests that LLMs can indeed exploit structural information when it is sufficiently represented and not overly disrupted. In other datasets, the model failed to demonstrate such a clear pattern, indicating limitations in its ability to utilize graph structure.
Through our experiments, we recorded attention scores for different nodes at fixed positions. As shown in Figure 3 Upper, node tokens exhibit a slash trend or U-shaped dis- tribution of attention towards node tokens, with attention scores sharply increasing for the final nodes. This distri- bution aligns with the common attention distribution curve observed in language models. Additionally, we attribute the lower attention scores for the initial nodes to their not being positioned at the forefront of the entire text.
However, it reveals an issue: under the graph data structure, the LLM's attention to important nodes does not adequately adapt to the graph structure. Specifically, in the ideal state of graph machine learning, the model should prioritize central nodes and gradually decrease attention to neighboring nodes in hierarchical order. Alternatively, if there are super-nodes, a random arrangement should yield an average trend. In- stead, the curve we obtained is entirely different from the ideal state, with the importance of central nodes significantly lagging behind other nodes.
To gain deeper insights, we meticulously examined changes in the distribution of attention scores assigned by neighbor- ing nodes to central nodes before and after training, under varying perturbations. The results are illustrated in Fig- ure 2. Figure 2 delineates the distribution of attention pre- and post-training, revealing a diminished focus on graph structure through reduced attention from neighbor to central nodes in datasets where graph structure information was not effectively utilized. Conversely, on the Roman- -amire dataset, there is an observed increase in such attention, sig- nifying the model's ' learned utilization of graph structure information.
In our exploration of this issue, conducted more de- tailed analysis of the attention patterns between text tokens
4

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Table 2. Connectivity Information Disruption Performance. Node classification results (accuracy($; (%) +std) for 4 runs four real-world datasets and five levels of disruption. The model used is LLama2-7B, with node sampling configured 8x8.
Dataset
Raw
(I)
(II)
(III)
(IV)
Wikics
0.7862:: 0.007
0.7847 0.004
0.7907= 0.0035
0.7670= 0.003
0.7080 0.005
Pubmed
0.8363-10.001 0.806
0.8364:10.002
0.7698=10.003
0.7835=0.001
Ammazon-Ratings
0.4486=00.002
0.3980=10.003
0.3977=0.002
0.3975=0.003
0.3913=0.001
Roman-Empire
0.8089=00.001
0.7918+00000
0.7910+#0.002
0.6290=000002
0.5784+000002
Attention scores on amazon ratings
Attention scores
roman _
Attention scores on wikics
0.030
2.000
0.000
Thime
Thined
Isined
UniTained
untoned
Un-Tainad
0.225
0.05
0.625
0.035
1,009
0.000
0.030
1.020
0.030
0.005
0.065
1,025
0.605
Neighbor nade location
Neighbor nade location
Neighbor node location
Figure 2. The attention scores from neighboring nodes to the contral node, both before and after training, were presented as mean values with standard deviations, using a 1:8 sampling ratio.
and node tokens in Figure 3(Lower). The attention paid by text tokens to node tokens aligns more closely with the ideal scenario: first-order nodes receive higher attention scores compared to their surrounding second-order nodes. The attention scores exhibit fluctuating upward trend function of node position, with peaks occurring at positions corresponding to structurally significant nodes.
on RAG indicate that the placement of tokens in different positions significantly affects attention (Hsieh et al., 2024).
B2. Nodes Interaction Attention Score
To delve deeper into the nuances of attention distribution among node tokens, conducted heatmap visualization analysis of the attention score matrix, uncovering several novel phenomena.
This indicates that the ability of LLMs to capture relation- ships between text and nodes is already quite robust; the aspect that requires further development is the connectivity among nodes within LLMs.
More precisely, Figure 5 shows the attention interaction matrix across all nodes. Based on this, we observed the so-called "Attention sink" phenomenon (Xiao et al., 2024), which manifests in two distinct patterns across most graph datasets. The first pattern is simple "Attention sink" as shown in Figure 5(Left), where certain positions consistently attract higher attention scores without significant topological or sequential information.
When exploring whether there are inconsistencies in the attention paid by node tokens and text tokens to text tokens, the results showed no significant differences between the two. The locations of attention sinks or minor fluctuations were largely consistent, indicating a high degree of simi- larity. This suggests that both node tokens and text tokens exhibit consistent attention patterns towards text tokens.
The second pattern exhibits a unique "diagonal" characteris- tic specific to graph data. Typically, diagonals near the main diagonal exhibit higher attention values due to nodes paying more attention to their neighbors; however, as depicted in Figures 5(ight,) there exists a diagonal with notably higher attention scores compared to surrounding diagonals. This pattern was not found in textual inspections and suggests that the model may be learning to capture unexpected spatial patterns or path dependencies, possibly arising from the in- herent properties of the graph structure. Given its distinction from simple adjacency relationships, we term this pattern
(Qmark(Q2). We found that the attention mechanism does not adapt well to sequentially input graph-structured data, as its distribution does not meet the ideal scenario. Unlike NLP tasks, where the mismatch distribution is acceptable due to uncertain positions of important text, graph graph-structured data contains prior importance information. As a result, LLMs with this issue cannot match the performance of GNNs that focus on graph structure. Furthermore, some studies
5

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Node token nodes attention (Amazon)
Node taken nodee attention (Roman)
Node taken nodes attention (WkiCS)
nede
Conter 1/hop node
hop rode
1 hop node
2-hop mode
node node
2-hap node
nodo
300
300
40
55
70
20
30
40
70
10
20
75
Text token to nodes attentioon on (Amazon)
Text token to nodes attention (Roman)
Text token to nodes attention (Wikics)
Node at Position
Figure 3. Illustration of all tokens to nodes attention. The x-coordinate refers to the relative position of the node token in the entire node list. We collected the attention scores of all tokens towards node tokens and plotted them in a line graph according to the relative position of nodes within the instructions. Upper: the mean values of attention scores from nodes(Querys) to nodes(Keys). Lower: the mean values of attention scores from texts (uttry) to nodes(Keys). The plot annotates nodes at different hicrarchical levels. Our node sampling is 8*8.
In recent works (Kim et al., 2022; Joshi, 2020), has been shown that transformers can be viewed as fully connected graph-attention models, while contemporary decoder-only LLMs function as unidirectional fully connected Graph Transformer (GT) models. For given graph-structured data, the attention window of LLMs manifests as lower tri- angular matrix representing full connectivity, whereas the attention window of GNNs is fixed-linkage adjacency ma- trix. These two extremes represent the spectrum attention windows in graph- wraph-structured data. The attention window determines how the model captures relationships between nodes and is critical factor influencing the effectiveness of graph structure learning. In this section, we explore how LLMs learn and utilize graph structures from different vis- ible perspectives, seeking the optimal linkage perspective between fully connected and fixed-linkage views(Q3).
Raw:
A link link (K Iink
11), 3
-Pad:
D
link liikk pad) link E,F, pad J.D
11,333
+Shuffle:
link E link E.).
link ( pad. K. pad) ). link
J. H
Figure 4. Padding and Random Shuffling ensure fixed sequence length and position. This minimizes interference with attention scores for other reasons.
Setting. We introduce a global linkage horizon & to indi- cate the visibility range node tokens under the attention window. i ranges from 0 to 2L, where I. represents the num- ber of hops or neighborhood radius from the central node. As shown in Figure 6, when sampling subgraphs with L = 2 hops: = means all nodes can only see themselves, k: = indicates all nodes can see their first-order neighbors, and k = means nodes can see all other nodes. Among these, k 0 and effective link information, while & 2, include par- tial graph link information. Additionally, considering that
"Skewed Line Sink."
The emergence of "Attention sink" and "Skewed Line Sink" phenomena interferes with the proper allocation of attention between nodes in LLMs, preventing them from effectively utilizing graph structural information. However, based on these findings, we can engage more effectively with the NLP community to correct these biases.
represent Attention Windows without
C. Attention Window for Graph-Structured Data
6

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
ALL Node Attention Score Interaction Matrik (WikiCS)
Attention Maps of Fistarter Nodes with Direct Children (1*1XAmeonn Retinge)
Node Relative Posttion
Figure Illustration of attention score interaction matrix(Nodes). Left:
panel displays the attention interaction matrix between all nodes (I central node 8 first-order nodes + 8&8 second-order nodes), averaged across all heads and layers. Right: The right panel shows the attention interaction matrices between first-order and second-order nodes, with four selected groups highlighted for detailed analysis. We highlight the "attention sink" with gray box and the "Skewed Line Sink" with black box.
(A: 1) also considered perform well.
Table Model performance(accurrgye Estd) runs on four real world datasets and under different values of k
However, settings with k * 4 require pre-labeling node tokens and modifying the attention window, posing deploy- ment challenges in real-world scenarios. Therefore, we continue our exploration.
k
Wikies
Roman
Amazon
Pubmed
14
77.49
80.73
45.19 0.2 82.92:1.11
unidi
67.81=00006
81.38:1000
43.79= 0.4
82.47=0.4
bidi
C2. Unidirectional vs. Bidirectional Attention
33
unidi
13.9610.113
81.6810.02
45.46= 0.0
83.3610.1
7..93:10.26
81.61+0.0
45.63= 0.1
81.9810.1
To further investigate the impact of unidirectional and bidirectional attention, we conducted comparative exper- iments in Table 4. The mutual transfer between unidi- rectional and bidirectional attention is difficult to achieve better results, and the loss caused by transfer increases as the value of k grows.
bidi
22
unidi
78.90:10.17
82.87+0.02
44.67= 0.0
82.8910.3
2.2
0..42+0011
45.18 0.2 82.05+0.02
82.67+0011
badi
k uuiid
78.15# 0.02
83.1210.0
45.95= 0.1
80.49+0.2
78.43# 0.09 83.0510.01
46.17 0.0 79.81
C3. Transferability across Different Visible Perspectives
LLMs are mostly unidirectional decoders, while GNN links are bidirectional, we incorporate both unidirectional (Kuidd) and bidirectional (kea) links into our empirical study.
We also tested the transfer ability of models trained one value and inferred at others in Table 4.
Small-to-larged Surprisingly, switching from smaller to larger values does not weaken model performance but rather enhances Specifically, we can achieve better per- formance at inference time with k=4 by training the model at k 2 l: 3, compared to training directly k 4. Since k 4 is the fully connected view of LLMs, no modi- fication is required during real-world inference, addressing the deployment difficulties mentioned in subsection CI.
C1. Optimal Visible Perspective
We conducted multiple experiments with different & values, and the results summarized in Table 3. From the table, it is evident that when the training and inference k values re- main unchanged, the fully connected view (k = 4) of LLMs cannot achieve the best performance. In contrast, intermedi- ate views (k = 2, 3), which contain certain topological link information, achieve better results. The fixed-linkage view

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Fixed-Linkage Window((GN))
k=Z(caucal)
(c) (c3uca)
(d) Full Connectivity Window
k=1
k=4
82
82
82
01
A
D2
C1
C2
C3
5
81
82
C1
C2
C3
0
51
82
C
C1
22
C3
A
51
82
C1
C2
Local
Locol
X
Global
X
Global
Global
Global
Figure Illustration different global linkage horizon From right, the images represent k=1 to 4. To demonstrate the field view of GNNs, the image for k=1 is depicted bidirectionally, while the rest shown unidirectionally.
Table Transfer Performance of Models across Different & Values. Rows indicate the & value used during training. Columns represent the value utilized during testing. The best performance for each & value transfer highlighted in gray, with the overall best performance bolded. The best result of LLM testing under normal window (k conditions is indicated with an underline.
Test
1.4
R4 umidii
R-3
1.3 unidii
1.2
R-2
1.1
Train
unidi
k4
67.81+0.06
66.87+0.119
68.09=0.34
65.95+0.04
67.45+10.13
66.72++0.13
65.10+1.221
64.82++0.23
uniid
61.02:10.23
77.49:0.21
72.43=0.02
78.4110.06
74.7510.38
78.1910.23
77.0010.36
77.87
74.63#1.11
72.1740.66
74.93=0.26
72.75+0.26
75.87=0.04
72.83+0.17
72.66:0.17
71.23+0.11
k3
unidi
07.73++0.49
77.82+0.30
7..55
77.96+0.13
0..4
0..2
7..68
77.74+0.04
0.30
73.71+0.49
7.21
7..8
77.42+0.11
75.224-0.47
76.59+0.51
74.48
kunidi
52.58
74.97
68.80=0.53
77.51
73.3010.56
78.9010.117
76.08+0.38
76.33
biidi
49.17
74.33
69.20=0.09
75.22+0.34
75.25
76.78:L0.45
78.32:10499
18.49
unidi
34.05+00.01
72.08 55.75=0.21
74.6340.26
66.1910.02
76.91
75.5010.53
78. 15.002
Large-to sm-ell Transitioning from a broader narrower window results in improved model performance (c.g., from 4 to 3, from 3 to 2). We attribute this phenomenon to the fact that training LLMs is more challenging from wider perspectives, where the model must contend with greater amount of context and potential noise. When shifting to narrower perspective, the model benefits from a reduced level of complexity and fewer distractions, leading to better.
pendix A, with information about the dataset in Appendix B. Additional related work is discussed in Appendix C. Atten- tion plots and experimental results for other datasets (base LLMs) are presented in Appendices H, G, I, and F.
4. Findings and Conclusion
Findings. We found that although LLMs gradually become aware of graph data during training, they fail to effectively leverage the connectivity information within these graphs. It was also discovered that fine-tuned LLMs possess the ability to capture relationships between nodes and text, but they lack the capability to model relationships among nodes. This limitation manifests as "Attention Sink" and "Skewed Line Sink" phenomena attention interactions.
OV3) our empirical studies reveal that the Attention Window with connection information significantly impacts LLM's understanding of graph structure. Training with non- fully connected views containing certain topological link information aids LLMs in understanding graph structures and facilitates transfer from small to large perspectives.
Other work in Appendix
Additionally, found that fully connected attention win- dows of LLMS are not suitable for training on graph data. A
A detailed description of the setup is provided in Ap-
8

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
better approach is to train under smaller perspective that incorporates graph topology information and then perform transfer learning.
healthcare I1 for effective medical documentation. In Proceedings of the 17th ACM International Conference Web Search and Data Mining, pp. 1167-1168, 2024.
Conclusion and Limitation. We explored the attention mechanisms LLMS on graph data and discovered numer- ous phenomena, providing directional guidance for further research by the graph learning community. the same time, due to limitations in length and resources, we only analyzed a portion of the discovered phenomena. There remains a wealth of unexplored phenomena awaiting further investigation by the research communityy
Guan, Z., Zhao, H., Wu, L., He, M., and Fan, J. Langtopo: aligning language descriptions of graphs with tokenized topological modeling, arXiv preprint arXiv:2406. 1.t00 2024.
He, X., Bresson, X., Laurent, T., Perold, A., LeCun, Y., and Hooi, B. Harnessing explanations: LIm-to-Im interpreter for enhanced text-attributed graph representation learning. In The Twelfth International Conference on Learning Representations, 2023.
Impact Statement
This paper presents work whose goal advance the field of machine learning. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here.
He, X., Bresson, X., Laurent, T., Perold, A., LeCun, Y., and Hooi, B. Harnessing explanations: LIm-to-Im interpreter for enhanced text-attributed graph representation learning. In The Twelfth International Conference Learning Representations, 2024.
Acknowledgements
He, Y. and Hooi, B. Unigraph: Learning a cross-domain graph foundation model from natural language. arXiv preprint arXiv:2402.13630 2024.
This study was partially funded by the supports of National Natural Science Foundation of China (72471 165) and Natu- ral Science Foundation of Tianjin (No. 24ICQNIC01560).
Hsieh, C.-Y., Chuang, Y.-S., Li, C.-L.,, Wang, Z., Le, L. T., Kumar, A., Glass, J., Ratner, A., Lee, C.-Y., Krishna, R., et al. Found in the middle: Calibrating positional attention bias improves long context utilization. arXiv preprint arXiv:2406. 16008, 2024.
References
Acharya, S., Jia, F., and Ginsburg, B. Star attention: Effi cient Ilm inference over long sequences. arXiv preprint arXiv:2411.17116 2024.
Huang, X., Han, K., Yang, Y., Bao, D., Tao, Q., Chai, Z. and Zhu, Q. Can gnn be good adapter for Ilms? In Proceedings of the ACM on Web Conference 2024, pp. 893-904, 2024.
Brown, T., Mann, B., Ryder, N., Subbiah, M.. Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems, 33: 1877-1901, 2020.
Joshi, C. Transformers are graph neural networks. The Gradient, 12:17, 2020.
Chen, R., Zhao, T., Jaiswal, A., Shah, N., and Wang, Z. Llaga: Large language and graph assistant. arXiv preprint arXiv:2402.08110, 2024a.
Kenton, J. D. M.-W. C. and Toutanova, L. K. Bert: Pre- training of deep bidirectional transformers for language understanding. In Proceedings of naacI-HLTT, volume 1, pp. 2. Minneapolis, Minnesota, 2019.
Chen, R., Zhao, T., JAISWAL, A. K., Shah, N., and Wang, Z. Llaga: Large language and graph assistant. In Forty-first International Conference on Machine Learning, 2024b.
Kim, J., Nguyen, D., Min, S., Cho, S., Lee, M., Lee, H., and Hong. S. Pure transformers are powerful graph learners. Advances in Neural Information Processing Systems, 35: 14582-14595, 2022.
Duan, J., Cheng, H., Wang, S., Zavalny, A., Wang, C., Xu, R., Kailkhura, B., and Xu, K. Shifting attention rele- vance: Towards the predictive uncertainty quantification of free-form large language models. In Proceedings of the 62nd Annual Meeting of the Association for Compu- tational Linguistics ( (Volume 1: Long Papers), pp. 5050- 5063, 2024.
Kipf, T. N. and Welling, M. Semi-supervised classifica- tion with graph convolutional networks. In International Conference on Learning Representations, 2022.
Kong, L., Feng, J., Liu, H., Huang, C., Huang, J., Chen, Y., and Zhang, M. Gofa: A generative one-for-all model for joint graph language modeling. arXiv preprint arXiv:2407.09700 2024.
Goyal, S., Rastogi, E., Rajagopal, S. P., Yuan, D., Zhao, F, Chintagunta, J., Naik, G., and Ward, Healai: A

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
Liang, Y., Liu, H., Shi, Z., Song, Z., Xu, Z., and Yin, Conv-basis: A new paradigm for efficient attention in- ference and gradient computation in transformers. arXiv preprint arXiv:2405.05219, 2024.
Sun, S., Ren, Y., Ma, C., and Zhang, X. Large language mod- els as topological structure enhancers for text-attributed graphs. arXiv preprint urXiv:2311.14324, 2023.
Touvron, H., Martin, L.,, Stone, K., Albert, P., Almahairi, A., Babaci, Y., Bashlykov, N., Batra, S., Bhargava, P., Bhosale, S., et al. Llama Open foundation and fine- tuned chat models, arXiv preprint arXiv:2307.09988 2023.
Liu, Z., Wu, I.., He, M., Guan, Z., Zhao, H., and Feng, N. Multi-view empowered structural graph wordification for language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pp. 24714-24722, 2025.
Wu, L., Zhao, H.,, Li, Z., Huang, Z., Liu, Q., and Chen, E. Learning the explainable semantic relations via unified graph topic-disentangled neural networks. ACM Trans- actions on Knowledge Discovery from Data, 17(8):1-23, 2023.
Luo, Y., Shi, L., and Wu, X.-M. Classic gnns are strong baselines: Reassessing gnns for node classification. arXiv e-prints, pp. arXiv-2406, 2024.
Makkuva, A. V., Bondaschi, M., Nagle, A., Girish, A., Kim, H., Jaggi, M., and Gastpar, M. Attention with markov: A curious case of single-layer transformers. In ICML 2024 Workshop Mechanistic Interpretability, 2024.
Wu, L., Zheng, Z., Qiu, Z., Wang, H., Gu, H., Shen, T., Qin, C., Zhu, C., Zhu, H., Liu, Q., et al. A survey on large language models for recommendation. World Wide Web, 27(5):60, 2024.
Mernyei, P. and Cangea, C. Wiki-cs: A wikipedia-based benchmark for graph neural networks. arXiv preprint arXiv:2007.02901, 2020.
Xiao, G., Tian, Y., Chen, B., Han, S., and Lewis, M. Ef- ficient streaming language models with attention sinks. In The Twelfth International Conference Learning Representations, 2024.
Ouyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., et al. Training language models to follow instructions with human feedback. Advances in neural information processing systems, 35:27730-27744, 2022.
Yang, H., Wang, X., Tao, Q.. Hu, S., Lin, Z., and Zhang, M. Gl-fusion: Rethinking the combination of graph neural network and large language model. arXiv e-prints, pp. arXiv-2412, 2024.
Pi, R., Yao, L., Gao, J., Zhang, J., and Zhang, T. Percep- tiongpt: Effectively fusing visual perception into 1lm. In Proceedings of the IEEE/CVF Conference Computer Vision and Pullern Recognition, pp. 27124-27133 2024.
Yang, J., Liu, Z., Xiao, S., Li, C., Lian, D., Agrawal, S., Singh, A., Sun, G., and Xie, X. Graphformers: Gnn- nested transformers for representation learning on textual graph. Advances in Neural Information Processing Sys- tems, 012287982288111 2021.
Platonov, O., Kuznedelev, D., Diskin, M., Babenko, A., and Prokhorenkova, L. A critical look at the evaluation of gnns under heterophily: Are we really making progress? In The Eleventh International Conference on Learning Representations, 2023.
Ye, R., Zhang, C., Wang, R., Xu, S., and Zhang, Y. Natural language is all graph needs. arXiv preprint arXiv:2308.077 134, 2023.
Yu, Z., Wang, Z., Fu, Y., Shi, H.,, Shaikh, K., and Lin, Y. C. Unveiling and harnessing hidden attention sinks: En hancing large language models without training through attention calibration. arXiv preprint 2rX1v:2406.15766 2024.
Qiao, Y., Ao, X., Liu, Y., Xu, J., Sun, X., and He, Q. Login: large language model consulted graph neural network training framework. arXiv preprint arXiv:2405.13902, 2024.
Ruan, T. and Zhang,5 S. Towards understanding how atten- tion mechanism works in deep learning. arXiv preprint 2rXiv:2412.18288 2024.
Zhang, S., Zheng, D., Zhang, J., Zhu, Q. Adeshina, S., Faloutsos, C., Karypis, G., Sun, Y., et al. Hierarchical compression of text-rich graphs via large language mod- els. arXiv preprint arXiv:2406. 22244066/88.. 1884, 2024.
Singh, I., Blukis, V., Mousavian, A., Goyal, A., Xu, D., Tremblay, J., Fox, D., Thomason, J., and Garg, A. Prog- prompt: Generating situated robot task plans using large language models. In 2023 IEEE International Conference on Robotics and Automation (ICRA), pp. IEFE, 2023.
Zhao, H., Wu, L.,, Shan, Y., Jin, 7.,, Sui, Y., Liu, Z., Feng, N., Li, M., and Zhang, W. A comprehensive survey of large language models in management: Applications, chal- lenges, and opportunities. Challenges, and Opportunities (August 14, 2024), 2024.
10

---

Attention Mechanisms Perspective: Exploring LLM Processing of GraphhSStuuturre Data
Zhao, J., Qu, M., Li, C., Yan, H., Liu, Q.. Li, R., Xie, X., and Tang, J. Learning on large-scale text-attributed graphs via variational inference. arXiv preprint arXiv:2210.14709 2022.
Zhu, X., Xue, H., Zhao, Z., Jin, M., Xu, W. Huang, J., Wang, Q., Zhou, K., and Zhang, Y. Llm gnn: Graph vocabulary learning for graph foundation model. openre- view, 2024a.
Zhu, Y., Wang, Y. Shi, H., and Tang, S. Efficient tuning and inference for large language models textual graphs. arXiv preprint arXi::401.11569, 2024b.

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
A. Implementation Details
Throughout the experiments, we maintained LLama2-7B (Touvron et al., 2023) as our base model and used an 8x8 scheme for neighbor sampling. For each dataset, during the experimental process, we processed the raw text from the datasets using the base model serve as the embedding features for the nodes, treating each node akin token in the manner of LLama. Regarding the data collected as described in A.I, gathered the attention scores for each node across different layers and heads, scaling them using a logarithmic function. For the perturbed data in A.2: (II) We performed random swaps between two nodes, repeating this procedure ten times consecutively. (IV) We conducted random exchanges of nodes within the same batch to introduce disorder. More details are shown in Table 5,
Table S. Hyperparameters for the Koman-Fmpine Amazon Ratingg,,, and Pubmed, Wikics.
Hyperparameters
Amazon-Ratings Ratings
Pubmed
Wikeis
Roman
learning rate
le-4
le-4
le44
le-4
warmup
0.05
0.05
0,05
0,05
gradient accumulation steps batch size
4
4
epoch
num_ beams
2
use embedding
Ture
True
False
False
B. Datasets
When selecting datasets, we considered broad spectrum and chose heterogeneous graph datasets Amazon-Rating (Platonov et al., 2023) and Roman-Empire (Platonov al., 2023), well as homogeneous graph datasets Pubmed and Wi- kiCS (Mernyei & Cangea, 2020). The statistical metries of each dataset are shown in the following Table 6.
Table 6. Statistics of datasets
Roman-Empire Amazon-Ratings
Wikics
Pubmed
nodes
22,662
24,492
11,701
19,717
edges
32,927
93,050
216,123
44,338
avg degree
2.91
7.60
36.89
4.49
node features
4096
4096
4096
4096
classes
18
5
10
3
edge homophily
0.05
0.38
adjusted homophily
-0.05
0.14
C. Additional Related Work
Recent advancements have delved into leveraging Large Language Models (LLMs) within graph structure domains. Studies such as GLEM (Zhao et al., 2022), along with other works (Yang et al., 2021), have probed into the integration of LLMs and Graph Neural Networks (GNNs) through joint training frameworks. The approach taken by (He et al., 2023) employs LLMss to forecast node ranking classifications and offers comprehensive insights to enrich the quality of GNN embeddings. Meanwhile, Sun et al. (2023) has exploited LLMs for generating pseudo-labels aimed at enhancing the representation of graph topologies. Moreover, there has been an emphasis on advancing the direct processing capabilities of LLMs for textual graphs. For instance, InstructGLM (Ye al., 2023) pioneers the use of instruction tuning based on LLMs to articulate graph structures and node characteristics, effectively addressing graph-related tasks. An interactive fusion of LLMs and GNNs is also presented by (Qiao et al., 2024). Despite these strides, L.MSs face challenges when dealing with structured data that has been converted into natural language, frequently leading to less than optimal outcomes. To address this issue, LLaGA (Chen et al., 2024a) reformulates node-link information into sequential data, thereby applying instruction tuning that enhances LLM comprehension while preserving structural node information. UniGraph (He Hooi, 2024) implements masked strategy for co-training L.MSs and GNNs together, achieving robust generalization across diverse graphs and
12

---

Attention Mechanisms Perspective: Exploring LLM Processing of Craph-SStucctrre Data
datasets. Additionally, Kong al. (2024) investigates the creation of graph-based foundational models that merge LLMs with GNNs. GraphAdapter (Huang et al., 2024) utilizes GNN model adapter working alongside LLMSs for TAG tasks, which aids in task-specific fine-tuning via external access.
Moreover, recent efforts have increasingly focused on designing modules from a more comprehensive perspective to achieve better performance. In the context of Zhu et al. (2024a), mimicking the aggregation process GNNs through instructions forces LLMs to learn how to aggregate node information effectively. The work by Zhang et al. (2024) employs LLMs to compress lengthy raw texts hierarchically. ultimately condensing them into a small number of tokens suitable for graph tasks. This hierarchical compression allows for efficient representation of complex textual data in form that can be readily processed by graph-basee bbased models.
Zhang et al. (2024) approach incorporates the information from neighboring nodes when performing attention calculations on tokens within its own text, while also reducing the number of tokens. During the final inference phase, it refines predictions by re-evaluating the surrounding neighbor nodes, thereby enhancing the accuracy and relevance of the outcomes.
D. Other Base Models for Disruption Performance
Table Disruption Performance, Node classification results (accuracy( (6) istd) for 4 runs on four woalwwrldd datasets and five levels of disruption. The model used is Vicuna-7B, with node sampling configured as 8x8.
Dataset
Raw
(I)
(II)
(III)
(IV)
Wikies
0.7899 0.004
0.7898 0.002
0.7919 0.001
0.7773+ 0.002
0.7101 0.005
Pubmed
0.002
0.8345++0.001
0.8300++0.001
0.7453++0.001 0.7434++0.00
Amaaonn-Rating
0.45411:0.00
0.454410.001
0.4498:100002
0.4135=00.00
0.3943#:0.001
Noman-Empire
0.000
0.0001
0.7883+0.003
0.6543=#00001
0.6016+0.0001
Table Disruption Performance. Node classification results (accuracy(% +std) for 4 rums four real-world datasets and five levels of disruption. The model used is LLama3-7B, with node sampling configured as 8x8.
Dataset
Raw
(II)
(III)
(IV)
Wikics
0.7988 + 0.001
0.7981 0.006
0.7988 0.005
0.7487+ 0.002
0.7209+ 0.001
Pubmed
0.844811..01
0,8449400003
0,8442:10.033
0.8067+0.003
0.7753+0.002
Amazon-Be MaazonnRatings
0.4515+#.000
0.4523+000002
0.3985+:0.003
0.3889#0.002
0.3744:0.005
Roman-Enan -mmare
0.8108+:0002
0.8007:00.002
0.7922+0.002
0.6324+0.001
0.5618+0.002
E. Statistical Analysis of Attention Score Distributions
It can be seen that most of them are consistent with presentation and conclusions.
Table 9. Statistical Analysis of Attention Score Distributions. Note: s indicates p-value 0.01, otherwise p 0.05 for t-test and KS test. Divergence values are provided
Amazon
WikiCS
Comparison
T-Test
KS Test
JS
T-Test
KS Test
JS
Before vs After (Text)
95.066
0.118
0.0066
61.764
0.107
0.0038
Before vs After (Node)
69.334**
0.116
0.0113
118,293**
0.216
0.0307
Node vs Text (Before)
-337.116
0.428
0.1423
-268.998**
0.362
0.0766
Node vs Text (After)
-318.054**
0.438**
0.1123
-184.605**
0.285**
0.0264
13

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
F. Disruption Attention Score
Figure 2, we illustrate the attention scores from neighboring nodes central node before and after training, without altering the structural information. Here, we show the attention scores from neighboring nodes the central node under various perturbation conditions.
Table 10. Disruption Attention Score (Amazon -aaiinns, The attention from neighboring nodes to the central node, presented as mean values with standard deviations, using a 1:8 sampling ratio.
Node 1
3
4
5
7
8
(raw)
0.017=0.025 0.018=0.025 0.01210.019 0.008=0.011 0.007:100011 0.006:10.009 0.004:10.005 0.00410..005
(I)
0.018=0.025 0.018=0.025 0.012=0.020
0.008=00012 0.007=000000 0.006=10.008 0.004=1.0005 0.004=0.0005
(II)
0.017=0.024 0.017=0.025 0.012=0.019 0.008=0.010 0.007=0.010 0.006+10.009 0.004=1.0005 0.004=0.005
(III)
0.019=0.026 0.018=0.026 0.013=0.020 0.008=00011 0.007=00000 0.006:100008 0.004=0.005 0.004=0.005
(IV)
0.017=0.025 0.018=0.025 0.012=0.019 0.008=0.011 0.007=0.011 0.006+0.009 0.004 0.004
Table 11. Disruption Attention Score (Wikics). The attention from neighboring nodes the central node, were presented values with standard deviations, using 1:8 sampling ratio.
Node 1
4
7
8
(raw)
0.017 0.012 0.0114 0.006:10.011
0.006:10.011 0.005:+0.010 0.004-10.009
0.004-10.009
(I)
0.018=00022 0.013=:0018 0.009
0.007=0.013
0.006+10.012 0.005++0.012
0.004-+0.011 0.004+10.010
(II)
0.017=0.020 0.012=0.016 0.008=0.013 0.006:10.010 0.00610.010 0.005=10.009 0.004 0.004
(III)
0.016=0.019 0.011=0.013 0.007=0.009 0.005=0.006 0.005#0.006 0.00410.005 0.003:0.004 0.003+0.003
(IV)
0.018=0.022 0.013=0.018 0.009=0.015 0.007=0.012 0.006:0.012 0.005+10.011 0.00410.010 0.00410.010
Table Disruption Attention Score (Roman). attention scores from neighboring nodes the central node, were presented as mean values with standard deviations, using 1:8 sampling ratio.
Node
4
8
(raw) 0.02 0.016=0.016 0.014 0.012+0.012 0.010-0.0010 0.009-10.010 0.011
0.004+:00002
(I)
0.024=00021 0.016=0.016 0.013=10.013 0.011=0.011 0.009:10.010 0.009=t0.009 0.011=0.011
0.004+00.00
(II)
0.02411.021 0.016:20.016 0.014:10.014 0.01210.013 0.010:100011 0.01011.0100 0.011#0.011 0.004100003
(III)
0.02210.020 0.01510.014 0.0111000111 0.01010.011 0.009-100009 0.00811.008 0.006:10.010 0.004100001
(IV)
0.02310.021 0.01620.016 0.01440.014 0.01210.012 0.01010.010 0.009100010
0.011 0.00410.003
14

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
G. Attention Score Matrix(Tokens)
G.I. Token Token
ALL Node Attention Score Interaction Matrix (WikiCS)
8
16
24
Node Relative Position
32
40
48
56
64
72
16
24
32
40
48
56
64
72
Node Relative Position
Figure 7. Attention score interaction matrix(Nodes) in Wikics.
15

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Strucc Srrapt-Structured Data
ALL Node Attention Score Interaction Matrix (Roman-Empirns
0
8
24
Node Relative Position
32
40
48
56
72
16
24
32
56
64
72
Node Relative Position
Figure 8 Attention interaction matrix(Nodes) in Roman- noman-Fmpire.
16

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structurdd Data
ALL Node Attention Score Interaction Matrix (Amazon-Ratings)
0
8
24
Node Relative Position
32
40
48
56
72
16
24
32
56
64
72
Node Relative Position
Figure 9, Attention interaction matrix(Nodes) in Amazon- -aazon-Ratings....
17

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
G.2. Text to Text
ALL Text Attention Score Interaction Matrix Wikics
Node Relative Position
Node Relative Position
Figure 10. Attention score interaction matrix(Text) Wikics.
18

---

Attention Mechanisms Perspective: Exploring LLM Processing of Strph-Sttucttued Data
ALL Text Attention Score Interaction Matrix Roman-Empire
Node Relative Position
Node Relative Position
Figure 11. Attention score interaction matrix(Text) in Roman Roman-Empire.
19

---

Attention Mechanisms Perspective: Exploring LLM Processing of Sraph-Structured Data
ALL Text Attention Score Interaction Matrix Amazon-Ratingg
Node Relative Position
Node Relative Position
Figure 12, Attention score interaction matrix(Text) in Amazon -atings..
20

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
H. Attention Score among First Nodes(with child nodes)
Attention Score of first-order nodes(with child nodes)
0-th with 1-th first noths(with child nodes)
2-th with 3-th first nodes(with child nodes)
0.030
0.030
2
0.025
0..25
4
5
5
0.020
-0.020
8 7
8
0.015
-0.015
17 16 15 14 13 12 11 10
10
11
0.010
12
0.010
13
14
0.005
15
0.005
16
17
0.000
0.000
12
13
14
15
16
17
8
10
12
13
14
15
16
17
4-th with 5-th first nodes(with child nodes)
6-th with 7-th first nodes(with child nodes)
0.030
0.030
4 3 2 0
2
0.025
0.025
5
5
0.020
0.020
6
6
7
8
8
0.015
-0.015
9
10
10
11
11
16 15 14 13 12
0.010
12
00.010
13
14
0.005
0.005
15
16
17
0.000
0.000
0
6
10
11
12
13
14
15
16
17
0
6
7
10
11
12
13
14
15
16
17
Figure Visualization of the average attention(Attentionn Score among First Nodes(with child nodes)) in Amazon-Ratinge Ratings((++8))))
21

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Struce StractStt Data
Attention Score of first-order nodes(with child nodes)
0-th with 1-th first nodes(with child nodes)
2-th with 3-th first nodes(with child nodes)
0.030
0.030
0.025
0.025
3
0.020
0.020
6
8
0.015
0.0155
9
9
11 10
10
0.010
00.000
17 15 14 13 12
12
13
14
0.005
0.005
15
17115
16
17
0.000
0.000
0
6
7
8
10
11
12
13
14
15
16
17
0
6
8
10
11
12
13
14
15
16
17
4-th with 5-th first nodes(with child nodes)
6-th with 7-th first nodes(with child nodes)
0.025
0.025
4 3
3
0.020
-..000
6
7
0.015
0.015
9
9
10
10
11
11
12
0.010
0.010
17 15 14 13
13
14
0.005
15
0.005
16
16
0.000
0.000
7
10
11
12
13
14
15-
16
17
10
11
12
13
14
15
16
17
Figure 14, Visualization of the average attention Score among First Nodes(with child nodes)) in Roman-Enin Roman-Empire(111 Empire((++8)))
22

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Struce StractStt Data
Attention Score of first-order nodes(with child nodes)
0-th with 1-th first nodes(with child nodes)
2-th with 3-th first nodes(with child nodes)
0.030
0.030
2
0.025
0.025
3
5
0.020
0.020
6
8
8
0.015
0.0155
9
9
11 10
10
0.010
-0.000
17 15 14 13 12
12
13
14
0.005
0.005
15
16
17
0.000
0.000
0
6
7
8
10
11
12
13
14
15
16
17
0
6
7
8
10
11
12
13
14
15
16
17
4-th with 5-th first nodes(with child nodes)
6-th with 7-th first nodes(with child nodes)
0.025
0.025
4 3
3
0.020
-..000
6
7
7
8
8
0.015
0.015
9
9
11 10
10
12
11
12
0.010
0.010
17 15 14 13
13
14
0.005
15
0.005
16
0.000
0.000
7
10
11
12
13
14
15-
16
17
10
11
12
13
14
15
16
17
Figure 15. Visualization of the average attention Score among First Nodes(with child nodes)) in Wikics([++8)+))
23

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
I. Different Layer Attention Score between First Nodes and child nodes
Attention Score of Center and first-order node
Layer 1
Layer 3
Layer
Layer 7
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.001
0.001
0.001
0.001
0.000
0.000
0.000
0.000
7
2
Layer 9
Layer
Layer
Layer
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.003
0.003
0.003
0.003
0.002
0.002
0.002
0.002
0.001
0.001
0.001
0.001
0.000
0.000
0,000
0.000
2
Layer 17
Layer 19
Layer 21
Layer 23
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.003
0.003
0.003
0.003
5
Layer 25
Layer 27
Layer
Layer
0.004
0.004
0.004
0.003
0.003
0.003
0.003
0.002
0.002
0.002
0.002
0.001
0.001
0.001
0.001
0.000
0.000
0.000
0.000
4
2
8
2
Figure 16. Visualization of the average attention(Center nodes and First-order nodes) in Amazonn-atinggs
24

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structure Data
Attention Score of Center and first-order node
Layer
Layer
Layer 5
Layer 7
0.0150
0.0150
0.0150
0.0150
0.0125
0.0125
0.0125
0.0125
0,0100
0.0100
0.0100
0.0100
0.0075
0.0075
0.0075
0,0075
0,0050
Layer
Layer 11
Layer 13
Layer 15
0.0125
0.0125
0.0125
0.0125
0.0100
0.0100
0.0100
0,0100
0.0075
0.0075
0.0075
0.0075
0.0050
0.0050
0.0050
0.0050
0.0025
0.0025
0.0025
0.0025
0.0000
0,0000
0,0000
0,0000
1
Layer
Layer
Layer 21
Layer 23
0.0150
0.0150
0.0150
0.0150
0.0125
0.0125
0.0125
0.0125
0,0100
0.0100
0.0100
0.0100
0.0075
0.0075
0.0075
0,0075
0.0000
0.0000
0.0000
0.0000
Layer 25
Layer 27
Layer 29
Layer 31
0.0150
0.0150
0.0150
0.0150
0.0125
0.0125
0.0125
0.0125
0.0100
0.0100
0.0100
0.0100
0.0075
0.0075
0.0075
0.0075
0.0050
0.0050
0.0050
0.0050
0.0025
0.0025
0.0025
0.0025
0.0000
0.0000
0.0000
0.0000
6
Figure 17. Visualization of the average attention(Center nodes and First-order nodes) in Roman-Empire,
25

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-SStucturee Data
Attention Score of Center and first-order node
Layer 1
Layer 3
Layer
Layer
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.003
0.003
0,003
0.003
0.002
0.002
0.002
61
0.002
Layer 9
Layer 11
Layer
Layer
0.003
0.003
0.002
0.002
0.001
0.001
0.001
0.001
0.000
0,000
0.000
0.000
2
2
Layer 17
Layer 19
Layer
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.003
0.003
0.003
0.003
0.002
0.002
0.002
0.002
0.001
0.001
0.001
0.001
0.000
0.000
0.000
0.000
2
Layer 25
Layer 27
Layer 29
Layer 31
0.005
0.005
0.005
0.005
0.004
0.004
0.004
0.004
0.003
0.001
0.001
0.000
0.000
0.000
0.000
7
2
5
Figure 18. Visualization of the average attention(Center nodes and First-order nodes) Wikies.
26

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
J. Prompt
Here, we list all the prompts we used in this paper on different datasets, we use the following prompt:
"<User >: In an article, words that have dependency relationships (where one word depends on another) are connected, forming a dependency graph. Based on the connections between words, determine the syntactic role of each word. Given that a word [] that connect [], what is the word syntactic role? <Assistant >
Roman-Empire:
Amazon-Ratings: "<User In product graph dataset, edges connect products that frequently purchased together. Based the connections between products (books, music CDs, DVDs, VHS tapes), predict the average rating given by reviewers for the products. Given that product [] that connect []. what is the product [] rating? <AAssistant >:
Pubmed: "<User >; In medical paper dataset, papers that cite each other form a linkage relationship. Based on the linkage relationships among papers, the research directions of medical papers can be predicted. Given that paper [] that connect What the category of the paper []? < <Assistant >::"
Wikics: "<User >: In paper dataset, papers that cite each other form a linkage relationship. Based on the linkage relationships among papers, the research directions of papers can be predicted. Given that paper [] that connect []. What is the category of the paper []? <Assistant >:
K. Different Templates
We designed various Templates for analysis and discussion, inspired by the the paper (TALK LIKE A GRAPH).
The results of the disruption experiment are as follows. From the Table K, it can seen that although different templates have varying model performances, the overall trend is consistent, showing utilization of link information specifically on the Roman dataset, while link information did not play a role on most other datasets. Our initial template (I) remains the best performing and makes the best use of link information.
Table 13. Comparison different datasets under various templates.
Dataset
Raw
(I)
(II)
(III)
(IV)
(I)
Wikics
0.7862 = 0.007
0.7847 = 0.004
0.7907 + 0.0035
0.7670
0.003
0.7087 = 0.005
Pubmed
0.8367 0.003
0.8363
0.001
0.8364
0.002
0.7698
0.003
0.7835 0.001
Amazon-Ratings
0.4486 0.002
0.3980
0.003
0.3977
0.002
0.3915
0.003
0.3813 + 0.001
Roman-Empire
0.8089 + 0.001
0.7918 + 0.001
0.7910 + 0.002
0.6290
0.002
0.5784 0.002
(2)
Wikics
0.7795 + 0.006
0.7789 + 0.005
0.7778 + 0.003
0.7512
0.004
0.6871 0.006
Pubmed
0.8112 + 0.004
0.8108 = 0.002
0.8050 0.001
0.7745 0.002
0.7783 + 0.002
Amazon-Ratings
0.4231 + 0.003
0.4038 + 0.002
0.3923 + 0.003
0.3869
0.002
0.3768 + 0.002
Roman-Empire
0.7932 + 0.002
0.7961 = 0.002
0.7935 + 0.001
0.7228 0.003
0.6130 = 0.001
(3)
Wikics
0.7806 0.007
0.7793 + 0.004
0.7851 + 0.0035
0.7618 0.003
0.7025 0.005
Pubmed
0.8315 + 0.003
0.8310 = 0.001
0.8312 0.002
0.7643 0.003
0.7781 0.001
Amazon-Ratin Ratings
0.4438 + 0.002
0.3932 = 0.003
0.3929 + 0.002
0.3867 + 0.003
0.3765 + 0.001
Roman-Empire
0.8030 + 0.001
0.7864 = 0.001
0.7856 + 0.002
0.6234 + 0.002
0.5728 + 0.002
(4)
Wikics
0.7811 + 0.006
0.7833 = 0.005
0.7812 + 0.0030
0.7665 0.004
0.7092 0.006
Pubmed
0.8325 + 0.004
0.8322 + 0.002
0.8317 0.001
0.7897 0.002
0.7064 + 0.002
Amazon-Ratings
0.4379 + 0.003
0.4085 = 0.002
0.4072 + 0.003
0.3978 + 0.002
0.3885 + 0.002
Doman-Empire
0.8091 + 0.002
0.7915 = 0.002
0.7913 + 0.001
0.6285 + 0.003
0.5788 + 0.001
27

---

Attention Mechanisms Perspective: Exploring LLM Processing of Graph-Structured Data
L. Transfer Performance of Models across Different &: Values.
Table 14. Transfer Performance of Models Different & Values(Roman). Rows indicate the value used during training, Columns represent the & value utilized during testing. The best performance for cach value transfer is highlighted in gray, with the overall best performance bolded.
k=4
k=3
k=2
k=1
bidi
unidi
bidi
unidi
bidi
unidi
bidi
unidi
Kig k
0..0
73.72:10.04
80.96:10.02
73.84=00044
79.82:1.01
74.28-0.06
79.10:1.000
73.91=0.04
gnidi
68.51=0.04
80.73+0.00
70.51=0.04
80.37=0.01
73.0440.04
79.66=0.01
72.48+0.01
79.73=0.01
80.96:10.02
0.005
81.61+0.00
75.67+00001
80.80+00002
75.60=0.01
78.64400.2
74.93+00.08
bidii
k-3
Annidi
67.41=00006
81.79+1.01
69.50=t0.05
81.68+0.02
72.62+00001
81.60=0.01
72.74+0.03
81.59+0002
k2
78.65:+0.01
76.09.00.03
79.70:10.00
76.10
82.05:10.02
7..76=0.01
81.26:10.00
75.94
67.75=0.03
82.6610.01
69.7110.04
82.6340.02
74.37+0.02
82.87=0.01
82.11 76.54
biddi
7..30=00004
77.26+0.001
78.25+0003
77.44+0.02
79.92+0.02
77.37=0.00
83.05++0.01
77.89+0.04
Kunidi 64.81
02.0
66.55+0.011
02.06-10.00
71.17:0.01
82.78=0.01
73.53
83.12
Table Transfer Performance of Models across Different Values(Amazon Amazon-Ratnggs)) Rows indicate the value used during training, Columns represent the k value utilized during testing. The best performance for each ls value transfer is highlighted in gray. with the overall performance bolded.
k=3
k=2
k=1
bidi
unidi
bidi
unidi
bidi
unidi
bidi
unidi
43.79:10.43
35.9910.51
42.26:10.11
35.19=0.11
38.8110.116
32.81=0.21
30.08:1..07
28.98=0.07
kg
11.27:10.16
45.19:1..0
44.36:10.08
44.9511.08
45.43:10.19
44.59=0.18
44.47:10.07
42.97:10336
45.28=10.11
39.31=00.3
45.63+0008
38.4621.477
43.56110.02
35.24=0.52
35.55
29.10::0.20
3.3
43.20=E0.15
0..66.10.11
44.64+10.9
4..46
45.30+0.001
45.11=0.16
44.78+00.2
42.83+10.09
yyiidi
k2
44.11:0.10
44.40.10.04
45.09
44.24
45.1811.20
43.66-0.04
42.78
41.42:10.16
2-2
40.45:1.116
44.3340.12
41.2440.03
44.40=1.20
42.8411.28
44.67=0.05
43.46.:0110
43.01
Kiidi
32.02.10.09
42.30
37.6640.11
44.6311.00
40.68110.3
45.14=0.00
46.1030.03
45.30100.4
kynidi
41.73=+0.15
42.96:+0.09
42.63+0.110
44.33+0.17
43.08
44.76=0.02
46.27740.8
45.95=00.66
28


Reviews:
[{"review_id": "biSelGXVdh", "reviewer": "Reviewer_aPph", "summary": "This paper does an empirical investigation of attention patterns when an LLM is applied to graph problems.  They find that their treatment of graphs in LLMs is not very sensitive to graph connectivity information.  Some improvement is gained with attention masking.", "questions": "", "limitations": "", "rating": 1, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for your valuable feedback. However, there seems to be some misunderstanding regarding our study's objectives. The content you claimed is missing is mentioned in the appendices. Below are our responses to clarify the points raised. \n\n>What does \"node sampling configured as 8x8\" mean?\n\nNode sampling is a common technique in graph machine learning used for efficient model training. To avoid high computational costs associated with training on an entire graph, node sampling selects a subset of nodes and their neighbors for training. Specifically, we sample 8 neighbors for a central node (forming first-order nodes) and then sample 8 more nodes for each of these first-order nodes (forming second-order nodes). This results in a total of 1 (central node) + 8 (first-order nodes) + 64 (second-order nodes). For LLMs processing graph data, an 8x8 **sampling configuration is widely considered reasonable** [1][2].\n\n>This paper makes very general claims based on very specific experiments. It only considers one approach to inputting graphs into LLMs and then claims that LLMs don't understand graphs well.\n\nThe method we chose for **input (Appendix J Prompt) is based on LLaMA (ICML) [1] and InstructGLM (EACL) [2]**, which are recognized by the research community as straightforward approaches that can better evaluate an LLM's ability to understand each node in graph-structured inputs. This method has **unique positional properties**: it does not alter the LLM’s understanding due to different embedding methods, **offers graph structural position certainty** (the graph position of a node can determine its prompt position, and vice versa), and can **pass the WL-test**. Additionally, we **arrived at general conclusions after conducting extensive experiments**, including perturbation tests, shuffling experiments, attention window analyses, and various visualization studies, which align with common research paradigms. Meanwhile, we have added experimental comparisons of different input methods under the first response to **Reviewer pYJ8**.\n\n>The paper reads as if the authors forgot to include a section on the model. Even after looking at the Appendix, I couldn't figure out how they input the graph connectivity to the LLM.\n\nIn lines 267-269, we reference LLaMA [1] and InstructGLM [2], foundational works in the LLM4Graph field that have **gained broad acceptance**. Detailed Prompt templates are provided in **Appendix J**, which is referenced in the \"Other work in Appendix\" section of the main text.\n\n>Many citations do not appear to be reviewed publications; almost all are from the past two years.\n\nLLM4Graph is a rapidly evolving field where many impactful papers first appear on Arxiv. All 10 Arxiv references we cited have been accepted to conferences such as **ICML, NIPS, and KDD**, awaiting publication. Only 2 papers remain under review. Given that LLMs were introduced to the GNN community around early 2023, most citations are recent.\n\n>There is substantial literature on processing graphs with transformer architectures (\"graph transformers\"), which the authors seem unaware of.\n\nIt may be noted that we discuss the application of transformer architectures (not just LLMs) to graph data in Appendix C, referenced in the \"Other work in Appendix\" section of the main text.\n\n>Given the results, I conclude that this way of inputting graph connectivity simply doesn't work very well.\n\nWe agree that simply input methods may not yield optimal performance, but our aim was to straightforwardly analyze underlying issues rather than achieve sota results. Our chosen method serves as a recognized baseline for further research.\n\n>I don't see any U-shaped curves in Figure 3.\n\nAs explained in our paper, \"attention towards node tokens exhibits a U-shaped distribution or slash trend.\" Lower attention scores for initial nodes are attributed to their position towards the end of the text, resulting in less pronounced U-shapes or trends leaning towards slashes, a common observation also noted in similar studies [3]. We maintained this representation without adjustments, as detailed in our text.\n\n\n[1] Chen R, Zhao T, JAISWAL A K, et al. LLaGA: Large Language and Graph Assistant[C]//Forty-first International Conference on Machine Learning.\n[2] Ye R, Zhang C, Wang R, et al. Language is All a Graph Needs[C]//18th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2024-Findings of EACL 2024. Association for Computational Linguistics (ACL), 2024: 1955-1973.\n[3] Hsieh C Y, Chuang Y S, Li C L, et al. Found in the middle: Calibrating Positional Attention Bias Improves Long Context Utilization[C]//Findings of the Association for Computational Linguistics ACL 2024. 2024: 14982-14995.", "claims_and_evidence": "One fundamental problem with this paper is that they make very general claims based on very specific experiments.  For example, they only consider one approach to inputting graphs to LLMs, and then claim that LLMs don't understand graphs very well.  Given the lack of detail about how they input graphs to the LLM, it is hard to even know what the narrower claim should be.", "methods_and_evaluation_criteria": "The methods are various ways to characterize the attention maps, which don't seem inappropriate in and of themselves.", "theoretical_claims": "NA", "experimental_designs_or_analyses": "I will put my main weakness in this box, since it relates to the setup of the experiments.\n\nThe paper reads as if the authors simply forgot to include a section on the model.  Even after looking at the Appendix, when I started reading the analysis (Section 3A) I couldn't figure out how they input the graph connectivity to the LLM.  Without an understanding of the model they are evaluating, it is impossible to understand the relevance of the results.\nIn the middle of the analysis (Section 3B), Figure 4 seems to give some hint about how this is done.  Given the results, I conclude that this way of inputting the graph connectivity simply doesn't work very well.  Given what we already know about how transformers process information, this is not surprising.", "relation_to_broader_scientific_literature": "There is a substantial literature of how to process graphs with a transformer architecture (\"graph transformers\", or \"graph-to-graph transformers\"), which the authors seem to be unaware of.  That work shows that transformers process graph relations using their attention functions, so graph connectivity can be input through their attention weight calculations.\n\nThis probably explains why they get better results with graph-based masked attention instead of full connectivity.  Masking attention weights is a method to input graph connectivity, which compensates for the inadequate method which they use otherwise.", "essential_references_not_discussed": "All the work on processing graphs in transformers.", "other_strengths_and_weaknesses": "The main weaknesses have been discussed above, even if they are more general than the headings for those boxes.  \nEssentially, I don't feel I learned much from the analysis given in this paper because it does not sufficiently specify the model being analysed.\n\nThe literature review is not very scholarly.  Some citations are missing years.  Many don't appear to be reviewed publications.  Almost all are from the past 2 years.", "other_comments_or_suggestions": "I don't see any U-shaped curves in Figure 3.", "questions_for_authors": "What does \"node sampling configured as 8x8\" mean?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "c58yMcPfyA", "reviewer": "Reviewer_tVm1", "summary": "The paper empirically studies the behavior of the attention mechanism on graph inputs. First, they show that the attention distribution changes after finetuning, therefore concluding that LLMs can recognize graphs. Second, they show that altering the connectivity does not affect significantly the performance, showcasing that LLMs tend to not utilize the connectivity. Third, they uncovers that the attention does not match the graph structure. Finally, they introduce the concept of global linkage horizon, which indicates the visibility range of node tokens under the attention window, and study the impact of different values.\n\n\n\n\n## update after rebuttal\n\nIncreased my score to weak accept after rebuttal, since the authors experimented with different prompts as asked.", "questions": "", "limitations": "", "rating": 3, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> Please discuss the prompts used and their impact on your findings. I see that Appendix J presents the prompt, but does not analyze the impact of changing it, especially because the assistant part can be significantly modified.\n\nThank you for your suggestions regarding the experimental section of our paper. We **designed various Prompt formats for analysis and discussion, inspired by the recommended paper (TALK LIKE A GRAPH)**, and supplemented these into our experiments.\n\n(1) Our standard prompt (Appendix J Prompt)\n(2) Adjacency. Using integer node encoding and parenthesis edge encoding.\n(3) Expert. Employing alphabet letters for node encoding and arrows as edge encoding. The encoding starts with “You are a graph analyst”\n(4) Incident. Using integer node encoding and incident edge encoding.\n\nWe conducted analyses for Table 2 (disruption experiment) and Figure 3 (attention distribution) from the paper.\n\nThe results of the disruption experiment (Table 2) are as follows. From the results, it can be seen that although different templates have varying model performances, **the overall trend is consistent**, showing utilization of link information specifically on the Roman dataset, while link information did not play a role on most other datasets. (PS: Our initial template (1) remains the best performing and makes the best use of link information.)\n\n\n\n| Dataset       | Raw        | (I)        | (II)       | (III)      | (IV)       |\n|---------------|------------|------------|------------|------------|------------|\n**(1)**\n| Wikics        | 0.7862 ± 0.007 | 0.7847 ± 0.004 | 0.7907 ± 0.0035| 0.7670 ± 0.003 | 0.7087 ± 0.005|\n| Pubmed        | 0.8367 ± 0.003 | 0.8363 ± 0.001 | 0.8364 ± 0.002 | 0.7698 ± 0.003 | 0.7835 ± 0.001|\n| Amazon-Ratings| 0.4486 ± 0.002 | 0.3980 ± 0.003 | 0.3977 ± 0.002 | 0.3915 ± 0.003 | 0.3813 ± 0.001|\n| Roman-Empire  | 0.8089 ± 0.001 | 0.7918 ± 0.001 | 0.7910 ± 0.002 | 0.6290 ± 0.002 | 0.5784 ± 0.002|\n**(2)**\n| Wikics        | 0.7795 ± 0.006 | 0.7789 ± 0.005 | 0.7778 ± 0.003 | 0.7512 ± 0.004 | 0.6871 ± 0.006|\n| Pubmed        | 0.8112 ± 0.004 | 0.8108 ± 0.002 | 0.8050 ± 0.001 | 0.7745 ± 0.002 | 0.7783 ± 0.002|\n| Amazon-Ratings| 0.4231 ± 0.003 | 0.4038 ± 0.002 | 0.3923 ± 0.003 | 0.3869 ± 0.002 | 0.3768 ± 0.002|\n| Roman-Empire  | 0.7932 ± 0.002 | 0.7961 ± 0.002 | 0.7935 ± 0.001 | 0.7228 ± 0.003 | 0.6130 ± 0.001|\n**(3)**\n| Wikics        | 0.7806 ± 0.007 | 0.7793 ± 0.004 | 0.7851 ± 0.0035| 0.7618 ± 0.003 | 0.7025 ± 0.005|\n| Pubmed        | 0.8315 ± 0.003 | 0.8310 ± 0.001 | 0.8312 ± 0.002 | 0.7643 ± 0.003 | 0.7781 ± 0.001|\n| Amazon-Ratings| 0.4438 ± 0.002 | 0.3932 ± 0.003 | 0.3929 ± 0.002 | 0.3867 ± 0.003 | 0.3765 ± 0.001|\n| Roman-Empire  | 0.8030 ± 0.001 | 0.7864 ± 0.001 | 0.7856 ± 0.002 | 0.6234 ± 0.002 | 0.5728 ± 0.002|\n**(4)**\n| Wikics        | 0.7811 ± 0.006 | 0.7833 ± 0.005 | 0.7812 ± 0.0030| 0.7665 ± 0.004 | 0.7092 ± 0.006|\n| Pubmed        | 0.8325 ± 0.004 | 0.8322 ± 0.002 | 0.8317 ± 0.001 | 0.7897 ± 0.002 | 0.7064 ± 0.002|\n| Amazon-Ratings| 0.4379 ± 0.003 | 0.4085 ± 0.002 | 0.4072 ± 0.003 | 0.3978 ± 0.002 | 0.3885 ± 0.002|\n| Roman-Empire  | 0.8091 ± 0.002 | 0.7915 ± 0.002 | 0.7913 ± 0.001 | 0.6285 ± 0.003 | 0.5788 ± 0.001|\n\n\nThe visualization for attention distribution (Figure 3) has been placed in an anonymous link \n[anonymous link](https://anonymous.4open.science/LLMexploration-B21F)\n\n**Additionally, it should be noted** that the input method we selected (Appendix J Prompt) was inspired by LLaGa (ICML), InstructGLM (EACL). **This is a recognized direct method within the research community to better assess the LLM's understanding of every node in the graph structure input.** It possesses **uniqueness in positional certainty**: it will not cause changes in LLM understanding due to different embedding methods; **graph structure position determinability**: the graph location of nodes can be determined through prompts, and **passes the WL-test**.\n\n\n> The clarify of the paper can be significantly improved. For instance, what first-order and second-order nodes are is never introduced. From the context, sometimes it refers to first-order and second-order neighbors, while other times it is unclear.\n\nThank you for your revision suggestions. We have corrected the clarity throughout the paper and s**tandardized the naming of first-order nodes**.\n\n\n> Please change the running title in the submission, as it currently is Submission and Formatting Instructions for ICML 2025.\n\nThank you for your advice. We have revised this accordingly.\n\n\n> I think you should replace training with finetuning in Q1, as if I understand correctly you are not training the LLM from scratch.\n\nWe have revised the expressions throughout the paper to more accurately reflect fine-tuning, thanks for your suggestion.", "claims_and_evidence": "The claims are supported by evidence.", "methods_and_evaluation_criteria": "The proposed evaluations make sense. However, in my opinion the paper overlooks the impact of the prompt design, which is responsible of ensuring that graph-structured data can be presented in a way that can be consumed by LLMs, and that has been shown to have significant impact on the performance [1].\n\n\n[1] Fatemi et al., 2023 Talk like a Graph: Encoding Graphs for Large Language Models", "theoretical_claims": "There are no theoretical claims.", "experimental_designs_or_analyses": "The experimental designs are valid.", "relation_to_broader_scientific_literature": "Studying the behavior of LLMs on graph data is an interesting topic, which has been recently studied in numerous works. However, I think the findings should be conditioned on the particular prompt used.", "essential_references_not_discussed": "None", "other_strengths_and_weaknesses": "The clarify of the paper can be significantly improved. For instance, what first-order and second-order nodes are is never introduced. From the context, sometimes it refers to first-order and second-order neighbors, while other times it is unclear.", "other_comments_or_suggestions": "1. Please change the running title in the submission, as it currently is Submission and Formatting Instructions for ICML 2025.\n2. I think you should replace training with finetuning in Q1, as if I understand correctly you are not training the LLM from scratch.\n3. Aattention -> Attention in the captions of Figures 7 to 12.", "questions_for_authors": "Please discuss the prompts used and their impact on your findings. I see that Appendix J presents the prompt, but does not analyze the impact of changing it, especially because the assistant part can be significantly modified.", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "jDIeVE8uzF", "reviewer": "Reviewer_pYJ8", "summary": "This article explores the attention mechanisms of Large Language Models (LLMs) when processing graph-structured data. It first observes that while LLMs are aware of graph-structured data, they fail to properly utilize link information. The analysis and explanation focus on two broad aspects: attention distribution and attention window. Several instructive conclusions or phenomena were found or concluded, such as LLMs' ability to capture relationships between nodes and text but lacking the capability to model relationships between nodes, like the unique Attention sink phenomenon in graph structures.\n\n## update after rebuttal\nThe authors have addressed my concerns.", "questions": "", "limitations": "", "rating": 5, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": ">In some of the experimental demonstrations (Figure 1,2,3,5), three datasetswere selected and showed different forms of performance. Could you comprehensively explain how these different datasets performed across multiple experiments?\n\nWe are happy to address your question. In our experimental demonstrations, the LLM exhibited strong performance on the Roman-Empire dataset (Table 2 - overcoming confounding factors, Figure 2 - enhancing attention scores for structural information). Additionally, in other visualization analyses, it demonstrated an understanding of graph structures. However, on other datasets (Pubmed, Wikics), the model showed disordered and difficult-to-understand behavior.\n\n> The article repeatedly mentions attention scores between different tokens. Can you elaborate on how these scores are specifically calculated? Are they calculated as normal attention layer scores? Are there any special cases?\n\nAs mentioned in our previous response, we selected datasets that the LLM could handle well (Roman-Empire) and those it struggled with (Pubmed, Wikics). The goal was to identify differences between the two and explore how the LLM successfully understood graph structures.\n\n\n> The appendix shows charts of attention scores for first-order nodes and their child nodes at different layers (Layer 1 and Layer 3). In deeper network layers, would this pattern of attention scores differ?\n\nIndeed, during our experiments, we observed that the unique behaviors of deeper attention networks became more pronounced compared to shallower ones, such as the \"attention sink\" and \"Skewed Line Sink.\"\n\n> Some professional or targeted concepts (\"bimodal trend\", Kolmogorov-Smirnov, etc.) are insufficiently described. It is hoped that explanations can be strengthened.\n\nThank you for pointing this out. Insufficient explanation of certain professional terms and concepts may indeed cause difficulties for readers. Below are more detailed explanations of the mentioned concepts:\n\nBimodal Trend: The appearance of a bimodal trend in the distribution of attention scores might indicate that the model pays particular attention to specific types of nodes or positions, while others form another cluster.\nKolmogorov-Smirnov Test: This is a non-parametric test used to compare whether two samples come from the same distribution. The KS test is most commonly used to determine whether two sets of observations are significantly different or whether one set of observations differs significantly from a theoretical distribution.\n\nIn addition, we have further revised Attention Window and JS.\n\n> Although the authors have open-sourced the experiment code, reproducing the experiments still requires some hyperparameter settings. Detailed hyperparameter settings for each experiment are hoped to be provided by the authors.\n\nThank you for your thorough consideration. Due to the length constraints of the rebuttal, we have made corrections in the revised version.", "claims_and_evidence": "Yes.", "methods_and_evaluation_criteria": "YES, A variety of datasets, including heterogeneous, heterophilic, and text graphs, were selected for the experimental analysis, employing multiple evaluation criteria.", "theoretical_claims": "Yes, I have checked the data metrics in Table 1, Table 2, and Table 3 of the article, and they are consistent with the hypotheses and claims proposed at the beginning of the paper.", "experimental_designs_or_analyses": "Yes, I have reviewed multiple experiments and figures. For instance, the method presented in Table 4, which involves training with a narrow field of view and testing with a wide field of view.", "relation_to_broader_scientific_literature": "In the research of LLM attention mechanisms, the author has identified a phenomenon termed \"Skewed Line Sink\" within graph datasets, which hinders the attention mechanism's ability to focus on nodes effectively.\nIn the context of graph machine learning research, the author provides insightful analysis and offers multiple methods and metrics for evaluating LLMs designed for graph data.", "essential_references_not_discussed": "None", "other_strengths_and_weaknesses": "Strengths:\nInnovative experimental design; the study assesses the ability of LLMs to correctly utilize graph structure through methods that disrupt connection information at different levels, which is novel and clever, confirming the inadequacy of LLMs in utilizing topological information.\n\nDiscover multiple new phenomena and conclusions , contributing to the graph machine learning community.\n\nThe article explores the effectiveness of LLMs in handling graph data under different global visibility perspectives, and proposes a method of training under an intermediate state attention window before transferring to testing under a normal causal mask window. This approach balances the efficiency of the model and the feasibility of practical deployment.\n\nVarious statistical hypothesis methods (t-test, KS test, JS divergence) are used to evaluate changes in attention scores, making experiments rigorous and credible.\n\nWeaknesses:\nIncomplete description of hyperparameter settings. Although the authors have open-sourced the experiment code, reproducing the experiments still requires some hyperparameter settings. Detailed hyperparameter settings for each experiment are hoped to be provided by the authors.\n\nSome professional or targeted concepts (\"bimodal trend\", Kolmogorov-Smirnov, etc.) are insufficiently described, which may lead to difficulties in understanding for readers. It is hoped that explanations can be strengthened.", "other_comments_or_suggestions": "It is hoped that the author will make revisions and improvements based on the weaknesses and questions raised.", "questions_for_authors": "In some of the experimental demonstrations (Figure 1, Figure 2, Figure 3, Figure 5), three datasets (roman-empire, amazon-ratings, wikics) were selected and showed different forms of performance. Could you comprehensively explain how these different datasets performed across multiple experiments?\n\nSimilar to the previous question, why were these specific datasets chosen? Were other types of datasets also tested but not shown in the paper?\n\nThe article repeatedly mentions attention scores between different tokens. Can you elaborate on how these scores are specifically calculated? Are they calculated as normal attention layer scores? Are there any special cases?\n\nThe appendix shows charts of attention scores for first-order nodes and their child nodes at different layers (Layer 1 and Layer 3). In deeper network layers, would this pattern of attention scores differ?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "2zq4tiMMBv", "reviewer": "Reviewer_yYED", "summary": "As an experimental analysis work, the article examines the limitations of LLMs in processing graph-structured data from the perspective of attention mechanisms. The experimental design is relatively comprehensive, covering changes in attention distribution, structural information interference, comparisons of different attention windows, etc., providing new insights into the application of LLMs in graph learning.\n\n## update after rebuttal\n\nThe authors have addressd my all concerns and I have reviewed the comments from the other three reviewers. So, I keep my positive score.", "questions": "", "limitations": "", "rating": 4, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": ">the bimodal trend mentioned in the text focuses on mean differences with t-tests while KS tests emphasize differences between overall distributions (\"Given that the KS test focuses on the overall distribution and the t-test emphasizes the mean value:\"). It would be better if relevant materials were provided as evidence.\n\nThank you for your suggestion. In paper [1], the KS test is compared with the Anderson-Darling test (both are distribution-based tests), pointing out that the KS test is sensitive to global differences in distributions, whereas the t-test focuses only on mean-based hypotheses.\n\n[1] Chakraborti, S., & Lim, J. (2010). Comparing Distributions: The Two-Sample Anderson-Darling Test vs. the Kolmogorov-Smirnov Test. Journal of Applied Statistics, 37(1), 53–65.\n\n>In the Attention Window section of the paper, the authors mention training with k≠4 and then transferring to an attention window where k=4. When training with k≠4, will it introduce additional computational time consumption? \n\nThank you for your consideration. In our model's operation, we only modified the computation of the **attention_mask** by adding some masking (similar to causal masking). This has a negligible impact on the model's training speed.\n\n\n\n\n\n>The author designed a link information perturbation experiment (which is very interesting)， where the setup was based on gradually disrupting normal links. I wonder if there could be or if it's possible to add settings that enhance the link information?\n\nFirst, your suggestion and idea are both highly feasible and significant. We have added an enhancement mode (V) to the perturbation experiment. Mode (V) uses a pre-trained GNN model to perform initial node filtering.\n\nThe specific results are as follows:\n\n\n| Dataset       | Raw        | (I)        | (II)       | (III)      | (IV)       | (V)        |\n|---------------|------------|------------|------------|------------|------------|------------|\n| Wikics        | 0.7862 ± 0.007 | 0.7847 ± 0.004 | 0.7907 ± 0.0035| 0.7670 ± 0.003 | 0.7087 ± 0.005| 0.7897 ± 0.004     |\n| Pubmed        | 0.8367 ± 0.003 | 0.8363 ± 0.001 | 0.8364 ± 0.002 | 0.7698 ± 0.003 | 0.7835 ± 0.001| 0.8347 ± 0.002     |\n| Amazon-Ratings| 0.4486 ± 0.002 | 0.3980 ± 0.003 | 0.3977 ± 0.002 | 0.3915 ± 0.003 | 0.3813 ± 0.001| 0.4744 ± 0.004 |\n| Roman-Empire  | 0.8089 ± 0.001 | 0.7918 ± 0.001 | 0.7910 ± 0.002 | 0.6290 ± 0.002 | 0.5784 ± 0.002| 0.8177 ± 0.001     |\n\n\nThe experimental setup for (V) may require further consideration, and we will conduct more repeated experiments and validations in the future. Thank you for your valuable suggestions regarding the perturbation experiment.\n\n\n>Descriptions of the specific methods for calculating attention scores and conducting perturbation operations are not detailed enough. \n\nThank you for considering the reproducibility of the experiments. We will provide preliminary explanations here.\n\nCalculating attention scores: In our padding operation, we chose to discard the calculation of attention scores for pad tokens because this does not contribute to node attention calculations. Additionally, to avoid potential interference, we directly masked these tokens in the attention_mask.\n\nconducting perturbation operations：(II) Exchanging random numbers of child nodes between first-order nodes and further disrupting the information structure: Unlike (I), this operation involves transferring a random subset of child nodes between first-order nodes. Additionally, it introduces further disruptions to the overall structure. \n\n(III) Randomly shuffling the positions of first-order and second-order nodes, even allowing original second-order nodes to become first-order nodes: This operation randomizes the hierarchy and positions of nodes, potentially altering their roles (e.g., promoting second-order nodes to first-order status).", "claims_and_evidence": "The claims made in the submission can be supported by clear and convincing experiments, which provide different levels of validation on the proposed method.", "methods_and_evaluation_criteria": "The proposed methods and/or evaluation criteria make sense for the analysis of LLM attention on graph-structured data.", "theoretical_claims": "There are no theoretical claims included in the paper.", "experimental_designs_or_analyses": "I have checked the soundness/validity of experimental designs or analyses in the submission. Many experiments on benchmark datasets show the effectiveness and superiority of the proposed method.", "relation_to_broader_scientific_literature": "The key contributions are: the authors analysis of LLM attention on graph-structured data. To my knowledge, this is the first empirical study to investigate LLMs for graph machine learning from the perspective of attention.", "essential_references_not_discussed": "Essential References are discussed in the paper.", "other_strengths_and_weaknesses": "Strength:\n(1) The starting point of the problem is quite novel, focusing on the attention interaction of LLMs under graph structures, which is a particularly interesting aspect.\n(2)Compared with existing works on LLM for Graph, most of which propose new architectures or methods, this article reveals and discovers interesting phenomena of the attention mechanism in graph-structured data through experimental analysis, offering better guiding value for future work.\n(3) Detailed visualizations, including attention score interaction matrices and other charts, provide strong visual support.\n(4)Discovery of important phenomena and issues: The article identifies \"Attention Sink\" and unique \"Skewed Line Sink\" phenomena of the LLM's attention mechanism under graph structures, potentially uncovering new research directions for LLM for Graph.\n\nWeakness:\n(1)Descriptions of the specific methods for calculating attention scores and conducting perturbation operations are not detailed enough. Providing more details or pseudocode would help readers understand the processes better.\n(2)Lack of relevant citations or materials to prove certain points; for instance, the bimodal trend mentioned in the text focuses on mean differences with t-tests while KS tests emphasize differences between overall distributions (\"Given that the KS test focuses on the overall distribution and the t-test emphasizes the mean value:\"). It would be better if relevant materials were provided as evidence.", "other_comments_or_suggestions": "I have not any other comments or suggestions here. I have given all my comments in the “Other Strengths And Weaknesses”.", "questions_for_authors": "(1)In the Attention Window section of the paper, the authors mention training with k not equal to 4 and then transferring to an attention window where k=4. When training with k≠4, will it introduce additional computational time consumption?\n(2)The author designed a link information perturbation experiment (which is very interesting)， where the setup was based on gradually disrupting normal links. I wonder if there could be or if it's possible to add settings that enhance the link information?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Meta-review: This paper empirically studies how LLMs process graph-structured data from the perspective of attention mechanisms.
Almost all reviewers believe that this is a good paper, so I recommend acceptance. I also recognize that there is a growing community, originating from the GNN field, that is interested in how LLMs perform on relational data.

That said, I agree with reviewer aPph that there are general claims being made in the paper, while only a particular way of encoding relational data as input is explored in the submitted version. If the paper is accepted, I would strongly recommend that the authors clearly state their input setting and remove the generic claims about failure, which are also present in the abstract.
Decision: Accept (poster)