Advanced RAG
Authoritative Definition
A sophisticated architecture for Retrieval-Augmented Generation that incorporates multi-stage processing like pre-retrieval query rewriting, hybrid search, second-stage re-ranking, and post-retrieval context compression.
Overview & Technical Description
Advanced RAG architectures move beyond the standard "embed and search" paradigm of naive RAG by introducing multiple stages of processing to refine the retrieval process and improve context quality. The architecture typically consists of three main phases: pre-retrieval, retrieval, and post-retrieval. Pre-retrieval techniques involve query transformations, such as query rewriting, expansion, or decomposition, to ensure the user's intent is perfectly aligned with the indexed data. During the retrieval phase, advanced RAG often employs hybrid search strategies, combining dense vector search for semantic matching with sparse keyword search (like BM25) for exact term matching. In the post-retrieval phase, techniques such as cross-encoder re-ranking are applied to re-order the retrieved documents based on deeper semantic relevance to the query. Context compression and filtering are then used to strip out irrelevant information before the final prompt is constructed. This multi-stage approach is crucial in production AI agent systems and enterprise LLM deployments because it directly addresses the "lost in the middle" problem and reduces the likelihood of hallucinations caused by noisy or irrelevant context. By significantly improving the signal-to-noise ratio of the injected context, Advanced RAG ensures that language models can ground their responses more accurately while simultaneously optimizing context window usage and reducing token costs.
Editorial Notes
Production best practices suggest implementing reciprocal rank fusion (RRF) when combining dense and sparse retrieval scores. A common edge case involves increased latency due to multiple LLM calls for query rewriting and cross-encoder processing. Careful caching strategies and lightweight re-rankers are recommended to meet real-time latency constraints.