Skip to main content

Reranker

@retinue/monorepo


@retinue/monorepo / backend/src / Reranker

Interface: Reranker

Defined in: backend/src/knowledge/retrieval.ts:156

Reorders a fused candidate set — AC-5.

A port, and switchable, because a reranker's value is a claim that has to be provable. A cross-encoder is materially more expensive than the retrieval it reorders, so "we rerank" without a measured contribution is a cost nobody justified. Absent means fusion order stands, which is the honest default.

createExactTermReranker's measured contribution is negative — #219, over 56 documents of technical prose: −5.6 points of success@5, −5.6 of recall, −0.028 MRR, and no latency saving. It promotes chunks containing query terms verbatim, which on prose queries promotes chunks that happen to repeat a common word. Leave it off.

That is a result about that reranker, not about reranking: a cross-encoder is a different mechanism and might well earn its cost. This port is how it would be measured, and docs/26-retrieval-quality.md is the baseline to measure it against.

Properties​

id​

readonly id: string

Defined in: backend/src/knowledge/retrieval.ts:157

Methods​

rerank()​

rerank(input): Promise<readonly RetrievalHit[]>

Defined in: backend/src/knowledge/retrieval.ts:158

Parameters​

input​
candidates​

readonly RetrievalHit[]

limit​

number

query​

string

Returns​

Promise<readonly RetrievalHit[]>