Skip to content

feat(core): add DeterministicScore with deterministic fusion#501

Open
ohdearquant wants to merge 2 commits into
ruvnet:mainfrom
ohdearquant:feat/deterministic-scoring
Open

feat(core): add DeterministicScore with deterministic fusion#501
ohdearquant wants to merge 2 commits into
ruvnet:mainfrom
ohdearquant:feat/deterministic-scoring

Conversation

@ohdearquant
Copy link
Copy Markdown

Summary

  • Add DeterministicScore (i64 fixed-point, 2^32 scale) to ruvector-core — ported from khive-score
  • Fix NaN panic in FlatIndex sorting (partial_cmp().unwrap() → total ordering)
  • Change RRF default K from 60 to 15 (Lean4 proof: K=60 has consensus bias)
  • Add search_deterministic() to VectorIndex trait — boundary conversion from f32 distance to deterministic similarity
  • Add deterministic_rrf and deterministic_weighted fusion using BTreeMap for iteration-order determinism
  • 238 tests pass, 0 regressions

Lean4 formal proofs

Corresponding formal proofs (51 theorems, zero sorry) verified with Lean 4.25.2 + Mathlib v4.25.2:

Properties proved: total order, NaN safety, saturating arithmetic (branch specs + commutativity), RuntimeValid invariant preservation, abstract float conversion validity, MIN-unreachability, scalar mul/div validity, division-by-zero policy.

Test plan

  • All 19 deterministic_score tests pass
  • Full ruvector-core suite: 238 passed, 0 failed
  • Clippy clean (no new warnings)
  • Downstream: khive-retrieval integration (Phase 5, separate PR)

🤖 Generated with claude-flow

Port fixed-point i64 scoring (2^32 scale) from khive-score into
ruvector-core. Fixes NaN panics in FlatIndex, changes RRF default
K from 60 to 15 (per Lean4 consensus bias proof), and adds
search_deterministic() to VectorIndex trait.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ohdearquant ohdearquant marked this pull request as ready for review May 23, 2026 00:10
revert fusion rrf to 60
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.

1 participant