Expand description
Probabilistic Routing Test (PRT) for graph-based ANN search.
Estimates angular distance between vectors using random subspace projections in o(d) time, avoiding unnecessary full distance computations during graph traversal. Inspired by the Projection-Augmented Graph (PAG) approach (Lu et al., 2026, arXiv:2603.06660).
§How it works
- Pre-compute k random projection vectors (k << d).
- Project all database vectors into the k-dimensional subspace.
- During search, project the query once, then compare projected distances against a threshold to decide whether to compute the full distance.
- A Test Feedback Buffer (TFB) tightens the threshold across search rounds by tracking the ratio of false positives, recycling wasted computation.
§Usage
ⓘ
use vicinity::prt::ProbabilisticRoutingTest;
let prt = ProbabilisticRoutingTest::new(dimension, 32, Some(42));
prt.project_database(&vectors);
// During search, for each candidate:
let projected_dist = prt.projected_distance(&query_proj, candidate_id);
if projected_dist < threshold {
// Worth computing full distance.
let full_dist = l2_distance(query, candidate_vector);
}Structs§
- Probabilistic
Routing Test - Probabilistic Routing Test state.
- Test
Feedback Buffer - Test Feedback Buffer for adaptive threshold tightening.