Abstract
Traditional graph learning relies heavily on Graph Neural Networks (GNNs), which often struggle with generalization and high label dependency. This paper introduces GraphICL (Graph In-Context Learning), a training-free framework that leverages the reasoning capabilities of general-purpose Large Language Models (LLMs) like LLaMA-3 and GPT-4. By translating graph structures into structured, text-based prompts, GraphICL enables LLMs to outperform specialized graph models and GNNs in low-label and cross-domain scenarios.
Introduction
Graph learning has been dominated by GNNs, which excel at structural pattern recognition but face significant hurdles: poor generalization across domains and a heavy reliance on labeled data. While recent "Graph LLMs" attempt to bridge this gap by fine-tuning models with specialized encoders, GraphICL explores the untapped potential of pure prompt engineering. The authors argue that previous underperformance of general LLMs on graph tasks stemmed from simplistic prompts that failed to represent complex topological relationships.
Methodology: The GraphICL Framework
GraphICL transforms graph data into a format digestible by LLMs through four modular components:
- Task Description: Defines the objective (e.g., node classification) and label space.
- Anchor Node Text: Provides the primary textual content of the target node.
- Structure-Aware Information: Incorporates textual descriptions of 1-hop or 2-hop neighbors, effectively simulating "message passing" at the textual level.
- Labeled Demonstrations: Includes few-shot examples of nodes and their corresponding labels.
The framework also evaluates various selection strategies for neighbors and examples, including random selection, textual similarity-based selection, and structural importance (PageRank). The study evaluates these methods across nine diverse Text-Attributed Graph (TAG) datasets, ranging from citation networks (PubMed, Cora) to Amazon product reviews.
Experimental Results
The experimental results demonstrate that GraphICL-prompted LLMs significantly outperform both traditional GNNs and specialized Graph LLMs.
Key Findings
- Superior Performance: GraphICL-prompted LLaMA-3-70B achieved state-of-the-art results, such as 87.37% accuracy on the Computers dataset and 93.18% on PubMed.
- Semantic over Structural Context: Selecting neighbors based on textual similarity consistently outperformed structural methods like PageRank, suggesting that LLMs prioritize semantic context over pure topology.
- Robustness in Low-Label Settings: In semi-supervised environments, GraphICL showed an average relative improvement of 20% over traditional GNNs like GCN and GraphSAGE.
- Structure-Awareness: The inclusion of neighbor information can boost accuracy by over 100% in specific datasets like Arxiv, confirming that LLMs can interpret graph topology when presented textually.
- Link Prediction: On the Cora dataset, GraphICL reached 88.08% accuracy, significantly higher than supervised GNNs (81.59%).
Discussion and Conclusion
GraphICL proves that general-purpose LLMs, when provided with structured, structure-aware prompts, can serve as powerful, training-free graph learners. While the framework excels in node classification and link prediction for TAGs, future work is needed to address non-textual graphs (e.g., molecular structures) and the computational costs associated with large-scale inference. Additionally, the physical constraints of LLM context windows necessitate more sophisticated retrieval-augmented strategies for selecting informative sub-structures.
Summary updated