Introduction
Retrieval-Augmented Generation (RAG) has become a cornerstone for enhancing Large Language Models (LLMs) with external knowledge. While standard vector-based RAG excels at pinpointing specific facts, it often struggles with "global" queries that require synthesizing information across an entire document, such as summarizing a character's development in a novel. To address this, graph-based RAG methods like Microsoft’s GraphRAG have emerged, utilizing knowledge graphs to capture broader context.
However, existing graph-based solutions suffer from significant overhead. They typically rely on expensive LLM calls to extract every entity and relationship during indexing, leading to high costs and slow processing. Furthermore, they often require manual configuration to switch between "local" (fact-based) and "global" (theme-based) retrieval modes. E2GraphRAG (Efficiency and Effectiveness GraphRAG) is proposed as a streamlined framework that addresses these bottlenecks through a hybrid hierarchical and graph-based approach.
Methodology: A Dual-Structure Approach
E2GraphRAG optimizes both the indexing and retrieval phases to achieve high performance without the typical computational burden.
1. Efficient Indexing
The framework constructs two primary structures to organize information:
- Hierarchical Summary Tree: Inspired by the RAPTOR approach, E2GraphRAG recursively merges and summarizes text chunks using an LLM. This creates a multi-layered tree where higher nodes represent broader summaries, capturing information at various levels of granularity.
- Lightweight Entity Graph: Unlike traditional methods that use LLMs for graph construction, E2GraphRAG utilizes SpaCy, a fast, CPU-based NLP library, to extract entities. Relationships (edges) are established based on simple sentence-level co-occurrence. This shift from GPU-heavy LLM extraction to CPU-based NLP allows for parallel processing, significantly reducing indexing time.
To link these structures, the system maintains bidirectional mappings between entities and text chunks, enabling rapid navigation between the graph and the source text.
2. Adaptive Retrieval Strategy
E2GraphRAG removes the need for manual mode selection by implementing an adaptive retrieval logic based on query entity "density." When a query is received, the system extracts relevant entities and checks their connectivity within the knowledge graph:
- Local Retrieval: If the entities are closely connected (within a specified number of hops), the system focuses on the specific subgraphs and associated text chunks to answer factual questions.
- Global Retrieval: If entities are scattered or absent from the graph, the system utilizes the summary tree and an "Occurrence Ranking" mechanism. This allows it to identify thematic chunks and high-level summaries to answer broad, document-wide questions.
Experimental Evaluation
The researchers evaluated E2GraphRAG against several state-of-the-art baselines, including GraphRAG (Local and Global variants), LightRAG, and RAPTOR. Testing was conducted on long-context datasets such as NovelQA (narrative understanding of books) and InfiniteBench (long-form QA and multiple-choice).
Performance and Efficiency
The results, summarized in the table below, highlight E2GraphRAG's superior efficiency.
Key findings include:
- Indexing Speed: E2GraphRAG is up to 10x faster at indexing than GraphRAG. For instance, on the NovelQA dataset with Qwen2.5-7B, E2GraphRAG's indexing time was 1397.11s compared to GraphRAG's 13793.89s.
- Retrieval Latency: The system achieves a 100x speedup in query time compared to LightRAG, maintaining a near-instantaneous response (0.02s to 0.05s).
- Accuracy: Despite its lightweight construction, E2GraphRAG matches or exceeds the accuracy of more complex models. On NovelQA, it achieved a top score of 45.60%, outperforming both GraphRAG-Local and RAPTOR.
Discussion and Insights
The success of E2GraphRAG stems from several key design choices. By offloading entity extraction to traditional NLP tools, the system leverages CPU/GPU parallelism effectively. Furthermore, the use of graph topology (hop counts) as a proxy for user intent allows for a seamless transition between local and global context without user intervention.
Limitations and Future Work
While highly effective, the authors note that SpaCy-based extraction might be noisier than LLM-based extraction in highly technical or niche domains. Future iterations may explore more mathematically rigorous retrieval strategies beyond simple hop counts and aim to increase the transparency of retrieval paths to improve system interpretability.
Conclusion
E2GraphRAG demonstrates that high-performance graph-based RAG does not require prohibitive computational costs. By combining hierarchical summaries with lightweight entity graphs and an adaptive retrieval strategy, it provides a scalable, fast, and accurate solution for long-context information retrieval.
Summary updated