Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language processing, yet their performance on graph-structured data remains inconsistent compared to specialized Graph Neural Networks (GNNs). While GNNs utilize explicit message passing over physical links, LLMs rely on global self-attention, potentially treating every node as equally connected. This research investigates how LLMs internally process graph topology, identifying inherent structural biases such as "Attention Sinks" and a novel "Skewed Line Sink." Furthermore, the study explores how restricting the "linkage horizon" during training can enhance model generalization.
Methodology
The authors conducted an empirical study using several analytical techniques across four diverse datasets: Roman-Empire (textual dependencies), Amazon-Ratings (product co-purchases), WikiCS (Wikipedia citations), and Pubmed (medical citations).
Key methodologies included:
- Attention Distribution Analysis: Utilizing statistical tests like the Kolmogorov-Smirnov (KS) test to quantify shifts in attention scores post-finetuning.
- Structure Information Disruption: Evaluating model robustness by systematically shuffling graph components to see if the model truly relies on the graph's shape.
- Global Linkage Horizon (GLH): Introducing a parameter $k$ to control node visibility, simulating local connectivity (GNN-like) versus global connectivity (standard LLM).
- Heatmap Visualization: Identifying spatial attention patterns through interaction matrices to pinpoint where the model "looks."
Key Insights: Positional Bias and Structural Sinks
A primary finding is the "Skewed Line Sink," a diagonal pattern in the attention matrix where models over-focus on specific paths rather than actual graph adjacency. This is compounded by a persistent positional bias; LLMs often exhibit a U-shaped attention distribution, prioritizing tokens at the beginning and end of a sequence regardless of their topological importance.
The study also reveals a "Small-to-Large" Transfer Paradox: models trained with a restricted view (e.g., 2-hop neighbors) and tested with full connectivity often outperform those trained with full connectivity from the start. This suggests that limited visibility during training forces the model to learn more robust structural features.
Experimental Results
Structural Awareness
On the Roman-Empire dataset, accuracy dropped significantly from ~81% to ~58% when the graph structure was completely disrupted, confirming that the model actively leverages topological information rather than just node features.
Attention Shifts
Statistical analysis via the KS test confirmed that LLMs "learn" to distinguish node tokens from regular text tokens during finetuning. As shown in the density distributions, the attention profiles for node tokens shift significantly after training, indicating a specialized processing mechanism for graph elements.
Conclusion and Future Directions
While LLMs can be adapted for graph tasks, they suffer from sequential biases inherited from their pre-training. The discovery of the "Skewed Line Sink" and the benefits of restricted linkage horizons provide a roadmap for future architectural improvements. Future work will focus on automating the adaptation of the linkage horizon and testing these phenomena on larger models (100B+) and more complex structures like hypergraphs.
Summary updated