Skip to content

research(nightly): semantic drift detection for live vector indexes#714

Draft
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-07-21-semantic-drift-detect
Draft

research(nightly): semantic drift detection for live vector indexes#714
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-07-21-semantic-drift-detect

Conversation

@ruvnet

@ruvnet ruvnet commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Adds nightly RuVector research for semantic-drift-detect: autonomous monitoring of embedding distribution drift in live vector indexes.

  • Problem: When embedding models are updated or data distributions shift, stored vectors become geometrically stale. Search recall degrades silently. No existing vector database provides automatic drift monitoring.
  • Solution: ruvector-drift-detect — a pure-Rust, zero-dependency crate with three complementary drift detectors, all implementing a common DriftDetector trait.
  • All acceptance criteria pass: abrupt 3σ drift detected across all three variants, zero false positives on same-distribution control data.

What's included

  • Working Rust PoC: crates/ruvector-drift-detect/ with three variants, 12 passing unit tests, and a benchmark binary
  • ADR: docs/adr/ADR-272-semantic-drift-detect.md
  • Research document: docs/research/nightly/2026-07-21-semantic-drift-detect/README.md
  • Public gist draft: docs/research/nightly/2026-07-21-semantic-drift-detect/gist.md
  • Real benchmark results (no invented numbers)

Variants implemented

Variant Mechanism State Observe/vec Score Time
GlobalStatsDriftDetector Welford mean/variance per dimension O(D) = 2 KB 340 ns 1 µs
CentroidDriftDetector Online k-means centroid migration O(K·D) = 32 KB 2 269 ns 4 µs
NeighborhoodDriftDetector Anchor k-NN contamination rate O(n·D) = 2.5 MB 244 ns 61 s†

†NeighborhoodRecall score scales O(A·n·D); SIMD optimization is listed as the immediate next improvement.

Benchmark results (release build, x86_64 Linux, Rust 1.94.1)

=== Scenario A: Abrupt Full Drift (128/128 dims shifted 3σ) ===

  Variant                  Drift Score Ctrl Score  Threshold    Pass?
  GlobalStats                  9.0561     0.0307       2.00     PASS
  CentroidDrift(K=32)          0.6239     0.0051       0.30     PASS
  NeighborhoodRecall           0.4000     0.0060       0.30     PASS

  RESULT: PASS — all acceptance criteria met

Ecosystem fit

  • ruvector-core: add optional drift_monitor hook on index write path
  • ruFlo: is_drifted() return value triggers autonomous reindex action
  • MCP: expose ruvector_drift_score as an agent-callable tool
  • Edge/WASM: all variants compile to WASM; GlobalStats (2 KB state) suitable for Cognitum Seed

Test

git checkout research/nightly/2026-07-21-semantic-drift-detect
cargo test -p ruvector-drift-detect          # 12 tests, all pass
cargo run --release -p ruvector-drift-detect --bin benchmark

Research doc: docs/research/nightly/2026-07-21-semantic-drift-detect/README.md
ADR: docs/adr/ADR-272-semantic-drift-detect.md


Generated by Claude Code

Selected topic: Semantic drift detection for live RuVector vector indexes.
Three Rust variants implemented and benchmarked:
- GlobalStats (Welford moments): 340ns/insert, score 9.06 on 3σ shift
- CentroidDrift (online k-means): 2.3µs/insert, score 0.62 on 3σ shift
- NeighborhoodRecall (contamination rate): 244ns/insert, score 0.40 on 3σ shift

All acceptance criteria pass: drift detected, no false positives on control.
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