Skip to main content

Module ranking

Module ranking 

Source
Expand description

Deterministic retrieval rankers: cosine similarity, lexical BM25, reciprocal-rank fusion, and structural graph boosting.

Every function here is pure and parameter-pinned, and none of them calls a model — embedding vectors come from the caller. Because the parameters are fixed and versioned by RANKING_VERSION, two runs over the same inputs produce the same ranking, which makes these rankings measurable against a fixture set before you let them influence anything.

Structs§

Bm25Index
BM25 index over a fixed corpus.
CosineSpec
Identity a caller must present before mixing two embedding vectors.
EvidenceLink
One evidence fragment for production adjacency extraction.

Enums§

RankingError
Why a cosine comparison cannot be trusted.

Constants§

ADJACENCY_KIND
Production graph features: file spans and split siblings, not fixture pairs.
RANKING_FIXTURE_SET
Identity of the retrieval fixture set this ranking is measured against.
RANKING_VERSION
Identifies the pinned ranking parameters, so a measured result can be attributed to the exact algorithm that produced it.

Functions§

build_adjacency
Symmetric adjacency over corpus indices from declared related pairs; malformed or unknown entries are ignored.
cosine_checked
Same as cosine_similarity, with digest and unit-norm checks.
cosine_similarity
Cosine similarity computed in f64; zero vectors compare as 0.
evidence_adjacency
Structural pairs from evidence: split siblings and the same source file.
graph_boost
Re-rank a fused ranking with a structural neighbor lift in rank space: a document related to one of the fused top-GRAPH_TOP_M documents is treated as ranked GRAPH_RANK_PENALTY behind its best benefactor. It can overtake unrelated mid-ranked documents but never the benefactor itself.
parent_id
WX-VERIFY-2 → WX-VERIFY; ids without a trailing -<digits> stay as-is.
rank_by_similarity
Corpus indices ranked by descending similarity; ties break by index for determinism.
rank_hybrid_graph
The hybrid_graph pipeline: cosine + BM25 RRF, then structural boost.
rrf_fuse
Reciprocal-rank fusion of several rankings over the same corpus.
tokenize
Lowercased alphanumeric tokens.