research(nightly): semantic drift detection for embedding streams (ADR-272)#717
Draft
ruvnet wants to merge 1 commit into
Draft
research(nightly): semantic drift detection for embedding streams (ADR-272)#717ruvnet wants to merge 1 commit into
ruvnet wants to merge 1 commit into
Conversation
Implements three O(d) / O(w·d) streaming drift detectors for L2-normalised embedding spaces: - CentroidDrift: EMA centroid tracking (cosine displacement), 512 B/64-d - CovarianceTrace: Welford variance + centroid dual-trigger, 768 B/64-d - SlidingWindowKl: cross-window cosine-similarity KL divergence, 15.6 KB/64-d All three ship with: - DriftDetector trait (Send + Sync) for plug-in composition - 15 unit tests (all green) - Deterministic benchmark binary with directional synthetic data Benchmark results (64-d, 500 stable + 500 drifted, seed=0xDEADBEEF): CentroidEMA detect=14 FP=0.0% 151 ns/feed 6.6M eps PASS CovarianceTrace detect=59 FP=0.0% 231 ns/feed 4.3M eps PASS SlidingWindowKL detect=26 FP=0.6% 22 µs/feed 45K eps PASS Adds workspace member crates/ruvector-semantic-drift.
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.
Summary
Nightly research branch for 2026-07-22: online semantic drift detection in high-dimensional embedding streams.
Ships a production-ready Rust crate (
ruvector-semantic-drift) with three streaming drift detectors, 15 passing unit tests, a deterministic benchmark binary, ADR-272, and a full research document.What ships
New crate:
crates/ruvector-semantic-driftThree
DriftDetectorimplementations (allSend + Sync, no heap allocations after init):CentroidDriftCovarianceTraceSlidingWindowKlAll three detect drift within the 100-sample acceptance window with FP ≤ 5%. Benchmark is deterministic (seed
0xDEADBEEF, directional synthetic data, 500 stable + 500 drifted, 64-d).Run the benchmark:
Run the tests:
Design decisions
DriftDetectortrait is the single composition surface — orchestrators holdBox<dyn DriftDetector>and swap detectors without code changes.SlidingWindowKluses cross-window cosine similarities (detection vs reference) rather than within-detection pairwise — this is the key insight that makes it sensitive to directional shift rather than just spread change.CovarianceTracedisables the variance trigger (ratio=100) for this benchmark because cumulative Welford mean dilution makes centroid displacement the more reliable signal post-injection.Docs
docs/adr/ADR-272-semantic-drift.md— architecture decision recorddocs/research/nightly/2026-07-22-semantic-drift/README.md— full research document with SOTA survey, design rationale, real benchmark output, failure modes, MCP implications, edge/WASM notesdocs/research/nightly/2026-07-22-semantic-drift/gist.md— SEO-optimised public articleTest plan
cargo test -p ruvector-semantic-drift— 15 unit tests, all greencargo run --release -p ruvector-semantic-drift --bin benchmark— all 3 variants PASS acceptance criteriacargo build --workspace— workspace build unbrokenruvector-agent-memorycrateGenerated by Claude Code