RAG-Fusion
Reciprocal Rank Fusion. The state-of-the-art for robustness.
1. More than Multi-Query
Multi-Query just combines results (Union). RAG-Fusion combines results AND re-ranks them based on consensus.
If Doc A appears in the results for Query 1, Query 2, AND Query 3... it is highly likely to be the correct answer. If Doc B only appears for Query 1... it is likely noise.
2. The Reciprocal Rank Fusion (RRF) Algorithm
It is a mathematical way to sort items by "Consensus."
Score(Doc) = 1 / (Rank in List 1 + k) + 1 / (Rank in List 2 + k) ...
You don't need to understand the math. You need to understand the intuition: "If multiple different search strategies agree that this document is important, it bubbles to the top."
3. The Workflow
- Generate 5 variations of the query.
- Parallel Search (5x calls).
- Apply RRF to merge the 5 lists into 1 master list.
- Pass Top-K from master list to LLM.
4. Summary
RAG-Fusion helps fix the "Single Point of Failure" in retrieval. It is more expensive (5x vector search calls), but significantly more robust.
Key Intuition: "Trust the consensus of multiple perspectives."