research: witnessed evolution — hash-chained provenance for ANN parameter search - #836
Draft
ruvnet wants to merge 2 commits into
Draft
research: witnessed evolution — hash-chained provenance for ANN parameter search#836ruvnet wants to merge 2 commits into
ruvnet wants to merge 2 commits into
Conversation
…evolutionary ANN parameter search Runs a (1+1)-ES over ruvector-coherence-hnsw's coherence-threshold/ef genome in two variants sharing identical mutation/acceptance logic: one plain, one committing every generation's genome, fitness, and accept/reject decision through ruvector-proof-gate's HashChainGate. WitnessedLineage::replay_verify independently recomputes the entire lineage from the raw genomes and workload and confirms it matches what was committed, catching a single forged fitness byte at the exact generation it was forged. 11 unit/integration tests, clean clippy --all-targets and fmt --check. Release benchmark (3 independent runs): witnessed and unwitnessed runs converge to a bit-identical optimum beating the fixed default by 3.2%; honest lineages replay-verify 100%; tampering is always caught; witnessing overhead is unmeasurable against wall-clock noise (~8us of chain-commit cost against a ~300-460ms search budget).
…olution Documents the hypothesis, benchmark methodology, raw 3-run results, honest overhead-noise reading, ecosystem-fit analysis (RuVector coherence-hnsw, Darwin-style ES, proof-gate witness chain, Flywheel evidence retention, MetaHarness promotion-gate precondition), rejected alternatives, security, governance, and practical/long-horizon applications.
Owner
Author
|
The Generated by Claude Code |
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.
Hypothesis
Why this topic:
ruvector-sonaalready runs an unwitnessed(1+1)-ES(
darwin_autotuner.rs).ruvector-proof-gate(ADR-227) andruvector-retrieval-receipt(ADR-304) give writes and reads tamper-evidenthash chains. Nothing combines an evolutionary search with a witness chain
over its own mutation/fitness/promotion history — the gap this repo's own
nightly-harness Darwin promotion gate (
witness_valid, "a failed candidatemust remain part of the lineage") assumes is already closed but isn't.
Architecture
New crate
crates/ruvector-witnessed-evolution:genome.rs— two-parameter genome (coherence threshold, beam widthef) overruvector-coherence-hnsw'sCoherenceGatedSearch.fitness.rs— deterministic evaluation (recall@10 + expansion count; not wall-clock latency, to keep replay exact-match-comparable) against a fixed seeded workload.witness.rs—WitnessedLineagewrapsruvector_proof_gate::HashChainGateunmodified (genome →WritePayload.vector, fitness/decision →metadata).replay_verify()independently recomputes hashes, chain, fitness, and every accept/reject decision.tamper_composite()is the adversarial test hook.evolve.rs—run_unwitnessed/run_witnessed, identical(1+1)-ES loop and seed, so trajectories are provably comparable.src/bin/benchmark.rs—baseline(fixed default) /candidate_A(unwitnessed ES) /candidate_B(witnessed ES) + honest/tampered replay checks + acceptance gate.Files changed
crates/ruvector-witnessed-evolution/(new crate:Cargo.toml,src/{lib,genome,fitness,witness,evolve}.rs,src/bin/benchmark.rs)Cargo.toml,Cargo.lock(workspace member registration)docs/adr/ADR-305-witnessed-evolution.mddocs/research/nightly/2026-08-19-witnessed-evolution-ann-tuning/{README,gist}.mdBenchmark command
Real benchmark results (run 1 of 3, all independently reproduced)
Final genome, fitness, and chain root were bit-identical across all 3 independent release runs (full determinism, including every rejected intermediate generation). Measured wall-clock "overhead" was negative in all 3 runs (-5.3%, -30.1%, -3.3%) — read honestly as noise, not a speedup:
HashChainGate::admitcosts ~200ns/call, so 41 commits cost ~8µs against a ~300-460ms search budget, far below whatInstant-based wall-clock measurement can resolve at this scale. See the README's "Honest Reading of the Overhead Number" section.Acceptance result
ACCEPT. All 5 mandatory criteria held on all 3 independent runs: bit-identical witnessed/unwitnessed trajectories, ES beats fixed baseline (+3.2% composite fitness), overhead within the 15% budget (measured negative), honest-lineage replay verifies, tampered-lineage is caught at the exact tampered generation.
Darwin result
Bounded (1+1)-ES, 40 generations / 41 candidates evaluated, 1 promotion (the final accepted genome). Parent (
records()[0], the untouched default genome) and every rejected intermediate mutation retained in the lineage, not discarded.Flywheel result
WitnessedLineage::records()is a directly reusable evidence format for future nightly Darwin runs tuning ANN parameters elsewhere in the ecosystem — genome, fitness, and decision for every generation including rejections, ~154 bytes/generation.Security review
Reuses
ruvector-proof-gate's existing SHA-256HashChainGateunmodified — no new cryptographic primitive, no new attack surface. No secrets/PII pass through the crate. The witness chain is unsigned: it detects post-issuance mutation of evidence (verified in tests:tampered_fitness_is_detected), it does not prove the search process itself ran honestly in the first place — same threat modelruvector-retrieval-receiptalready documents for its own receipts.tamper_compositeis a public test-only hook; a tampered record cannot be made to passreplay_verifybecause it doesn't (and structurally can't) touch the receipt'spayload_hashcaptured at admission time.Main limitations
m,m_longjump) would need an O(N²) rebuild per generation this design doesn't attempt.Production recommendation
Keep experimental (not wired into any production tuning path). Adopt
WitnessedLineageas the standard evidence format for future nightly Darwin runs that tune ANN parameters — it's a working, tested, negligible-overhead primitive that satisfies this harness's own "retained evidence, not fabricated summaries" requirement. Do not yet claim a production speedup from witnessing itself — the honest claim is "the cost is unmeasurably small," not "free" or "faster."Research document / ADR / gist
docs/research/nightly/2026-08-19-witnessed-evolution-ann-tuning/README.mddocs/adr/ADR-305-witnessed-evolution.mddocs/research/nightly/2026-08-19-witnessed-evolution-ann-tuning/gist.mdValidation performed
cargo test -p ruvector-witnessed-evolution— 11/11 passingcargo clippy -p ruvector-witnessed-evolution --all-targets— cleancargo fmt -p ruvector-witnessed-evolution -- --check— cleancargo metadata --no-deps— workspace resolves cleanly with the new membercargo run --release -p ruvector-witnessed-evolution --bin benchmark— run 3× independently, results aboveGenerated by Claude Code