Skip to main content

Reciprocal Rank Fusion (RRF) in Graph RAG Systems

Learn how Reciprocal Rank Fusion (RRF) combines dense vector embeddings with graph topology scores to power state-of-the-art enterprise AI search systems.

Reciprocal Rank Fusion (RRF) in Graph RAG Systems

Reciprocal Rank Fusion (RRF) in Enterprise RAG Systems: Search Engineering Guide

In enterprise search engineering, retrieving accurate context for Large Language Models (LLMs) requires evaluating multiple retrieval systems simultaneously—including dense vector similarity (ANN), BM25 keyword retrieval, and graph database topology traversals.

However, each retrieval system outputs relevance scores on different non-comparable scales (e.g., cosine similarity produces scores between 0.0 and 1.0, BM25 produces unbounded positive scores, and graph centrality produces topological distance metrics).

How do search engineers combine these disparate rankings into a single, unified context priority queue?

The industry standard algorithm is Reciprocal Rank Fusion (RRF).

In this deep search engineering guide, we explore the mathematical formulation, algorithmic implementation, and hyperparameter tuning of RRF in enterprise Graph RAG systems.


💡Key Insight

Why RRF Supercedes Score Normalization: Standard min-max score normalization fails when combining vector distance and graph centrality because score distributions fluctuate per query. RRF evaluates relative rank positions instead of raw scores, producing robust, query-agnostic candidate rankings.


1. Mathematical Formulation of Reciprocal Rank Fusion

Reciprocal Rank Fusion calculates an aggregated score for a document or knowledge node d across a set of retrieval systems M:

CODE
RRF_Score(d) = sum( 1 / ( k + r_m(d) ) )

Where:

  • M is the set of rankers (e.g., Vector Search, BM25 Keyword Search, Graph Traversal).
  • r_m(d) is the 1-indexed rank position of document/node d in ranker m. If node d is not present in ranker m's top results, r_m(d) is treated as infinity (1 / inf = 0).
  • k is a smoothing constant (k = 60 is the commonly used default).

2. Python Implementation of RRF Fusion

PYTHON
from typing import List, Dict

def reciprocal_rank_fusion(results_list: List[List[str]], k: int = 60) -> List[tuple]:
    """
    Executes Reciprocal Rank Fusion over multiple ranked candidate lists.
    :param results_list: List of ranked candidate node IDs from different rankers.
    :param k: RRF smoothing constant (default 60).
    :return: Sorted list of tuples (node_id, rrf_score).
    """
    rrf_scores: Dict[str, float] = {}

    for ranker_results in results_list:
        for rank, node_id in enumerate(ranker_results, start=1):
            if node_id not in rrf_scores:
                rrf_scores[node_id] = 0.0
            rrf_scores[node_id] += 1.0 / (k + rank)

    # Sort nodes by descending RRF score
    sorted_nodes = sorted(rrf_scores.items(), key=lambda item: item[1], reverse=True)
    return sorted_nodes

# Example Execution:
vector_ranker = ["node_PR_412", "node_SLACK_90", "node_DOC_12"]
graph_ranker  = ["node_SLACK_90", "node_PR_412", "node_JIRA_80"]

fused_ranking = reciprocal_rank_fusion([vector_ranker, graph_ranker])
# Node "node_PR_412" and "node_SLACK_90" receive the highest combined RRF scores

3. Why RRF Suits Graph RAG Retrieval

  1. Parameter-Free Robustness: RRF requires zero training data or manual weight tuning across different SaaS data types (Slack chats, code diffs, Jira tickets).
  2. Outlier Resilience: If a noisy vector match ranks a document #1, but graph traversal ranks it #100, RRF prevents the noisy chunk from dominating the prompt context window.
  3. Negligible Scoring Overhead: RRF is a simple sum over rank positions, so it adds very little work to the retrieval pipeline.

Explore Hybrid Search Architecture and Graph RAG vs Vector RAG.


Essential Organizational Memory & AI Architecture

Explore Memora's foundational guides on Graph RAG, persistent AI memory, and automated knowledge discovery:

⚡ Token Cost & Savings Calculator →
Calculate 1M token context window waste vs Graph RAG
What is Organizational Memory? →
The complete enterprise context framework
Top 7 Glean Alternatives (2026) →
Compare enterprise AI search & Graph RAG platforms
MPC vs MCP in AI Explained →
Multi-Party Computation vs Model Context Protocol
LLM Memory Management Guide →
4-tier memory hierarchy for autonomous coding agents
Slack & Jira KM Automation →
Capture decisions passively with zero workflow friction
Model Context Protocol (MCP) Hub →
Connecting IDEs & AI agents to enterprise memory
Knowledge Loss ROI Calculator →
Calculate annual engineering context loss costs
MCP Server Security & CISO Guide →
Prevent prompt injection & tool privilege escalation
AI Screen Memory & Ambient Context →
Privacy-first local OCR capture for enterprise teams
Corporate Memory Glossary Definition →
Explicit vs tacit context & corporate amnesia prevention
Quick Knowledge Check

Why do standard vector search systems fail on complex technical context?

Was this article helpful?