Skip to main content

Module rerank

Module rerank 

Expand description

Query-time rerank machinery for recalled memory candidates.

Structs§

RerankConfig
Rerank stage configuration, materialized from canonical memory config. Copy so the engine’s injection config (which embeds one) stays Copy.

Enums§

RerankStrategy
Advanced rerank strategy.

Constants§

MAX_CANDIDATE_POOL
Absolute ceiling on the query-time candidate pool, enforced in run regardless of the configured multiplier or how many entries a backend returns. Bounds the O(n^2) duplicate-collapse and MMR scans against a mis-sized config or a backend that ignores the requested recall limit (for example a no-embedding fallback that returns its whole list).

Functions§

bounded_final_limit
bounded_pool_cap
collapse_exact_and_near_duplicates
Collapse exact and near-duplicate entries, preserving the highest score.
run
Run blend, eligibility filtering, duplicate collapse, optional advanced rerank, threshold, and trim. is_eligible is the caller’s render-eligibility predicate; it is applied before duplicate collapse so an ineligible row cannot shadow an eligible fact with the same content, and before the final trim so it cannot consume a selection slot.