CandidateReranker

fun interface CandidateReranker

Reorders the candidates that cleared the similarity threshold, before the guards see them.

It reorders and never rescores. A reranker that changed similarities would change what clears the threshold, and the threshold is the one number a caller calibrated for their own embedding model.

This is not the place for a cross-encoder. A reranker that reads the prompts with a model is exactly what Verifier already is, and putting one here would mean paying for it on candidates the guards were about to reject for free. Rerankers here work on the vectors the search already produced, and cost nothing per lookup beyond arithmetic.

Inheritors

Functions

Link copied to clipboard
abstract fun rerank(query: FloatArray, candidates: List<ScoredEntry>): List<ScoredEntry>

Returns candidates in the order the cache should try them.