RAG-Fusion

Also known as: RAG fusion

On this page 7

RAG-Fusion is a retrieval-augmented generation technique in which a language model rewrites one user question into several related queries, a retriever runs each query separately, and the resulting ranked lists are merged with reciprocal rank fusion (RRF) before the top passages are passed to the generator. In the Retrieval & knowledge part of artificial intelligence, it addresses a familiar weakness of single-query RAG: one phrasing of a question rarely matches every relevant document.

The method combines two older ideas, query expansion and rank fusion, and packages them as a lightweight layer in front of an existing retriever. It requires no retraining of the embedding model and works with dense, sparse or hybrid search.

How the RAG-Fusion pipeline works

The RAG-Fusion pipeline works in four sequential stages: query generation, parallel retrieval, reciprocal rank fusion and grounded generation. Each stage can be tuned independently, which makes the technique easy to add to an existing RAG stack.

  1. Query generation: a language model produces typically three to five reformulations of the original question, covering synonyms, sub-aspects and different levels of specificity.
  2. Parallel retrieval: each query, often including the original, is sent to the retriever, which returns its own top-k list.
  3. Reciprocal rank fusion: the lists are merged by summing 1 / (k + rank) for every document across lists, with the constant k commonly set to 60.
  4. Grounded generation: the highest-scoring fused passages form the context for the final answer.

Reciprocal rank fusion is the core of the method because it uses ranks rather than raw scores. Similarity scores from different queries are not directly comparable, but ranks are, so a document that appears near the top of several lists rises above a document that ranks first in only one.

A short calculation shows the effect. With k set to 60, a document ranked first in one list receives 1/61, or about 0.0164. A document ranked third in each of three lists receives three times 1/63, or about 0.0476, and therefore wins clearly. This behavior explains why the method favors broadly relevant passages over passages that match only one narrow phrasing of the question.

Key parameters and their effects

The key parameters of RAG-Fusion control how broadly it searches and how strictly it fuses. Poorly chosen values either waste latency on redundant queries or dilute the context with off-topic passages.

ParameterTypical valueEffect of increasing it
Number of generated queries3 to 5Higher recall, more latency and cost
Top-k per query10 to 50More candidates, more noise
RRF constant k60Flatter weighting across ranks
Final context size4 to 10 passagesMore coverage, longer prompts
Query generation temperature0.3 to 0.8More diverse, less faithful variants
Main RAG-Fusion parameters

A common refinement is to keep the original query in the fused set and sometimes give it a higher weight. This protects precision when the generated variants drift away from the user intent.

RAG-Fusion differs from related techniques mainly in where diversity comes from and how results are combined. It shares the query side with query expansion and HyDE, and the merging side with hybrid search.

TechniqueCore ideaDifference from RAG-Fusion
Standard RAGOne query, one ranked listNo reformulation or fusion
Query expansionAdds terms to one queryProduces one enriched query, not several lists
HyDEEmbeds a hypothetical answerGenerates a document, not query variants
Hybrid searchFuses dense and sparse retrieversDiversity from retrievers, not queries
Query decompositionSplits a question into sub-questionsAnswers parts separately, often sequentially
RerankingRescores candidates with a cross-encoderComplementary step after fusion
RAG-Fusion and neighboring techniques

These techniques are often combined rather than chosen exclusively. A production pipeline may fuse multi-query results from a hybrid retriever and then apply a cross-encoder reranker to the fused top 50.

When to use RAG-Fusion

RAG-Fusion is most useful when user questions are short, ambiguous or phrased differently from the source documents. It is less useful when queries are already precise and the corpus uses the same vocabulary as the users.

SituationRecommendationReason
Vague customer support questionsUse RAG-FusionVariants cover different phrasings
Exact part number lookupAvoid itLexical search already matches exactly
Strict latency budget below 300 msUse cautiouslyExtra LLM call adds delay
Multi-aspect research questionsCombine with decompositionFusion alone may miss sub-questions
Corpus with heavy jargonUse RAG-FusionVariants bridge user and expert terms
Decision guide for adopting RAG-Fusion

Before adoption, teams should build a small evaluation set from real user questions and compare the fused pipeline with the single-query baseline. If the corpus is small or well curated, the single query may already retrieve everything relevant, and the extra stage only adds cost. If users regularly report that the assistant cannot find documents that clearly exist, multi-query retrieval is a strong candidate for closing that gap.

Limitations and common mistakes

The main limitations of RAG-Fusion are added latency, added cost and the risk of query drift. Each request requires an extra model call and several retrieval calls, which can double end-to-end response time when retrieval is not parallelized.

  • Query drift: generated variants may introduce assumptions that the user never made, pulling in irrelevant passages.
  • Redundant variants: near-identical reformulations add cost without adding recall.
  • Overconfidence in fusion: RRF rewards consensus, so a uniquely relevant document found by one query may be ranked too low.
  • Missing evaluation: gains should be verified with recall@k or nDCG on a labeled query set, not assumed.

Reported improvements vary widely by corpus and query type. Teams should treat RAG-Fusion as a hypothesis to test against a baseline, measuring both retrieval metrics and answer quality.

Put simply

Think of asking a librarian a question. You might say it one way, but the right book uses different words. A good librarian asks the question several ways. Then the librarian checks which books keep coming up. RAG-Fusion does the same thing for an AI assistant.

The assistant writes a few versions of your question. It searches with each version. Books that appear in many searches rise to the top. The answer then rests on sources that several searches agree on. This usually finds more of the right material, at the cost of a little extra time.

In practice

An internal help desk assistant at a mid-sized software company answers employee questions from about 12,000 policy and IT documents. Employees ask short questions such as “laptop broken what now”, while the documents use terms like “hardware replacement procedure”. A single embedding search often misses the right page.

The team adds RAG-Fusion with four generated queries, top 20 per query and RRF with k = 60, followed by a reranker. On a test set of 300 labeled questions, recall@5 rises from about 0.62 to 0.78, while median latency grows by roughly 400 milliseconds. The team accepts the delay because fewer questions are escalated to human support staff.