Rerank with RRF (Reciprocal Rank Fusion) Β
RerankRRF is a powerful technique for combining multiple ranked lists without requiring score calibration. Itβs particularly effective for hybrid search scenarios where you want to merge results from different search methods like vector search and BM25 keyword search.When using the SDKs or curling the endpoint, the query name must match what is defined in the
queries.hx file exactly.How It Works
RRF uses a simple but effective formula to combine rankings:dis a document/resultrank_i(d)is the rank of documentdin the i-th result listkis a constant that controls the impact of ranking differences
- Taking multiple ranked lists of results
- For each item, calculating its RRF score based on its positions across all lists
- Re-ranking items by their combined RRF scores
- Items that appear highly ranked in multiple lists get boosted
When to Use RerankRRF
Use RerankRRF when you want to:- Merge multiple search methods: Combine vector search with BM25, or multiple vector searches with different embeddings
- Avoid score normalization: RRF doesnβt require calibrating or normalizing scores from different search systems
- Boost consensus results: Items that rank highly across multiple search strategies will be prioritized
- Implement hybrid search: Create a unified ranking from complementary search approaches
Parameters
k (optional, default: 60)
Controls how much weight is given to ranking position:- Higher values (e.g., 80-100): Reduce the impact of ranking differences, treat all highly-ranked items more equally
- Lower values (e.g., 20-40): Emphasize top-ranked items more strongly, create sharper distinctions
- Default (60): Provides a balanced approach suitable for most use cases
Start with the default value of 60 and adjust based on your specific data distribution and requirements.
Example 1: Basic reranking with default parameters
Example 2: Custom k parameter for more aggressive reranking
Example 3: Dynamic k parameter from query input
Best Practices
Retrieve Sufficient Candidates
Always fetch more results than you ultimately need to give RRF sufficient candidates to work with:Parameter Tuning
Start with the default k=60 and adjust based on your observations:- If results seem too similar, try a lower k (30-40) to emphasize top rankings
- If you want more variety, try a higher k (80-100) to flatten differences
- Test with real queries and evaluate result quality
Combining with Other Operations
RRF works well with filtering and other result operations:Performance Considerations
RRF is computationally efficient with O(n) complexity, making it suitable for real-time applications. However:- Larger candidate sets require more processing
- Balance result quality with query latency
- Consider caching frequently-accessed results
Use Cases
E-commerce Product Search
Combine text search with visual similarity for product discovery:Document Retrieval
Merge semantic search with keyword matching for comprehensive document retrieval:Content Recommendation
Blend multiple recommendation signals (user preferences, popularity, recency):Related
- RerankMMR - For diversifying search results
- Vector Search - Basic vector search operations
- Result Operations - Other result manipulation operations