Skip to main content

Crate ruvector_matryoshka

Crate ruvector_matryoshka 

Source
Expand description

Matryoshka-aware coarse-to-fine vector search for RuVector.

Three ANN search variants that trade distance-computation cost against recall:

VariantStagesDistance ops
FullDimSingle HNSW at full dimAll at D dims
TwoStageCoarse HNSW + full-dim rerankTraverse at D1, rerank at D
ThreeStageCoarse → mid → full-dim funnelTraverse D1, filter D2, rerank D

The primary metric is recall@k: fraction of the true top-k (found by brute-force at full dimension) that each variant recovers.

Modules§

dataset
Deterministic synthetic dataset generator simulating Matryoshka embedding structure.
hnsw
Minimal HNSW graph parameterized by a working dimension.

Structs§

FullDimIndex
Standard HNSW search at the full embedding dimension. Baseline for both recall and latency.
MatryoshkaConfig
ThreeStageIndex
Three-stage funnel: coarse_dim → mid_dim filter → full_dim rerank.
TwoStageIndex
Coarse HNSW at coarse_dim, then full-dim rerank of the candidate set.

Traits§

Searcher

Functions§

brute_force_knn
Brute-force exact top-k at full dimension (ground truth).
l2_normalize
L2-normalise a vector in-place.
l2_sq
prefix_project
Return the first dim elements, L2-normalised.
recall_at_k
Recall@k: fraction of ground-truth top-k that appear in the result set.