Reciprocal rank fusion
Reciprocal rank fusion is a rank-aggregation technique that combines ranked lists by summing reciprocal-rank contributions for each item across the lists.
Retrieval Augmented Generation, The Foundational Ideas
Rank fusion is a retrieval technique that combines ranked result lists from multiple searches into a single ranking.
- How it is used
- Merges ranked search results before RAG context selection to improve coverage beyond a single query.
- How deep it goes
- Works through the reciprocal-rank formula and Python implementation, then identifies score loss and k sensitivity.
- Examples
- Uses a Python fusion function and a simulated winter-clothing search to show how repeated appearances change the ranking.
- What you can do after
- Build it from scratch using ranked document IDs, or apply it within a multi-query RAG retrieval pipeline.
Read how Retrieval Augmented Generation, The Foundational Ideas explains reciprocal rank fusion →
Designing AI Systems
Reciprocal rank fusion is a rank-aggregation algorithm that combines result lists using the reciprocal positions of items rather than their scores.
- How it is used
- Combines vector and keyword retrieval into one ranked result list for hybrid search services.
- How deep it goes
- Defines the reciprocal-rank formula, explains its rationale, and applies it in orchestration without training or score normalization internals.
- Examples
- Uses parallel vector and PostgreSQL keyword searches, doubled candidate retrieval, and a fused SearchResult list.
- What you can do after
- Apply it via hybrid_search to merge vector and keyword results without tuning score scales.
Read how Designing AI Systems explains reciprocal rank fusion →
AI Agents and Applications
Reciprocal Rank Fusion is a result-merging method that scores documents by summing reciprocal rank contributions across multiple ranked lists.
- How it is used
- Improves RAG retrieval when multiple query formulations or heterogeneous retrieval methods produce complementary ranked lists.
- How deep it goes
- Explains the scoring formula, cumulative reranking, Python implementation, LangChain composition, and final prompt integration.
- Examples
- Demonstrates five query variations, vector-store retrieval, top-three selection, and a Brighton travel question answered through a RAG chain.
- What you can do after
- Build RAG fusion with LangChain by generating queries, retrieving results, applying RRF, selecting top documents, and synthesizing an answer.
Read how AI Agents and Applications explains reciprocal rank fusion →
AI-Powered Search
Reciprocal rank fusion is a rank-based result-combination algorithm that merges rankings from multiple retrieval systems using reciprocal-rank contributions.
- How it is used
- Combines lexical and vector retrieval results into a hybrid ranking.
- How deep it goes
- Explains the scoring loop, aggregation, sorting, and k trade-off, while stopping short of formal evaluation.
- Examples
- Uses the queries "singin' in the rain" and "the hobbit" with lexical, vector, and hybrid result comparisons.
- What you can do after
- Apply it via a Python function or hybrid-search API to merge ranked retrieval results.
Read how AI-Powered Search explains reciprocal rank fusion →
LLM Evaluation and Alignment, The Foundational Ideas
Reciprocal Rank Fusion combines ranked result lists by assigning each result a score based on the reciprocal of its rank in each list.
- How it is used
- Combines sparse and dense retrieval rankings to improve robustness across lexical and semantic search failures.
- How deep it goes
- Defines reciprocal-rank scoring and explains deployment rationale, but does not provide implementation pseudocode or parameter guidance.
- Examples
- Uses product SKUs, error codes, legal citations, paraphrases, and conceptual queries to contrast retrieval strengths.
- What you can do after
- Apply it via hybrid retrieval to cover complementary sparse and dense failure modes, then diagnose results with ranking metrics.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains reciprocal rank fusion →
AI Agents in Action, Second Edition
Reciprocal rank fusion combines ranked result lists by summing the reciprocal of each result's rank offset across the lists.
- How it is used
- Combines vector and keyword result lists into ranked context for hybrid search and retrieval-augmented agents.
- How deep it goes
- Defines the rank-only formula, explains its score-independence, and stops short of implementation code for the fusion function.
- Examples
- Uses parallel vector and keyword result lists, a typical constant of 60, and an agent selecting separate search tools.
- What you can do after
- Apply it via hybrid search to merge incompatible ranked outputs into grounded, comprehensive retrieval context.
Read how AI Agents in Action, Second Edition explains reciprocal rank fusion →
Also covered in
- Context EngineeringIn early access (MEAP)
- Agent Design PatternsIn early access (MEAP)
- Designing AI AgentsIn early access (MEAP)
What to know first
- BM25BM25 is a probabilistic information-retrieval ranking function that scores documents for a query using term frequency, inverse document frequency, and document-length normalization.
- lexical searchLexical search retrieves or ranks items by matching query terms or other surface-text features against indexed content, often using sparse representations and statistical weighting.
- retrieval-augmented generationRetrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
- vector databaseA vector database is a data-management system that stores and indexes numerical vector representations and supports retrieval through similarity or distance searches.
Related concepts
- retrieval rankinguses · Retrieval ranking is the ordering of candidate items according to their estimated relevance to a query.
- hybrid searchused by · Hybrid search is an information-retrieval technique that combines multiple retrieval methods or relevance signals to find or rank relevant results.
- lexical searchuses · Lexical search retrieves or ranks items by matching query terms or other surface-text features against indexed content, often using sparse representations and statistical weighting.
- fusion ragused by · Fusion RAG is a retrieval-augmented generation pattern that retrieves information through multiple queries, retrievers, or sources and combines their ranked results before generation.
- similarity searchuses · Similarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- query rewritinguses · Query rewriting is the transformation of a query into an alternative formulation intended to better support its execution or retrieval while preserving its intended meaning or behavior.
Questions about reciprocal rank fusion
What is reciprocal rank fusion?
Reciprocal rank fusion is a rank-aggregation technique that combines ranked lists by summing reciprocal-rank contributions for each item across the lists.
Which Manning books explain reciprocal rank fusion?
Retrieval Augmented Generation, The Foundational Ideas, Designing AI Systems, AI Agents and Applications, AI-Powered Search, LLM Evaluation and Alignment, The Foundational Ideas and AI Agents in Action, Second Edition.
What should I know before learning reciprocal rank fusion?
Manning books that teach reciprocal rank fusion usually introduce BM25, lexical search, retrieval-augmented generation and vector database first.
What is reciprocal rank fusion also called?
Reciprocal rank fusion is also called RRF.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





