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):
- Token overlap: Jaccard similarity between query and document tokens.
- BM25-style scoring: Term frequency / inverse document frequency.
- Phrase bonus: Bonus for multi-word query phrases appearing in the document.
- 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§
- Rerank
Config - Configuration for the reranker.
- Rerank
Result - A single reranked result.
Functions§
- rerank
- Rerank candidates given a query.
- rerank_
default - Rerank candidates with default configuration.