RGL: A Graph-Centric, Modular Framework for Efficient Retrieval-Augmented Generation on Graphs

Yuan Li, Jun Hu, Jiaxin Jiang, Zemin Liu, Bryan Hooi, Bingsheng HearXiv 2025

Abstract

Recent advances in graph learning have paved the way for innovative retrieval-augmented generation (RAG) systems that leverage the inherent relational structures in graph data. However, many existing approaches suffer from rigid, fixed settings and significant engineering overhead, limiting their adaptability and scalability. Additionally, the RAG community has largely overlooked the decades of research in the graph database community regarding the efficient retrieval of interesting substructures on large-scale graphs. In this work, we introduce the RAG-on-Graphs Library (RGL), a modular framework that seamlessly integrates the complete RAG pipeline—from efficient graph indexing and dynamic node retrieval to subgraph construction, tokenization, and final generation—into a unified system. RGL addresses key challenges by supporting a variety of graph formats and integrating optimized implementations for essential components, achieving speedups of up to 143x compared to conventional methods. Our extensive evaluations demonstrate that RGL not only accelerates the prototyping process but also enhances the performance and applicability of graph-based RAG systems across a range of tasks.

Introduction

While Retrieval-Augmented Generation (RAG) has revolutionized how Large Language Models (LLMs) interact with unstructured text, applying these techniques to complex graph data—such as social networks, citation webs, or e-commerce interactions—remains a significant challenge. Current "Retrieval-on-Graphs" (RoG) systems are often hampered by three primary issues: rigidity in dataset handling, high engineering overhead for building custom pipelines, and severe efficiency bottlenecks. Standard graph libraries like NetworkX, while flexible, are often too slow for the high-volume queries required by modern RAG applications. For instance, extracting subgraphs for 10,000 queries can take over 11 hours using naive Python-based methods, creating a massive bottleneck in the development cycle.

The RGL Framework

RGL is designed as a modular toolkit that unifies the entire RoG pipeline. The framework is organized into a four-layer architecture to ensure both high performance and developer flexibility:

  • RGL Kernel: This core engine handles graph data structures and implements high-performance retrieval algorithms (such as Steiner trees and Breadth-First Search) in C++ via pybind11. This allows the system to bypass Python's inherent speed limitations for heavy graph traversals.
  • RGL Runtime: This layer manages resource allocation, caching, and parallelization, ensuring the system scales effectively across different hardware configurations.
  • RGL API: Developers can choose between an Object-Oriented (OOP) interface for building full workflows or a Functional API for fine-grained control over specific steps like tokenization or embedding.
  • RGL Applications: The library includes pre-built templates for common tasks, including Graph Q&A, Summarization, and Data Completion.
The integrated RAG-on-Graphs pipeline within the RGL framework.

The core innovation of RGL lies in its hybrid approach: it maintains the flexibility of Python for model training and integration with libraries like PyTorch Geometric and DGL, while offloading computationally intensive graph operations to optimized C++ routines.

Experimental Evaluation

The framework was evaluated across several diverse datasets to test its versatility and performance:

  • OGBN-Arxiv: A large-scale citation network containing approximately 169,000 nodes and 1.1 million edges.
  • Baby & Sports: Bipartite recommendation datasets used to evaluate "modality completion" (inferring missing user or item attributes).
  • Arxiv2025: A custom dataset of papers published after the knowledge cutoff of models like GPT-4o, ensuring that evaluations measured true retrieval performance rather than the LLM's internal training data.

Results and Analysis

Our evaluations revealed that retrieval is often the primary bottleneck in RoG systems. RGL addresses this by providing massive speedups; for example, it completed 10,000 Steiner graph queries on the OGBN-Arxiv dataset in under 5 minutes, a task that required over 11 hours using a NetworkX baseline.

Scaling performance of RGL vs. NetworkX across varying query volumes.

As shown in the scaling analysis, while traditional libraries experience exponential growth in processing time as query counts increase, RGL's overhead remains nearly flat. Furthermore, the retrieved graph context significantly improves output quality. In abstract generation tasks, RGL-based retrieval consistently outperformed "SelfNode" (no retrieval) and simple kNN baselines across ROUGE-1, ROUGE-2, and ROUGE-L metrics.

Conclusion

RGL represents a significant step forward in making large-scale graph-based LLM applications practical. By decoupling node retrieval from graph structure retrieval and optimizing the underlying computation, RGL enables researchers to prototype and deploy complex RAG systems with unprecedented efficiency. Future work will focus on deeper integration with industrial graph databases like Neo4j and expanding the suite of out-of-the-box applications to further lower the barrier to entry for graph-centric AI.

Summary updated

BibTeX
@misc{li2025rgl,
  author = {Yuan Li and Jun Hu and Jiaxin Jiang and Zemin Liu and Bryan Hooi and Bingsheng He},
  title = {{RGL: A Graph-Centric, Modular Framework for Efficient Retrieval-Augmented Generation on Graphs}},
  year = {2025},
  eprint = {2503.19314},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.19314},
}
Figure