retrieval.fusion¶
Reciprocal Rank Fusion for combining multiple ranked lists.
Reciprocal Rank Fusion for combining multiple ranked lists.
candidate_pool(top_k, n_units=None)
¶
Return the per-retriever candidate-pool depth for a top_k query.
min(max(top_k * POOL_MULTIPLIER, POOL_FLOOR), n_units) — deep enough
for RRF to have real overlap to fuse, but never deeper than the corpus
itself when n_units (the retriever's own indexed unit count) is known.
n_units=None (the default) skips that cap.
Source code in engine/retrieval/fusion.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
reciprocal_rank_fusion(rankings, k=60, weights=None)
¶
Fuse multiple ranked lists using (optionally weighted) Reciprocal Rank Fusion (RRF).
Parameters¶
rankings :
Each inner list is an ordered list of document indices (best first).
Rank is 0-based within each list.
k :
Constant that dampens the impact of high ranks (default 60).
weights :
Optional per-ranking weight, same length/order as rankings; each
ranking's contribution becomes weight * 1 / (k + rank + 1).
None (the default) weights every ranking 1.0, which is
numerically identical to the unweighted fusion.
Returns¶
List of (doc_idx, fused_score) sorted by fused_score descending.
Source code in engine/retrieval/fusion.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |