rag-fusion
RAG-Fusion is a Python library that improves retrieval-augmented generation (RAG) by generating multiple query variations and combining their search results using a ranking algorithm called Reciprocal Rank Fusion. It's designed to surface relevant documents that a single query phrasing might miss, particularly when user vocabulary differs from indexed text.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | Raudaschl/rag-fusion |
| Owner | Raudaschl |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 946 |
| Forks | 113 |
| Open issues | 0 |
| Latest release | Unknown |
| Last updated | 2026-04-26 |
| Source | https://github.com/Raudaschl/rag-fusion |
What rag-fusion is
RAG-Fusion implements multi-query generation via LLM (OpenAI), parallel vector search (ChromaDB), and Reciprocal Rank Fusion re-ranking, with optional hybrid BM25+vector fusion and cross-encoder reranking. The repository includes an evaluation harness with NFCorpus/BEIR benchmarks, paired-bootstrap confidence intervals, and empirical comparison across six retrieval variants.
Get the rag-fusion source
Clone the repository and explore it locally.
git clone https://github.com/Raudaschl/rag-fusion.gitcd rag-fusion# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires active OpenAI API key and account; multi-query generation and LLM-judged evaluation incur token costs that scale with corpus and query volume.
- Hybrid+Diverse variant (BM25 + vector + LLM rewrites + cross-encoder) produces measurable improvements but requires BM25 index setup and optional reranker model integration.
- Vector search relies on ChromaDB and `all-MiniLM-L6-v2` embedding by default; consider embedding model choice and ChromaDB configuration for production scale.
- Evaluation harness uses NFCorpus (3.6k docs); validate empirical lifts on your own domain and corpus size before production deployment.
- README explicitly cautions that vector-only fusion is 'roughly a wash' and 'net-negative on rich queries'; deploy hybrid variant if deploying fusion at all.
When to avoid it — and what to weigh
- Sub-Second Latency Requirements — Multi-query generation and fusion add sequential LLM calls and multiple vector searches. Not suitable for voice interfaces, autocomplete, or sub-second p95 response targets.
- FAQ Chatbots and Curated Knowledge Bases — Pre-curated, small, high-precision knowledge bases benefit little from fusion; baseline retrieval often suffices. The added recall can introduce off-topic results that complicate synthesis.
- High-Margin, High-Volume Consumer Search — Increased API calls (LLM query generation, multiple searches) raise per-query cost. Not cost-effective for margin-thin, latency-sensitive consumer applications.
- Code Search and Identifier Lookup — Precision-dominated task where exact matches matter. Multi-query fusion can dilute relevance and introduce false positives on structured identifiers.
License & commercial use
MIT License. Permissive OSI-approved license allowing commercial use, modification, and distribution with minimal restrictions (attribution and license inclusion required).
MIT license permits commercial use without royalty or proprietary restriction. However, production deployment requires OpenAI API keys (paid service) and optional cross-encoder models (open-source or commercial). License does not cover third-party service terms or data governance; review OpenAI ToS and data privacy regulations separately.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
Requires OpenAI API key storage (use environment variables, never hardcode). ChromaDB persistence and query caching write to disk; ensure directory permissions and filesystem security. No security audit or vulnerability disclosure process mentioned. Inputs to LLM (user queries) and outputs (generated rewrites) should be validated if exposed to untrusted users. Third-party dependencies (chromadb, openai, rank_bm25) should be kept updated.
Alternatives to consider
Langchain + LangGraph multi-query retrieval
Framework-based abstraction over multi-query fusion; larger ecosystem but less empirical validation on retrieval metrics; requires additional dependency management.
LlamaIndex query transformation and re-ranking
Higher-level RAG orchestration with built-in multi-query strategies; less control over fusion algorithm; different cost/latency profile depending on model choice.
Elasticsearch + BM25 semantic-rerank hybrid
Production-scale hybrid retrieval without LLM query generation; lower latency and API costs; requires Elasticsearch infrastructure; misses multi-perspective query coverage.
Build on rag-fusion with DEV.co software developers
Start with the evaluation harness to validate retrieval improvements on your domain. Use the Hybrid+Diverse variant with cross-encoder reranking for production. Review cost and latency analysis in the experiments folder before scaling.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
rag-fusion FAQ
Does RAG-Fusion always improve results?
What's the cost and latency impact?
Can I use this without OpenAI?
How do I validate this works on my data?
Software developers & web developers for hire
From first prototype to production, DEV.co delivers software development services around tools like rag-fusion. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across vector databases and beyond.
Ready to Deploy RAG-Fusion?
Start with the evaluation harness to validate retrieval improvements on your domain. Use the Hybrid+Diverse variant with cross-encoder reranking for production. Review cost and latency analysis in the experiments folder before scaling.