Skip to main content

CrossEncoderReranker

Trait CrossEncoderReranker 

Source
pub trait CrossEncoderReranker: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn max_candidates(&self) -> u32;
    fn rerank(
        &self,
        query: &str,
        candidates: &[RerankCandidate],
    ) -> OrbokResult<Vec<RerankScore>>;
}
Expand description

Cross-encoder reranker contract (RFC-010 §5).

Designed in RFC-010, not implemented: the only prior implementation (MockReranker, below) scored by passage length, which is not reranking, and had no production caller. RFC-060 §8 decided against building a real cross-encoder for now — a second model is a second download and a second forward pass per query, and orbok’s own p99 search-latency gate is unmet by roughly 4x with one model already (RFC-060 §8, Task 040) — so orbok-search’s HybridSearchService wires nothing to this trait (its with_reranker method and the dead call path behind it were deleted in Task 040, along with the known bug that path carried: enrich_many(&fused, limit) truncated to limit before reranking, so even a real reranker could never have reached fusion ranks 21-50 — the exact headroom crates/search/engine/src/hybrid.rs’s Limits::fusion_n = 50 reserves for it).

This trait is kept anyway, as the documented insertion point if a real cross-encoder is ever built: RFC-060 §8’s reopen condition is orbok’s p99 search-latency gate being met with one model. Implementors:

  • Reranking must always be optional; a missing model must not break search.
  • Must not log passage_text (NFR-014).

Required Methods§

Source

fn name(&self) -> &str

Source

fn version(&self) -> &str

Source

fn max_candidates(&self) -> u32

Maximum candidates to rerank (RFC-010 §9 top-N limit).

Source

fn rerank( &self, query: &str, candidates: &[RerankCandidate], ) -> OrbokResult<Vec<RerankScore>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§