Skip to main content

Crate frankensearch_rerank

Crate frankensearch_rerank 

Source
Expand description

FlashRank cross-encoder reranking for frankensearch.

Provides the FlashRankReranker implementation of the Reranker trait, using ONNX Runtime for cross-encoder scoring with sigmoid activation on raw logits. Gracefully falls back to original scores if the model is unavailable.

§Model Layout

Required files in the model directory:

  • onnx/model.onnx (preferred) OR model.onnx (legacy)
  • tokenizer.json

§Architecture

Cross-encoders differ from bi-encoders: instead of comparing pre-computed embeddings, they process the query and document together through a transformer, producing direct token-level attention between them. This is dramatically more accurate but cannot pre-compute anything.

(query, document) → tokenize → ONNX → logit → sigmoid → score ∈ [0, 1]

Re-exports§

pub use pipeline::DEFAULT_MIN_CANDIDATES;
pub use pipeline::DEFAULT_TOP_K_RERANK;
pub use pipeline::rerank_step;

Modules§

pipeline
Rerank pipeline step: integrates cross-encoder reranking into the search pipeline.

Structs§

FlashRankReranker
FlashRank cross-encoder reranker backed by ONNX Runtime.

Constants§

DEFAULT_MAX_LENGTH
Default maximum input token length for cross-encoder pairs.
DEFAULT_MODEL_NAME
Default model directory name for the FlashRank nano cross-encoder.

Functions§

find_model_dir
Search for a FlashRank model directory in standard locations.