Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/memory / / fuseWeighted
Function: fuseWeighted()
function fuseWeighted<TRecord>(
lists,
weights,
k): readonly MemoryHit<TRecord>[];Defined in: packages/memory/src/search/rrf.ts:147
Weighted / convex generalization of fuseRrf (X-2). Each input list i contributes weights[i] · 1 / (k + rank) to a record's fused score instead of the flat 1 / (k + rank), so a caller who has calibrated list reliability against labels (the P0-1 eval harness) can trust one retriever over another. RRF stays the zero-tuning default: a weights of undefined (or all-1) is byte-for-byte identical to fuseRrf. A missing, non-finite, or negative entry falls back to the neutral weight 1, so a partial / malformed weights never throws or poisons the ranking.
Like fuseRrf the fusion is deterministic, tie-broken by first-seen order, and preserves any upstream signals (FTS bm25, vector similarity) the hits carried in — the rrf / rrf.list_N signals it records are the weighted contributions, so the fused score still equals their sum. Note that — unlike RRF — the result depends on input list order, because each weight is bound to a list position.
Type Parameters
| Type Parameter |
|---|
TRecord extends MemoryRecord |
Parameters
| Parameter | Type |
|---|---|
lists | readonly readonly MemoryHit<TRecord>[][] |
weights | readonly number[] | undefined |
k | number |
Returns
readonly MemoryHit<TRecord>[]