Expand description
Pure scoring/transform kernels over SparseVector. No graph/runtime
dependencies — this is the analogue of uni-btic’s interval math, kept in
the type crate so every layer (index, rerank, brute-force oracle) calls one
canonical implementation.
Functions§
- l2_norm
- Euclidean (L2) norm of the weights.
- prune_
top_ k - Keep only the
kterms with the largest absolute weight, preserving the ascending-index invariant. This is the universal query-side latency lever for learned-sparse retrieval — high-DF / low-weight query terms dominate the posting-scan cost, so dropping them trades a little recall for large speedups. - sparse_
dot - Dot product of two sparse vectors via a linear merge-join over their (ascending) term ids. This is the SPLADE/learned-sparse scoring primitive and the exact ground truth a brute-force oracle uses.