Skip to content

research(nightly): adaptive-recall-ann — automatic ef calibration for recall-targeted ANN search#718

Draft
ruvnet wants to merge 5 commits into
mainfrom
research/nightly/2026-07-23-adaptive-recall-ann
Draft

research(nightly): adaptive-recall-ann — automatic ef calibration for recall-targeted ANN search#718
ruvnet wants to merge 5 commits into
mainfrom
research/nightly/2026-07-23-adaptive-recall-ann

Conversation

@ruvnet

@ruvnet ruvnet commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds crates/ruvector-adaptive-ann: a Rust PoC that replaces the manual ef_search parameter 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.

  • Core trait: RecallTargetedSearch::search_with_target(query, k, recall_target)
  • Three variants: FixedEfSearch (baseline), BinarySearchCalibrated (oracle), TableCalibratedSearch (production)
  • ADR-272 documents the design decision, failure modes, migration path
  • Research doc: docs/research/nightly/2026-07-23-adaptive-recall-ann/README.md
  • Public gist: docs/research/nightly/2026-07-23-adaptive-recall-ann/gist.md

Benchmark results (x86_64 Linux, release, N=3000 × D=64, recall_target=0.90)

Variant Recall@10 Mean µs p95 µs QPS
FixedEf(64) — baseline 0.778 105.3 130.4 9,497
BinarySearchCalibrated 0.902 1,355.0 2,094.8 738
TableCalibrated 0.940 227.8 267.7 4,390

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 Calibrator struct.

Includes

  1. Working Rust PoC (crates/ruvector-adaptive-ann)
  2. ADR (docs/adr/ADR-272-adaptive-recall-ann.md)
  3. Research document (docs/research/nightly/2026-07-23-adaptive-recall-ann/README.md)
  4. Public gist (docs/research/nightly/2026-07-23-adaptive-recall-ann/gist.md)
  5. Real benchmark results (all acceptance tests PASSED)

Ecosystem connections

  • Agent memory: recall_target=0.95 in MCP ruvector_search tool
  • Edge/WASM: CalibrationTable is 80–8KB; ships in RVF manifest
  • ruFlo: per-step recall budgets with drift monitoring
  • Proof-gated recall: future witness log for cryptographic recall evidence
  • Composable with ruvector-coherence-hnsw (Phase 2)

Generated by Claude Code

claude added 5 commits July 23, 2026 07:30
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants