Papers
Topics
Authors
Recent
Search
2000 character limit reached

Formal Modular RAG Architecture

Updated 9 February 2026
  • Formal Modular RAG Architecture is a systematic and composable framework that decomposes retrieval-augmented generation into modular components with defined input/output specifications.
  • The architecture enables rigorous benchmarking and ablation through precise module interfaces and parameterizable components, supporting extensive analysis and design-space exploration.
  • It promotes extensibility and scalability by independently instantiating retrieval (SE, PF, PR) modules, allowing tailored instantiations for both accuracy and computational efficiency.

A formal modular Retrieval-Augmented Generation (RAG) architecture refers to a systematic, composable, and interface-driven decomposition of a RAG system, such that its core functionalities—retrieval, context aggregation, and generative reasoning—are realized as interoperable modules with well-defined input/output types and documented interface specifications, enabling rigorous benchmarking, ablation, extensibility, and tailored instantiation for diverse application scenarios and knowledge sources. In the context of Graph-based Retrieval-Augmented Generation (GraphRAG), a formal modular architecture encompasses fine-grained module boundaries, precise pipeline composition, and parameterizable components, supporting both analysis and design-space exploration in large-scale reasoning tasks (Cao et al., 2024).

1. Formal Problem Statement and Pipeline Structure

A modular GraphRAG framework assumes as input a text-attributed knowledge graph G=(V,E)G = (V, E), where VV is a set of entities with textual descriptions and E⊆V×R×VE \subseteq V \times R \times V a set of labeled, directed edges for relations RR. Given a natural-language query q∈Σ∗q \in \Sigma^*, a preprocessing frontend extracts a set of query entities/relations εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\} present in GG.

The pipeline supports the following formal sequence:

  1. Entity/Relation Extraction: εq=Extract(q)⊂V×R\varepsilon_q = \mathrm{Extract}(q) \subset V \times R
  2. Reasoning Chain Retrieval: R={Pi}=Retrieve(G,εq)R = \{P_i\} = \mathrm{Retrieve}(G, \varepsilon_q), where each PP is a multi-hop path.
  3. Augmented Prompt Construction: VV0
  4. Answer Generation: VV1

Compactly, VV2.

2. Modular Decomposition of Retrieval

The retrieval phase is decomposed into three sequential modules, each with strictly defined interface contracts:

2.1 Subgraph-Extraction (SE)

  • Inputs: Full graph VV3, query entity set VV4, parameters VV5, VV6.
  • Outputs: Query-specific subgraph VV7, VV8.
  • Algorithm: Personalized PageRank (PPR) from seed nodes, with possible semantic reranking via VV9 if coupled with a neural/LLM scorer.

Interface:

GG2

2.2 Path-Filtering (PF)

  • Inputs: Subgraph E⊆V×R×VE \subseteq V \times R \times V0, seeds E⊆V×R×VE \subseteq V \times R \times V1, method E⊆V×R×VE \subseteq V \times R \times V2 {SPF, CPF, IPF}, E⊆V×R×VE \subseteq V \times R \times V3, scoring function E⊆V×R×VE \subseteq V \times R \times V4.
  • Outputs: Candidate paths E⊆V×R×VE \subseteq V \times R \times V5.
  • Algorithms: Shortest-Path (Dijkstra, SPF), Complete Path Filtering (CPF, BFS enumeration), Iterative/Beam Search (IPF).

Interface:

GG3

2.3 Path-Refinement (PR)

  • Inputs: Candidates E⊆V×R×VE \subseteq V \times R \times V6, query E⊆V×R×VE \subseteq V \times R \times V7, scoring function E⊆V×R×VE \subseteq V \times R \times V8, E⊆V×R×VE \subseteq V \times R \times V9.
  • Outputs: Refined paths RR0 (top-RR1).
  • Algorithm: Score and select top-RR2 candidates.

Interface:

GG4

Module Interfaces Summary

