Adrian Raudaschl

RAG Fusion

Open-source methodology combining retrieval-augmented generation with reciprocal rank fusion and generated queries. 900+ GitHub stars and widely adopted across the AI community.

2023–Present
Technologies
PythonRAGLLMReciprocal Rank FusionInformation RetrievalChromaDBBM25Open Source
The Wonderful World of RAG Fusion, illustrated with a cartoon cat professor

In short

RAG Fusion is a retrieval technique. Rather than searching once with the question as typed, an LLM rewrites it several ways, each rewrite is searched separately, and the result lists are merged with Reciprocal Rank Fusion, so documents that keep turning up rise to the top.

It helps most when people and documents use different words for the same thing, and when missing a relevant document costs more than reading a marginal one. It costs you an extra LLM call and about a second and a half. Try the ranking step yourself, or see when it is worth using.

Where It Came From

My journey into retrieval techniques started at Mendeley, where I rebuilt the search experience from scratch. I was fortunate to be surrounded by mentors who guided me through the fundamentals: what precision and recall actually mean, how lexical search differs from vector search, how to think about relevance at scale. After Mendeley, I moved from user-facing product work to helping build platform search capabilities across Elsevier's product ecosystem, and that's where I started encountering more complex retrieval problems. One technique kept catching my attention: Reciprocal Rank Fusion. The idea of combining multiple ranked lists into a single, better ranking felt elegant. The problem was that it wasn't very practical unless you were already sitting down and manually pre-formulating a range of queries before firing them off. A useful technique with no scalable workflow.

Then LLMs changed the equation. During my early experiments on the Scopus AI prototype, I was thinking about retrieval in two ways. One was straightforward: generate variations of the same query to improve recall, so you weren't missing papers that used different terminology. The other was more ambitious: what if you asked a question from many different perspectives, so that when you combined the results, you'd get a genuinely comprehensive overview of a topic rather than just the papers that happened to match one phrasing?

At the time, I was quite obsessed with knowledge management systems like Obsidian, using them to collect notes and then applying search techniques to explore a topic from different angles to help with my writing. The thought kept nagging: wouldn't it be brilliant if you could apply that to everything? What if the LLM itself could write the alternative queries, which in turn would lead to a much better search experience?

Project Ramble: my personal search system, where I hooked up my Obsidian notes to vector search combined with GPT-3 in 2022

Project Ramble interface showing a personal search system combining Obsidian notes with vector search and GPT-3

The first question I remember testing it with was "how to live a good life." It's been my go-to ever since, precisely because it's multifaceted, doesn't have a single right answer, and forces a system to think broadly. I remember seeing the results come back and feeling genuinely elated. The difference was obvious right away. I was so excited that I called up friends and close colleagues and talked endlessly about it, probably to the point of annoyance. But I could see I'd uncovered something valuable.

"How to live a good life": the first query I tested, and still my go-to for evaluating new systems

Project Sebright v0.8 demo showing a keyword graph for 'How to live a good life' with branches to Anthropology of Morality, Science of Well-being, Positive Psychology

That's really what became RAG Fusion. It started as a way to improve retrieval in my own knowledge base, but it quickly became obvious the idea had much broader application. I wrote it up with a deliberately provocative title, "Forget RAG, the Future is RAG Fusion", and open-sourced the implementation. The repo has since grown to over 900 stars on GitHub. I'll admit the title was a bit much, but the technique does what it says on the tin.

The Problem with Standard RAG

Standard RAG is brilliant at what it does: take a query, find relevant documents via vector search, and use them to ground a language model's response. But it inherits a fundamental constraint from the search step. You get one query, which means one angle, one vocabulary, one way of describing what you're after.

Searches for RAG skyrocketing in 2023, but the technique still had a core limitation

Google Trends graph showing searches for Retrieval Augmented Generation skyrocketing in 2023

Researchers rarely think in single queries. Someone investigating the relationship between gut microbiota and depression might also be interested in papers about the gut-brain axis, serotonin production in the intestinal tract, or probiotic interventions for mood disorders. These are all facets of the same question, but a single vector search will only find documents close to whichever phrasing the user happened to type first. The other 90% of potentially transformative work stays buried.

The issue isn't that vector search is bad. It's that human questions are multidimensional, and a single retrieval pass only captures one dimension. What I wanted was a system that could think about the question from several angles before deciding what was relevant.

How It Works

Multi-Query Generation

One question, many perspectives

An LLM takes the original query and generates multiple reformulations, each capturing a different angle or vocabulary for the same underlying question.

Diagram showing how a single query is expanded into multiple generated queries, each exploring different facets of the original question
  • •Generates 4+ alternative queries from different perspectives
  • •Diverse prompt variant explicitly requests different angles, synonyms, and varied specificity
  • •Casts a wider net across the document space than any single query could

Parallel Retrieval

Search from every angle

