research(nightly): adaptive-recall-ann — automatic ef calibration for recall-targeted ANN search#718
Draft
ruvnet wants to merge 5 commits into
Draft
research(nightly): adaptive-recall-ann — automatic ef calibration for recall-targeted ANN search#718ruvnet wants to merge 5 commits into
ruvnet wants to merge 5 commits into
Conversation
Identifies adaptive recall-targeted ANN as the 2026-07-23 nightly topic. Connects vector search, agent memory, edge AI, MCP tool latency SLAs, and ruFlo workflow recall budgets. No prior nightly covered this angle.
Implements RecallTargetedSearch trait with three variants: - FixedEfSearch (baseline): constant ef=64, ignore recall target - BinarySearchCalibrated: binary-search ef per query with ground truth - TableCalibratedSearch: O(1) ef lookup from offline calibration table Core insight: calibration queries must match production query distribution. CalibrationTable is a monotone ef→recall mapping from 50-100 held-out queries. Benchmark: N=3000×D=64, recall_target=0.90 - FixedEf(64): 0.778 recall, 9,497 QPS (misses target) - BinarySearch: 0.902 recall, 738 QPS (oracle, 13x slower) - TableCalibrated: 0.940 recall, 4,390 QPS (exceeds target, O(1) ef)
- beam search at ef=N achieves near-perfect recall - recall is monotone in ef - FixedEf(128) achieves minimum recall threshold - CalibrationTable returns valid ef - TableCalibratedSearch achieves recall within distribution-mismatch tolerance - BinarySearchCalibrated achieves per-query target on 12/15 queries - effective_ef_for_target returns Some for Table, None for Fixed All 7 tests pass.
Documents the calibration table approach, distribution matching constraint, three implementation variants, benchmark evidence, failure modes, security considerations, and migration path for adopting recall-targeted search. ADR-272 status: Proposed.
cargo run --release -p ruvector-adaptive-ann --bin benchmark x86_64 Linux, release build, N=3000 D=64 300 queries FixedEf(64): recall=0.778, mean=105.3µs, QPS=9497 BinarySearch: recall=0.902, mean=1355µs, QPS=738 TableCalibrated: recall=0.940, mean=227.8µs, QPS=4390 All acceptance tests PASSED.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
crates/ruvector-adaptive-ann: a Rust PoC that replaces the manualef_searchparameter in HNSW/proximity-graph ANN with a user-declared recall target (e.g.0.90). The system automatically selects the minimum beam width that achieves the target via an offline calibration table.RecallTargetedSearch::search_with_target(query, k, recall_target)FixedEfSearch(baseline),BinarySearchCalibrated(oracle),TableCalibratedSearch(production)docs/research/nightly/2026-07-23-adaptive-recall-ann/README.mddocs/research/nightly/2026-07-23-adaptive-recall-ann/gist.mdBenchmark results (x86_64 Linux, release, N=3000 × D=64, recall_target=0.90)
All 4 acceptance tests passed. 7 integration tests pass.
Key finding: Calibration queries must come from the same distribution as production queries. Calibrating on graph-member vectors over-estimates recall for out-of-distribution queries by a factor of 5× in ef. The API enforces this via the
Calibratorstruct.Includes
crates/ruvector-adaptive-ann)docs/adr/ADR-272-adaptive-recall-ann.md)docs/research/nightly/2026-07-23-adaptive-recall-ann/README.md)docs/research/nightly/2026-07-23-adaptive-recall-ann/gist.md)Ecosystem connections
recall_target=0.95in MCPruvector_searchtoolruvector-coherence-hnsw(Phase 2)Generated by Claude Code