Foresight.Recall.RRF (Foresight v0.1.0)

Copy Markdown View Source

Rank/score fusion across recall arms. Three modes (D1), selected by :fusion:

  • :rrf (DEFAULT) — classic reciprocal-rank fusion: score = Σ 1/(k+rank). Uses rank only, so it is robust but blind to the gap between rank 1 and rank 2 and to each arm's score magnitude.
  • :normalized — per-arm normalized native scores (min-max or z-score), summed with optional per-arm :weights, times an explicit multi-arm convergence bonus. Captures within-arm magnitude and makes arms comparable — beating RRF's rank-only view.
  • :hybridrrf_score + :hybrid_alpha * normalized_score, times the convergence bonus. Keeps RRF's robustness and adds calibrated magnitude.

The convergence bonus (:convergence_bonus β, default 0.1) makes multi-arm agreement an explicit score term (1 + β·(arms-1)), not just a tiebreak. Per-arm :weights (default 1.0 each) are the surface a learned per-bank tuner (D2) optimizes. :rrf output is byte-for-byte the pre-D1 behaviour: no extra fields, same ordering.

Summary

Functions

fuse(strategy_results, opts \\ [])

@spec fuse(
  map(),
  keyword()
) :: [map()]