Expand description
Cross-encoder re-ranker for embedding search results.
Implements a lightweight simulation of cross-encoder scoring using
token-overlap (Jaccard) similarity. In a production system the score
function would call a transformer model; here it is kept deterministic and
dependency-free for testing purposes.
Structsยง
- Candidate
Pair - A (query, document) pair submitted for re-ranking, together with the initial retrieval score produced by an upstream embedding model.
- Cross
Encoder - Stateful cross-encoder that tracks the total number of pairs scored.
- Cross
Encoder Config - Configuration for a
CrossEncoderinstance. - Rerank
Result - The outcome of re-ranking a single candidate document.