Skip to main content

Module normalize

Module normalize 

Expand description

Score normalization helpers for recall candidates.

Recall fuses two score sources with incompatible scales: cosine similarity (bounded to [0, 1]) and FTS5 BM25 (unbounded, negated to higher-is-better at the search site). When both sources return rows, vector::hybrid_merge already normalizes the keyword batch internally; this module covers the keyword-only case so downstream consumers (the injection relevance floor in particular) always see scores on the same [0, 1] axis whenever the vector stage is live.

Functionsยง

bm25_to_unit
Normalize a batch of raw BM25-style scores to a bounded [0, 1] axis.