Each generated query runs independently against the vector store, producing separate ranked result lists. The Hybrid variant also runs BM25 keyword search alongside vector search for each query.

  • •Vector search via ChromaDB embeddings for semantic matching
  • •Optional BM25 keyword search for exact term matching (the "free lunch")
  • •Cross-disciplinary discovery: finds relevant work across fields the user might not have considered

Reciprocal Rank Fusion

The best of every perspective

All ranked results are combined using Reciprocal Rank Fusion, a technique developed by Cormack, Clarke, and Büttcher at the University of Waterloo and Google (SIGIR 2009). RRF boosts documents that appear consistently well across multiple query perspectives. In their words, it "yields results better than any individual system, and better results than standard reranking methods." Documents that are only relevant to one framing get naturally deprioritised.

The Reciprocal Rank Fusion algorithm showing how scores from multiple ranked lists are combined using the formula score = sum of 1/(k + rank)
  • •Produces a final re-ranked list prioritising consistently relevant documents
  • •No training required: works as a drop-in enhancement to any existing RAG pipeline
  • •Optionally synthesised into a natural language answer via LLM

Try it: fuse the lists yourself

One question, asked four ways. Switch the rewrites on and off and watch the final ranking change.

  1. 1.A
  2. 2.B
  3. 3.G
  4. 4.E
  1. 1.F
  2. 2.B
  3. 3.A
  4. 4.C
  1. 1.D
  2. 2.B
  3. 3.F
  4. 4.A
  1. 1.C
  2. 2.B
  3. 3.E
  4. 4.A

Fused ranking: score = Σ 1 / (k + rank)

  1. 2A

    Gut microbiome composition in major depression

    0.0635 · ranks 1, 3, 4, 4
  2. 1B

    The gut-brain axis: a review

    0.0645 · ranks 2, 2, 2, 2
  3. 4C

    Probiotics for depressive symptoms: a meta-analysis

    0.0320 · ranks 4, 1
  4. 6D

    Serotonin synthesis in enterochromaffin cells

    0.0164 · ranks 1
  5. 5E

    Diet, inflammation and mood

    0.0315 · ranks 4, 3
  6. 3F

    Vagus nerve signalling from gut to brain

    0.0323 · ranks 1, 3
  7. 7G

    How antidepressants alter gut bacteria

    0.0159 · ranks 3

The review paper wins without topping a single list. It is second for every phrasing, and that consistency is what RRF rewards.

Paper titles are invented for the example. The scoring is the standard RRF formula.

The whole of the fusion step

This is the function from the repo, with its logging taken out. There is no model in it and nothing to train.

def reciprocal_rank_fusion(search_results_dict, k=60):
    """Combine several ranked lists into one."""
    fused_scores = {}
    for query, doc_scores in search_results_dict.items():
        ranked = sorted(doc_scores.items(), key=lambda x: x[1], reverse=True)
        for rank, (doc, _) in enumerate(ranked):
            fused_scores[doc] = fused_scores.get(doc, 0) + 1 / (rank + k)
    return dict(sorted(fused_scores.items(), key=lambda x: x[1], reverse=True))

The Full Pipeline

The RAG Fusion pipeline: one question in, multiple perspectives out, re-ranked results back

RAG Fusion architecture diagram: User Query flows to Generate Similar Queries, which fans out to multiple Vector Search queries, results merge via Reciprocal Rank Fusion into Re-ranked Results and finally Generative Output

The mechanism diagram above shows how RAG Fusion's pipeline connects together. What made this approach click for me was realising that the individual components aren't new. Multi-query generation, vector search, and rank fusion are all established techniques. The contribution is in how they combine: the LLM handles the creative work of reframing the question, vector search handles retrieval at scale, and RRF handles the aggregation without needing any training data or parameter tuning.

The RAG Fusion mechanism in detail

Detailed diagram of the RAG Fusion mechanism showing query generation, parallel vector searches, and reciprocal rank fusion

How RRF re-ranks results by positional scoring

Visualisation of how Reciprocal Rank Fusion combines positional rankings from multiple search result lists

Evaluation Results

The repo includes an evaluation harness using the NFCorpus dataset from the BEIR benchmark: 3,633 medical and nutrition documents, with graded relevance judgements. Six retrieval methods are compared on 200 test queries, from plain BM25 keyword search through to the full Hybrid+Diverse pipeline.

+19%
NDCG@10
ranking quality
+22%
Recall@10
coverage
+18%
MRR
first relevant result
+14%
Precision@5
top-result accuracy

Hybrid+Diverse against single-query vector search, retrieval only. 200 queries; the 95% confidence interval excludes zero on every metric.

Retrieval scores for six methods on NFCorpus, 200 queries
MethodPrecision@5Recall@10NDCG@10MRR
BM25 (keywords)0.2550.1300.2620.461
Baseline (one vector search)0.2830.1510.3010.488
Hybrid (BM25 + vector, no LLM)0.2720.1550.3020.513
RAG Fusion0.3020.1650.3190.504
RAG Fusion, diverse prompt0.3070.1680.3220.505
Hybrid + diverse0.3240.1850.3570.577