Module Input Types Output Types Core Algorithm
SE RR3 RR4 PPR, semantic rerank
PF RR5 RR6 SPF, CPF, IPF (beam)
PR RR7 RR8 (top RR9 paths) Scoring + selection

3. Systematic Taxonomy of Existing Techniques

Existing GraphRAG techniques can be mapped as valid module choices:

  • SE: Purely structural (PPR, RWR), lexical (BM25), neural (Sentence-Transformer, DPR), LLM rerank (Llama/GPT), fine-tuned KG-coupled models.
  • PF: Standard SPF/CPF (as in classical KBQA), beam-search + BM25/NN-based scorer, LLM-based scoring, fine-tuned in-domain LLMs.
  • PR: Random, BM25 of path text, Sentence-Transformer rerankers, LLM re-ranking, LoRA-fine-tuned discriminators.

This mapping reveals a design space where each module is independently instantiable, provided interface consistency.

4. Assembly and Instantiation of New GraphRAG Pipelines

A concrete GraphRAG instance is specified by selecting one method per module, with budgetary/compatibility constraints:

  1. SE Module: {q∈Σ∗q \in \Sigma^*0, q∈Σ∗q \in \Sigma^*1, q∈Σ∗q \in \Sigma^*2, q∈Σ∗q \in \Sigma^*3, q∈Σ∗q \in \Sigma^*4}
  2. PF Module: {q∈Σ∗q \in \Sigma^*5, q∈Σ∗q \in \Sigma^*6, q∈Σ∗q \in \Sigma^*7, q∈Σ∗q \in \Sigma^*8, q∈Σ∗q \in \Sigma^*9}
  3. PR Module: {εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}0, εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}1, εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}2, εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}3}

Parameters must be tuned to keep subgraph and candidate set sizes within hardware constraints.

Guidelines:

  • Avoid double fine-tuning across SE and PF to prevent overspecialization.
  • Non-NN pipelines (structural SE + basic PF/PR) are computationally frugal; LLM-powered pipelines offer accuracy at higher cost.

5. Evaluation Metrics and Multi-Objective Tradeoffs

Key evaluation metrics for modular GraphRAG architectures:

  • Reasoning Quality εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}4: F1 or exact-match (HR@1) on generation output.
  • Retrieval Quality εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}5: F1 versus ground-truth reasoning chains.
  • End-to-End Quality εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}6.
  • Runtime εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}7: εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}8 (seconds).
  • Token Cost εq={(vi(q),ej(q))}\varepsilon_q = \{(v_i^{(q)}, e_j^{(q)})\}9: aggregate LLM tokens processed.
  • GPU Cost GG0: LLM latency × GPU power.

Comprehensive optimization:

GG1

6. Empirical Design Principles for Modular GraphRAG

Empirical analysis in LEGO-GraphRAG provides the following guidance:

  • SE: PPR maximizes recall; adding Sentence-Transformer reranking improves precision at low cost. Vanilla LLM reranking is more effective but incurs ~5× runtime overhead.
  • PF: SPF and CPF are efficient; CPF provides richer context but is noisier. Beam search with ST reranking is optimal for F1/runtime; fine-tuning offers marginal gain. LLM beam search only helps with large, well-prompted models.
  • PR: BM25 is fast but low quality; ST rerankers add 3–5 F1 points; LLM re-ranking is best but doubles runtime.
  • Prompt Engineering: Increasing path count up to ~16 boosts F1, after which returns diminish. Few-shot prompts show inconsistent effects; zero-shot is robust.
  • Overall Pipelines: PPR→SPF→ST for throughput; PPR+LLM_ft→BS+ST→LLM for accuracy (Cao et al., 2024).

The modular decomposition, taxonomy, and instantiation protocol in LEGO-GraphRAG enable systematic design, reproducibility, and principled experimentation in building advanced RAG systems grounded in structured knowledge graphs.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Formal Modular RAG Architecture.