RAG-Fusion
A retrieval-augmented generation technique and evaluation harness that rewrites a query into several variants, searches each with both keyword and vector search, and merges the ranked results with Reciprocal Rank Fusion.
RAG-Fusion extends retrieval-augmented generation by generating several rewrites of a user's query from different angles, synonyms, narrower or broader framings, related sub-topics, then searching the original query and every rewrite with both BM25 keyword search and vector search. The resulting ranked lists are merged with Reciprocal Rank Fusion, where each document scores 1 divided by 60 plus its rank, summed across every list, aiming to surface material that a single phrasing of the query would miss.
The repository includes an evaluation harness built on NFCorpus and BEIR. Experiments included with the project compare fusion variants and rerankers, finding that a hybrid configuration, BM25 plus vector search for the original query and rewrites, fused with RRF, then reranked, reliably improves retrieval after reranking, with the largest gain from the strongest reranker tested.