Three things stood out, and they held up at this sample size. First, hybrid search is essentially a free lunch: fusing BM25 and vector results via RRF needs no LLM call and improves ranking quality, especially at the top. Second, the diverse prompt modestly outperforms the standard RAG Fusion prompt by pushing the model toward genuinely different angles. Third, the two complement each other, and together they give the strongest result on every metric.

What happens in a real pipeline

Those numbers are retrieval only, and real systems add a reranker afterwards. So I tested that too. With a reranker in place the gains shrink but do not disappear: the hybrid and diverse configuration still improves NDCG@10 by 0.025 with a standard cross-encoder (bge-reranker-large) and by 0.050 with the strongest reranker tested, with confidence intervals that exclude zero.

Two caveats are worth stating plainly. The original vector-only version of RAG Fusion loses almost all of its advantage once a strong reranker is added; it is the hybrid search that carries the benefit through. And the effect on the final written answer is positive but small and noisy. The full write-ups are in the repo, including a note on a parser bug that these retrieval-only figures predate.

When to Use It, and When Not To

The technique earns its keep when three things are true:

  1. People describe things differently from how the documents do: lay terms against technical ones, jargon, paraphrase.
  2. Recall matters more than precision. Missing a relevant document costs more than including a marginal one.
  3. Whatever reads the results can cope with breadth: a strong model writing the answer, or an interface that shows several candidates.

Good fits

  • Scientific and biomedical literature search
  • Patent prior art, legal discovery, regulatory review
  • Long-tail shopping queries (“phone holder thing for car”)
  • Specialist collections the embedding model has not seen
  • Exploratory “show me what's out there” work

Poor fits

  • FAQ chatbots and curated support knowledge bases
  • Anything latency-critical: voice, autocomplete, sub-second chat
  • High-volume, thin-margin consumer search
  • Code and identifier search, where precision is everything
  • Structured data, knowledge graphs, SQL-backed retrieval

What it costs is mostly time, not money. With a small rewrite model, the extra call comes to about $0.06 per 1,000 queries, but it adds roughly a second and a half before the extra searches can start. If you take one thing from this page for free: add BM25 to your vector search. That part needs no LLM at all and is worth doing everywhere.

Impact

Open Source Adoption

900+ GitHub stars and 110+ forks. Adopted by LlamaIndex and LangChain, and referenced in production systems, research papers, and conference talks across the AI community.

Production Impact

Core component of the Scopus AI prototype, which became a research platform used by millions of researchers worldwide.

Multiple Patents

The retrieval techniques developed during this work are covered by multiple patent applications at Elsevier.

Viral Article

"Forget RAG, the Future is RAG Fusion" became one of the most widely shared articles on retrieval-augmented generation, reaching audiences well beyond the AI research community.

What surprised me most was the speed and breadth of adoption. It started with posts on LinkedIn and X, then people began writing academic papers about it. One researcher from South America even asked if I'd be willing to help integrate it into drone technology for warfare, which was certainly not an application I'd anticipated when writing about search relevance. The GitHub stars kept climbing, forks multiplied, and people started publishing their own articles explaining and extending the technique. It felt like I'd finally made something that had driven real impact, and on a topic I genuinely cared about. That's exactly the reason I wanted to be in the technology space.

Where It Stands Today

I still think RAG Fusion is a solid technique, and the evaluation results back that up. But the field moves quickly, and there are alternatives emerging. The one I've come across that sometimes performs a bit better is having the AI generate an answer first and then working backwards from there to find supporting evidence. The trade-off is that approach inherits all the biases and knowledge limitations of the language model itself.

In medicine, there's a name for this failure mode: anchoring bias. A doctor latches onto the first diagnosis and then unconsciously filters all subsequent evidence through that lens. The generate-answer-first approach is essentially anchoring bias as a retrieval strategy. It can look impressive on benchmarks, but it will only ever find evidence for what the model already believes.

What RAG Fusion does differently is work from first principles. You're building knowledge from the ground up rather than starting from what the model already thinks it knows. I think that matters, especially when you're trying to explore a space where no good answer exists yet, or where you need to discover things the model hasn't been trained on. And the evaluation shows it performs even better when you combine different search techniques together, vector and lexical, through RRF. That complementarity is the real strength.

There's a bigger shift worth naming, too. The field is moving from static RAG pipelines toward agentic search, where retrieval becomes something an RL-trained agent learns to do over many steps rather than a fixed retrieve-then-generate flow. It's tempting to read that as RAG Fusion being superseded. I'd argue the opposite: an agent that searches well still has to branch its queries and fuse what comes back, and it still has to plan a sequence of retrieval steps. Those are exactly the two things I patented, divergent retrieval (RAG Fusion) and sequential planning (SeqRAG). The paradigm around them changed; the primitives didn't. If anything, agentic search is where they finally get used at full strength.

Try It Yourself

RAG Fusion is fully open source and MIT licensed. The evaluation harness lets you benchmark different retrieval strategies on a real dataset with a single command. There is also a four-minute video on the latest reranker experiments.