research: witness-chained retrieval receipts on a real multi-layer HNSW index - #935
research: witness-chained retrieval receipts on a real multi-layer HNSW index#935ruvnet wants to merge 4 commits into
Conversation
Adds ruvector-hnsw-receipt, composing ruvector-retrieval-receipt's witness-chained receipt cryptography (reused unmodified) on top of ruvector-hnsw-repair's real multi-layer HNSW graph, instead of the brute-force index the original crate deliberately uses to isolate provenance cost from ANN recall. This closes the gap ADR-304 and the 2026-08-13-retrieval-receipts nightly report explicitly left open: receipt overhead had only been measured against an artificially expensive baseline. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016FYgXb2Hcq2rYHcLDqx4cx
Real benchmark evidence (two scales + timing-variance repeat) showing Merkle receipt-build overhead of 1.3-4.7% of raw HNSW search p50 latency, shrinking as index size grows, with 100% verify_full success across 600 sampled queries. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016FYgXb2Hcq2rYHcLDqx4cx
Follow-up to ADR-304, closing its own named rejection-criteria gap with real measurement against a multi-layer HNSW index. INDEX.md regenerated via the canonical scripts/adr-index.mjs generator. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016FYgXb2Hcq2rYHcLDqx4cx
Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016FYgXb2Hcq2rYHcLDqx4cx
|
Portfolio review verdict: INCONCLUSIVE. The frozen receipt-overhead hypothesis is well supported by the recorded benchmarks, and the research-nightly, security, clippy, native-module, regression, and supply-chain jobs passed. The repository-wide promotion gate is not complete because The experiment may be accepted after that cancelled shard passes on the exact head commit. Keep the production recommendation separate: recall@10 of 0.31 to 0.58 on a research-focused graph with a known metric mismatch is not a production integration result. Promotion should remain opt-in research until the same receipt path is measured on the primary production index with the metric aligned and a predeclared recall floor, preferably at N at least 100,000. |
Hypothesis
ruvector-retrieval-receipt(ADR-304, 2026-08-13 nightly) proved witness-chainedprovenance receipts detect 100% of tested tampering on ANN results, but
deliberately measured overhead against a brute-force index to isolate the
provenance layer's cost from ANN recall. Both that report and ADR-304's own
Rejection Criteria explicitly flagged the open question: does the overhead
ratio hold up against a real approximate index?
Architecture
New crate
ruvector-hnsw-receiptcomposes three existing crates —ruvector-proof-gate(write provenance),ruvector-retrieval-receipt(receipt cryptography, reused unmodified via dependency, zero new crypto
code), and
ruvector-hnsw-repair(a real from-scratch multi-layer HNSWgraph) — without modifying any of them.
flowchart LR V[vectors] --> GATE[HashChainGate::admit] --> WR[WriteReceipt] V --> HNSW[HnswGraph::insert] Q[query] --> SEARCH["HnswGraph::search\n(real multi-layer ANN)"] SEARCH --> ITEMS["ResultItem\nscore + write_receipt"] WR -.-> ITEMS ITEMS --> BUILD["RetrievalReceipt::build\n(PerResult | Merkle, unmodified)"] BUILD --> VERIFY[verify_full — offline]Files changed
crates/ruvector-hnsw-receipt/— new crate:HnswReceiptIndex(
search_raw,search_items,brute_force_topk), 6 unit tests, releasebenchmark binary.
Cargo.toml/Cargo.lock— workspace member registration.docs/research/nightly/2026-08-26-hnsw-witness-receipts/README.md— fullnightly research report with raw benchmark transcripts.
docs/adr/ADR-340-hnsw-witness-receipts.md— follow-up ADR to ADR-304.docs/adr/INDEX.md— regenerated vianode scripts/adr-index.mjs(alsorefreshed stale "Last commit" dates across the table as an incidental,
correct byproduct of running the canonical generator; not new content).
docs/research/nightly/2026-08-26-hnsw-witness-receipts/gist.md— publictechnical write-up.
Benchmark command
Hardware: 4 logical CPUs, Intel(R) Xeon(R) @ 2.80GHz, Linux 6.18.44-fc-v21.
Toolchain: rustc 1.94.1, cargo 1.94.1.
Real benchmark results (unedited)
Merkle worst-case proof: 160 bytes vs. PerResult's 320 bytes at k=10 (ratio
0.5, matching the brute-force experiment). Overhead shrinks with scale
because receipt-build cost is O(k), flat, while HNSW search cost grows with
graph traversal — the opposite of what a brute-force-only measurement could
show.
Acceptance result
ACCEPT. All three pre-registered conditions pass at both scales:
100% verify_full success, Merkle proof bytes < PerResult proof bytes,
Merkle overhead p50 < 0.50x raw search p50 (measured 0.0135x–0.0466x — also
clears ADR-304's original, tighter 0.15x rejection threshold for this exact
follow-up measurement).
Darwin / Flywheel
Neither
npx ruvector harness darwinnorflywheelCLI was resolvable inthis environment (
npm error could not determine executable to run) —recorded honestly in the nightly report's Capability Discovery table rather
than assumed. No bounded evolution was run; two dataset scales were varied
manually instead.
Security review
No new cryptographic code — the receipt cryptography is reused unmodified
from
ruvector-retrieval-receipt(already reviewed under ADR-304). Nounsafecode, no new external dependencies beyond the crates beingcomposed. Threat model (unsigned commitments, detect post-issuance mutation
only, no write-chain membership proof) is unchanged and stated in full in
the ADR.
Main limitations
needing re-confirmation — not reached here (top item in Next Research).
ranking metric mismatch and untuned
HnswConfigdefaults — explained inthe report, not hidden, and irrelevant to the overhead/verification
claims actually under test.
ruvector-hnsw-repair's research/repair-focused graph,not the workspace's primary production index (
ruvector-core).Production recommendation
Promote to an available, feature-flagged (opt-in) composition alongside
ruvector-agent-memory, following ADR-304's own proposed integration path.Root/receipt signing remains the correct gate before any compliance-grade
claim.
Research document / ADR / gist
docs/research/nightly/2026-08-26-hnsw-witness-receipts/README.mddocs/adr/ADR-340-hnsw-witness-receipts.mddocs/research/nightly/2026-08-26-hnsw-witness-receipts/gist.mdGenerated by Claude Code