GRAIL: Graph Retrieval-Augmented In-Context Learning for Node Classification in Real-World Textual-Attributed Graphs

Chanuk Lim, Kyong-Ha Lee, Hyun Ji Jeong, Sungsu LimEDBT 2025 · OpenReview

Introduction

Classifying documents such as patents and academic papers is a complex task because these entities exist within Textual-Attributed Graphs (TAGs)—networks where nodes possess rich textual content and intricate relational links. Traditional Graph Neural Networks (GNNs) often encounter a "Label Cardinality" wall when dealing with multi-label, hierarchical classification systems like the International Patent Classification (IPC), which contains hundreds of fine-grained, semantically similar categories. Furthermore, existing scientific graphs are frequently siloed, focusing on a single type of entity (e.g., only papers).

To address these challenges, the authors introduced GRAIL (Graph Retrieval-Augmented In-context Learning), a framework that synergizes the structural processing capabilities of GNNs with the semantic reasoning of Large Language Models (LLMs).

The GRAIL Framework

The GRAIL framework operates in two distinct phases to leverage both graph topology and textual semantics.

Phase 1: Structural Embedding

In the first phase, a GNN (such as Heterogeneous Graph Transformer or GraphSAGE) is trained on a unified graph to learn robust node representations. These structural embeddings, along with the corresponding node text (titles and abstracts) and labels, are indexed in a vector database (e.g., Chroma).

Phase 2: Graph Retrieval-Augmented In-Context Learning

When a target node requires classification, the system utilizes the pre-trained GNN to retrieve the "top-k" most similar nodes from the vector space based on structural and semantic proximity. The metadata and labels of these retrieved neighbors are formatted into a prompt for an LLM (e.g., GPT-4o). The LLM then performs in-context learning, using these examples as a "cheat sheet" to infer the correct labels for the target node.

The two-phase GRAIL framework: Phase 1 involves structural embedding and vector storage, while Phase 2 utilizes graph retrieval for LLM in-context learning.

The K-GIST Dataset

The study introduces K-GIST (KISTI Graph for the Integrated Scientific and Technological Domain), a massive heterogeneous graph curated by the Korea Institute of Science and Technology Information. K-GIST unifies over 360,000 papers, 102,000 patents, 21,000 reports, and 70,000 researchers. It captures complex relationships such as "Project-produces-Paper" and "Author-affiliated-with-Organization," providing a holistic view of the R&D landscape.

Experimental Results

GRAIL was benchmarked against standard GNN baselines (GCN, GAT) and heterogeneous models (HAN, HGT). The results demonstrate a significant performance leap.

Performance comparison of GRAIL against baselines, showing Micro-F1 and Macro-F1 scores across varying test sizes.

Key findings include:

  • Significant Improvement: GRAIL (using top-3 neighbors) achieved an average F1-score of 0.698, a 0.311 absolute improvement over the best traditional GNN (HGT at 0.387).
  • Structural Context: GRAIL outperformed text-only models (like Sentence-BERT), confirming that graph structure retrieved via GNN provides critical information that text alone lacks.
  • Efficiency: Retrieving the top-3 neighbors was found to be the optimal balance between performance and computational cost. Increasing to top-10 offered only marginal gains (~0.02).
  • Fine-Grained Accuracy: The advantage of GRAIL was most evident in second-level hierarchical categories where semantic nuance is paramount.

Conclusion and Future Work

GRAIL demonstrates that combining GNNs as specialized retrievers with LLMs as high-reasoning classifiers effectively overcomes the limitations of traditional node classification in complex TAGs. Currently integrated into the ScienceON public service, the system assists researchers in navigating scientific data. Future research will focus on addressing label sparsity and reducing the computational overhead of LLM inference through model distillation.

Summary updated

BibTeX
@inproceedings{lim2025grail,
  author = {Chanuk Lim and Kyong-Ha Lee and Hyun Ji Jeong and Sungsu Lim},
  title = {{GRAIL: Graph Retrieval-Augmented In-Context Learning for Node Classification in Real-World Textual-Attributed Graphs}},
  booktitle = {EDBT},
  year = {2025},
  url = {https://openreview.net/forum?id=lxXXv2gFq6},
}
Figure