DOI: 10.1145/3837856 ISSN: 1046-8188

Modular RAG: Transforming RAG Systems into LEGO-like Reconfigurable Frameworks

Yunfan Gao, Yun Xiong, Meng Wang, Haofen Wang

Retrieval-Augmented Generation (RAG) has substantially improved the performance of Large Language Models (LLMs) on knowledge-intensive tasks. While recent advances have introduced sophisticated retrievers, orchestration mechanisms, and optimization strategies that move beyond the naive retrieve-then-generate approach, a unified paradigm for systematically designing and optimizing RAG systems across diverse tasks remains lacking. This paper introduces Modular RAG, a unified paradigm that organizes RAG systems into a three-layer structure of modules, submodules, and operators. We formalize over 40 specialized operators within eight L1 modules and further summarize typical RAG design patterns, including linear, conditional, branching, and loop, to model the orchestration of retrieval and generation processes. Through extensive experiments, we demonstrate the adaptability of different RAG workflows to typical tasks. We further introduce node-level diagnostics to identify performance bottlenecks and quantify the trade-offs between efficiency and effectiveness. By establishing a unified paradigm and empirically supported mapping guidelines, Modular RAG provides researchers and practitioners with a systematic framework for designing, implementing, and optimizing RAG systems across diverse application scenarios.

More from our Archive