Skip to main content

Module reranker

Module reranker 

Source
Expand description

Cross-encoder reranker for candidate re-scoring.

A reranker takes a query and a list of candidate documents and re-scores them based on query-document relevance. This implementation uses a deterministic symbolic scoring approach (no neural network required):

  1. Token overlap: Jaccard similarity between query and document tokens.
  2. BM25-style scoring: Term frequency / inverse document frequency.
  3. Phrase bonus: Bonus for multi-word query phrases appearing in the document.
  4. Position bonus: Bonus for matches appearing early in the document.

The final score is a weighted combination of these signals. Candidates are returned sorted by descending score.

Structs§

RerankConfig
Configuration for the reranker.
RerankResult
A single reranked result.

Functions§

rerank
Rerank candidates given a query.
rerank_default
Rerank candidates with default configuration.