Source-linked AI summary
RAGraph: A General Retrieval-Augmented Graph Learning Framework
Xinke Jiang, Rihong Qiu, Yongxin Xu, Wentao Zhang, Yichen Zhu, Ruizhe Zhang, Yuchen Fang, Xu Chu, Junfeng Zhao, Yasha Wang
TL;DR
GNNs still face an underexplored challenge in generalizing across different graph data and tasks. RAGraph builds a toy-graph library and injects retrieved information into pre-trained GNNs through message passing. The paper reports improved performance across graph-learning tasks, including settings without task-specific fine-tuning.
Problem
Generalization across modalities, domains, and tasks remains an underexplored challenge for GNNs, and integrating retrieved features and labels while supporting unseen tasks without tuning remains difficult.
Source: §1 · pp. 1–2Method
Results
RAGraph outperforms state-of-the-art methods across various graph-learning tasks and is reported to perform well without task-specific fine-tuning.
Source: §1 · p. 3, §6 · p. 10Takeaways & Limitations
The framework offers a plug-and-play approach for applying retrieved graph information to pre-trained GNNs on unseen data.
Source: §6 · p. 10Node- and graph-level classification are evaluated in few-shot settings, so the stated scope does not establish performance across other label regimes.
Source: §3 · p. 4
Abstract
from arXiv · showhide
Graph Neural Networks (GNNs) have become essential in interpreting relational data across various domains, yet, they often struggle to generalize to unseen graph data that differs markedly from training instances. In this paper, we introduce a novel framework called General Retrieval-Augmented Graph Learning (RAGraph), which brings external graph data into the general graph foundation model to improve model generalization on unseen scenarios. On the top of our framework is a toy graph vector library that we established, which captures key attributes, such as features and task-specific label information. During inference, the RAGraph adeptly retrieves similar toy graphs based on key similarities in downstream tasks, integrating the retrieved data to enrich the learning context via the message-passing prompting mechanism. Our extensive experimental evaluations demonstrate that RAGraph significantly outperforms state-of-the-art graph learning methods in multiple tasks such as node classification, link prediction, and graph classification across both dynamic and static datasets. Furthermore, extensive testing confirms that RAGraph consistently maintains high performance without the need for task-specific fine-tuning, highlighting its adaptability, robustness, and broad applicability.
1 Introduction
GNN generalization across modalities, domains, and tasks remains underexplored, while graph retrieval raises challenges around integrating retrieved features and labels and supporting unseen tasks without fine-tuning. RAGRAPH addresses these challenges with a toy-graph vector library and message-passing prompts, and is evaluated across graph tasks and datasets.
1 Introduction
- Generalization across graph modalities, domains, and tasks remains largely unexplored despite GNNs’ broad use in relational data.The passage contrasts this open challenge with successes of large models in NLP and CV.Source: §1 · p. 1
- Graph learning needs retrieved context, but integrating external features and labels into GNNs under dynamic scenarios remains a challenge.The passage contrasts structural integration of X and Y with fixed-example input-to-output mapping approaches.Source: §1 · p. 2
- A second challenge is a tune-free prompt mechanism that can plug into pre-trained GNNs across unseen scenarios and multiple tasks.The passage identifies seamless integration with already pre-trained models as an unresolved design challenge.Source: §1 · p. 2
- RAGRAPH integrates retrieved toy-graph knowledge into pre-trained GNNs through a plug-and-play vector library and message-passing prompts.The framework is evaluated across static and dynamic graphs, node-, edge-, and graph-level tasks, and cross-dataset settings.Source: §1 · p. 3
2 Related Work
Prior RAG work spans language and multimodal retrieval, but the cited literature does not significantly apply RAG to structured graphs without text to enhance pre-trained GNNs. Graph prompt learning offers mechanisms for injecting retrieved knowledge into those models.
2.1 Retrieval-Augmented Generation on Large Language Models
- Prior RAG research spans language, visual-text, code, audio, video, and knowledge-graph applications, but the cited work lacks significant use on text-free structured graphs to enhance pre-trained GNNs.The paper positions its work as extending retrieval-augmented approaches to graph data and pre-trained GNNs.Source: §2.1 · p. 3
2.2 Graph Prompt Learning
- Graph prompt methods use mechanisms such as virtual nodes, task-specific readouts, spatial-temporal gates, and task graphs to adapt pre-trained graph models.The paper builds on graph prompting to inject retrieved knowledge into pre-trained GNNs.Source: §2.2 · p. 3
3 Preliminaries
RAGRAPH frames static graphs as a special case of dynamic graphs and represents graph tasks through query graphs and task-specific outputs. Its toy graphs are small, timestamped subgraphs keyed by master-node context and associated with task outputs.
3 Preliminaries
- A dynamic graph is a sequence of static snapshots with nodes, edges, features, edge weights, and task labels; a static graph is the T = 1 case.The framework treats static graphs as a particular instance of dynamic graphs.Source: §3 · p. 4
- Each toy graph is a timestamped k-hop subgraph of a resource graph, centered on a master node and augmented during construction.Keys include timestamp and master-node information; stored values include task-specific output vectors.Source: §3 · p. 4
- The unified task setup predicts labels for held-out nodes, edges, or subgraphs using similarity between task-specific output vectors and labels or class prototypes.Node- and graph-level classification use few-shot class prototypes, while the passage specifies a similarity criterion for link prediction.Source: §3 · p. 4
- Query graphs include a center node and its neighbors within k hops; graph-level tasks use a full-link virtual node as the center.The query graph provides the unit for downstream task prediction.Source: §3 · p. 4
4 RAGRAPH Framework
RAGRAPH builds and retrieves toy graphs, then propagates their hidden embeddings and task-specific outputs to query graphs for downstream prediction. Its framework includes long-tail-oriented sampling, multi-key retrieval, knowledge fusion, and noise-based prompt tuning.
4 RAGRAPH Framework
- RAGRAPH constructs toy-graph resources, retrieves topK matches, propagates their embeddings and task outputs, and fuses the results for node-, edge-, or graph-level tasks.The framework supports training and inference with either noisy trainable prompting or a parameter-free approach.Source: §4 · p. 5, Figure 2 · p. 5
4.3 Training and Inference
- Training and inference use retrieved toy graphs in intra- and inter-propagation views to pass hidden embeddings and task-specific outputs toward the query center.The framework describes both noisy trainable and parameter-free approaches.Source: §4 · p. 5, §4.3 · p. 7
4.1 Toy Graphs Embedding Pipeline
- Inverse-importance sampling prioritizes lower-importance nodes when forming augmented k-hop toy graphs, whose master-node keys and node-level task outputs are stored in a vector library.The importance score combines PageRank and degree centrality; FAISS supports storage and retrieval.Source: §4.1 · p. 6
4.2 Toy Graphs Retrieval Process
- Toy-graph retrieval ranks candidates using a weighted combination of time, structure, environment, and semantic similarities.The topK graphs with the highest composite similarity are selected.Source: §4.2 · p. 6
4.3.1 Knowledge Injection Propagation
- Within each toy graph, pre-trained GNNs aggregate neighbors’ hidden embeddings and task outputs at the master node, then propagate toy-graph information to the query center.For task-specific outputs, the master node’s information alone is passed to the query center.Source: §4.3.1 · p. 7
4.3.2 Knowledge Fusion Layer
- The fusion layer combines the decoder output from the query’s aggregated hidden embeddings with its aggregated task-specific output using a reweighting parameter.The decoder can be used directly for the same task, masked for different tasks, or fine-tuned for task requirements.Source: §4.3.2 · p. 7
4.3.3 Noise-based Graph Prompting Tuning
- Noise-based prompt tuning adds irrelevant nodes within toy graphs and includes bottomK toy graphs during training, but omits noise at inference.The authors state that this training strategy is intended to improve discrimination of relevant from irrelevant information and robustness.Source: §4.3.3 · p. 8
5 Experiments
RAGRAPH is evaluated across static and dynamic graph tasks, with comparisons to established baselines and a study of retrieval hyperparameters. The reported results favor RAGRAPH overall, while showing that retrieval volume must be balanced.
5.1 Experimental Setup
- The evaluation spans three dynamic and five static datasets; it compares RAGRAPH without fine-tuning, with prompt tuning, and with noise prompt tuning against graph-learning baselines.Static-graph evaluation uses node partitioning, while dynamic-graph evaluation partitions snapshots; classification uses accuracy and link prediction uses Recall@20 and nDCG@20.Source: §5 · p. 8, §5.1 · p. 8
5.2 Retrieval-Augmented Graph Results
- RAGRAPH outperforms almost all baselines across three graph tasks, with at least 5.19% improvement on static graphs and up to 11.78‰ on dynamic graphs over PRODIGY/FT.The results cover node and graph classification in Table 1 and link prediction in Table 2.Source: Table 1 · p. 9, §5.2 · p. 9, Table 2 · p. 10
- PRODIGY/NF and RAGRAPH/NF outperform Vanilla/NF on unseen datasets, and RAGRAPH’s gap between no fine-tuning and fine-tuning is smaller than PRODIGY’s.The authors report acceptable RAGRAPH results on unseen downstream datasets without sophisticated fine-tuning.Source: §5.2 · p. 9
5.3 Hyper-parameter Study
- Accuracy initially improves and then declines as toy-graph hop count rises; too few or too many linked toy graphs can also hinder performance.The study attributes these patterns to insufficient context at low retrieval levels and excess, potentially irrelevant information at high levels.Source: Figure 3 · p. 9, §5.3 · p. 10
6 Conclusion
The conclusion presents RAGRAPH as a retrieval-augmented, plug-and-play approach for improving GNN generalization to unseen data. The accompanying discussion describes toy-graph construction, sampling, and fusion choices, and notes that retrieval is currently limited to subgraphs.
6 Conclusion
- RAGRAPH retrieves relevant information to improve GNN generalization to unseen data and outperforms state-of-the-art methods across varied graph-learning tasks.The authors describe it as adaptable and robust, while noting that it currently retrieves subgraphs and could be extended to nodes, edges, and trees.Source: §6 · p. 10
A Notations
- The notation table defines G, V, and E as the dynamic graph, node set, and edge set, with time-indexed forms for their entries.Source: Table 3 · p. 19
B.1 Why Toy Graph Augmentation is needed
- Toy-graph augmentation expands the knowledge repository, simulates missing nodes, noisy attributes, and unexplored edges, and uses Mixup to address graph-domain shift.The listed augmentations include node dropout, noise injection, edge removal, node interpolation, and edge rewiring.Source: §B.1 · p. 19
B.2 Why Noise-based Graph Prompt Tuning is needed
- Noise-based graph prompt tuning trains with artificially noisy toy graphs, improving robustness to retrieval noise and reducing dependence on an exceptionally high-quality graph vector base.The authors report better performance than traditional tuning methods in the main-text tables.Source: §B.2 · p. 20
B.3 Difficulty to construct and maintain high-quality and diverse graph vector base
- The toy-graph base draws substantially on prior pre-training datasets, including curated, expert-annotated datasets from domains such as biology and chemistry.Source: §B.3 · p. 20
B.4 Why Inverse Importance Sampling Strategy is needed
- Inverse importance sampling prioritizes low-degree nodes during toy-graph sampling to capture long-tail knowledge that may otherwise be underrepresented.Source: §B.4 · p. 20
B.5 Why Four Similarities are needed
- The four similarity signals cover time, graph structure, shared neighborhoods, and feature semantics, each tied to a stated downstream retrieval use.The examples include historical interactions, recurring structural patterns, shared purchase histories, and semantic matching of subgraphs to query nodes.Source: §B.5 · p. 20
B.6 Why Knowledge Fusion is needed
- Knowledge fusion propagates toy-graph embeddings and task-specific outputs together, while the decoder can be reused or adapted across tasks.For different tasks, the decoder may be masked with pre-computed embeddings or tuned for adaptation.Source: §B.6 · p. 20
B.7 How RAGRAPH works on par with RAG in NLP and CV
RAGRAPH treats graph inference as retrieval-enhanced prompting, propagating knowledge from similar toy graphs into query graphs. The section presents experimental and theoretical arguments for this approach and details how graph structure is encoded and compared.
B.7 How RAGRAPH works on par with RAG in NLP and CV
- RAGRAPH’s toy-graph strategy significantly outperforms baselines, with similar-pattern subgraphs offering richer inference information than simply enlarging receptive fields.The section also reports a case study of node vectors and relates retrieval augmentation to NLP and CV.Source: §B.7 · p. 21
C.1 Revisiting Graph Neural Networks
- GNNs iteratively aggregate messages from local neighbors, using message-passing and aggregation functions that can be parameter-free.Source: §C.1 · p. 21
C.2 Key Construction of Position-aware Code
- Position-aware codes use normalized hop distances from nodes to an anchor set; the resulting structure feature maps graph structure to a smaller Euclidean representation.Distances beyond the maximum-hop boundary are treated as invalid.Source: §C.2 · p. 22
C.3 Similarity Functions
- Toy-graph similarity combines time, environment, structure, and hidden-embedding comparisons, using exponential time decay, Jaccard neighbor similarity, and cosine similarity for position-aware codes.Source: §C.3 · p. 22
C.4 Proof of the Effectiveness of RAG
The section argues that retrieval can increase the predictive information available to a GNN, while outlining algorithms for building a toy-graph database and retrieving and propagating its contents.
C.4 Proof of the Effectiveness of RAG
- From a mutual-information perspective, adding retrieval knowledge can increase information between input features and target labels; retrieval that is noise contributes near-zero additional predictive information.Source: §C.4 · pp. 22–23
C.5 Algorithms
- Toy-graph construction samples master nodes, forms and augments their k-hop ego networks, and stores timestamp, environment, structure, semantic, and task-output keys or values.Source: §C.5 · p. 23
- Inference ranks toy graphs by combined similarity, retrieves the topK, propagates their information, and fuses the outputs; the algorithm also describes inference without fine-tuning.Source: §C.5 · pp. 23–24
D.1 Datasets Statics
The evaluation datasets cover static node and graph classification and dynamic link-prediction settings, with dataset partitions determined by graph type.
- The evaluation includes four static public classification datasets and three dynamic real-world datasets for recommendation link prediction.Source: §D.1 · pp. 24, 26
- Static datasets include PROTEINS, COX2, ENZYMES, and BZR; PROTEINS supports node and graph classification and contains 1,113 graphs.Source: §D.1 · pp. 24, 26
- Dynamic datasets are TAOBAO, KOUBEI, and AMAZON; their records span 10 days, 9 weeks, and 13 weeks, respectively.Dynamic graphs are partitioned by snapshots, while static graphs are partitioned by node or by the entire graph.Source: §D.1 · p. 26
D.2 Evaluation Matrices
The evaluation section specifies accuracy for node classification and Recall@k and NDCG@k for link prediction, then describes the methods used as baselines.
D.2 Evaluation Matrices
- Node classification is measured by prediction accuracy, while link prediction uses Recall@k and NDCG@k to assess true-positive retrieval and ranking quality.Source: §D.2 · pp. 26–27
D.3 Baseline Details
- Baseline methods include neighborhood-aggregation GCN [50] and attention-based GAT, alongside other graph-learning approaches.Source: §D.3 · p. 27
- The baseline set includes LightGCN [31] and SimGCL [118], described respectively as graph-propagation and contrastive-learning methods, alongside GraphPro [114], which adds spatial and temporal prompts, and PRODIGY, which uses in-context examples.Source: §D.3 · pp. 27–28
D.4 Implementation Details
The appendix specifies implementation settings and evaluates how performance changes with training and resource-data proportions. RAGRAPH converges fastest among the compared models and performs better than PRODIGY, particularly at higher data volumes.
D.4 Implementation Details
- Implementations use PyTorch 2.3.0 [79] and Python 3.11 on Ubuntu with one V100 GPU and an Intel(R) Xeon(R) CPU; node/graph classification baselines use two-layer models, while link prediction baselines use three-layer GNNs.For node and graph classification, GCN, GraphSAGE, GAT, GIN, and GraphPrompt use 2-layer architectures with hidden dimension 256; GAT uses 8 first-layer attention heads, and GraphSAGE uses mean aggregation. For link prediction, LightGCN, SGL, MixGCF, SimGCL, and GraphPro use 3-layer GNNs, hidden dimension 64, and LoRA rank 16.Source: §D.4 · p. 28
D.5 Resource Graph Scalability Study
- Scalability tests vary training and resource-data proportions from 10% to 80% on ENZYMES and PROTEINS, maintaining a 3:5 train-to-resource ratio.The combined training and resource data serve as the retrieval database.Source: §D.5 · p. 28
- RAGRAPH converges fastest and outperforms the other evaluated models, especially at higher data volumes where knowledge integration is more beneficial.Accuracy plateaus at 30% in PROTEINS for PRODIGY and RAGRAPH and at 40% for GraphPrompt.Source: Figure 4 · p. 28, §D.5 · p. 29
D.6 Qualitative Analyses of Toy Graphs Retrieving
A qualitative example shows retrieved toy-graph information shifting a node's class representation toward its known class. The paper contrasts RAGRAPH's on-demand use of external information with PRODIGY's fixed-example mapping and identifies potential applications in scarce-data settings.
D.6 Qualitative Analyses of Toy Graphs Retrieving
- For ENZYMES node 13984, retrieved labels normalize to [0,0.08,0.92], while the combined retrieved vector normalizes to [0.157,0.170,0.673].The combined vector is reported as more discriminative than GraphPrompt's [0.28,0.34,0.38].Source: §D.6 · p. 29
E Difference between ICL (PRODIGY) and RAG (RAGRAPH)
- Unlike PRODIGY's fixed examples and direct X-to-Y mapping, RAGRAPH retrieves external feature and label information on demand and can operate without fine-tuning.The paper positions this design for dynamic graph structures and evolving tasks.Source: E Difference between ICL (PRODIGY) and… · p. 30
F Broader Impacts
- The paper positions parameter-free transfer as particularly effective for scarce, long-tail domains, including network anomaly detection and rare-disease diagnosis.It also names supply-chain disruption and new-user recommendations as examples.Source: F Broader Impacts · p. 30
- The framework incorporates retrieved features and label information into learning, which the authors describe as enhancing model understanding capabilities.They present the work as a reference for future Large Graph Models.Source: F Broader Impacts · p. 31
G Data Ethics Statement
The evaluation uses publicly available datasets under their usage terms and conditions and reports no personally identifiable information or human or animal subjects.
- The evaluation uses publicly available datasets under their usage terms and conditions; no personally identifiable information or human or animal subjects were involved.Source: G Data Ethics Statement · p. 31
Related papers
This paper cites
- PyTorch: An Imperative Style, High-Performance Deep Learning Library2019
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks2020
- Semi-Supervised Classification with Graph Convolutional Networks2016
- How Powerful are Graph Neural Networks?2018
- node2vec: Scalable Feature Learning for Networks2016
- Convolutional Networks on Graphs for Learning Molecular Fingerprints2015