research(nightly): temporal-decay-hnsw — recency-aware ANN for agent memory#530
Draft
ruvnet wants to merge 3 commits into
Draft
research(nightly): temporal-decay-hnsw — recency-aware ANN for agent memory#530ruvnet wants to merge 3 commits into
ruvnet wants to merge 3 commits into
Conversation
Introduces crates/ruvector-td-hnsw with three flat-index search variants: Baseline (pure L2), TemporalDecay (L2 × exp-decay weight), and CoherenceGated (decay + age+distance pruning gate). Adds workspace member entry in Cargo.toml. Decay formula: d_eff = d_raw × (1 + S × (1 − exp(−age / H))) Measured on 10k vectors, 128 dims, 1k queries: - Baseline fresh_recall: 0.095 - TemporalDecay fresh_recall: 1.000 (+953%) - CoherenceGated: 1.000 recall, 20% faster than baseline (691 QPS) https://claude.ai/code/session_0153VnjXwTfTuLjmSg7WVgcc
Documents the decision to introduce recency-aware nearest-neighbour search via DecayConfig + TdIndex. Covers: context (agent memory staleness), decision (three variants with measured results), alternatives considered, implementation plan, benchmark evidence, failure modes, security considerations, and open questions. https://claude.ai/code/session_0153VnjXwTfTuLjmSg7WVgcc
Adds full research document and SEO gist for the td-hnsw nightly run: - README.md: 19-section research paper covering SOTA (Qdrant/Milvus/Weaviate temporal support), 10–20 year forward thesis, ruvnet ecosystem fit, architecture diagrams, real benchmark results, practical and exotic applications, and deep research notes with 13 cited sources. - gist.md: public-facing SEO article with features table, technical design, real benchmark table, comparison vs 9 systems, usage guide, and roadmap. Key SOTA finding: all existing vector databases apply temporal decay post-retrieval, not during graph traversal. TD-ANN addresses this gap. https://claude.ai/code/session_0153VnjXwTfTuLjmSg7WVgcc
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.
Nightly Research: Temporal-Decay ANN for Agent Memory
Topic: Recency-aware nearest-neighbour search where effective distance is
modulated by vector insertion age:
d_eff = d_raw × (1 + S × (1 − exp(−age/H)))Slug:
temporal-decay-hnswADR:
docs/adr/ADR-196-temporal-decay-hnsw.mdResearch doc:
docs/research/nightly/2026-06-03-temporal-decay-hnsw/README.mdGist:
docs/research/nightly/2026-06-03-temporal-decay-hnsw/gist.mdWhat This Adds
A new standalone Rust crate
crates/ruvector-td-hnswimplementing three variantsof temporal-aware flat-index nearest-neighbour search:
All numbers from
cargo run --release -p ruvector-td-hnsw --bin td-benchmark.Dataset: 10,000 vectors, 128 dims, 1,000 queries, 10% fresh distribution.
The Problem
Standard vector indexes rank by geometric distance only. With 90% stale memories,
90% of top-10 results are stale — proportional to the corpus distribution. Every
major vector database (Qdrant, Milvus, Weaviate, Pinecone) applies temporal decay
post-retrieval, after the ANN graph has already decided which candidates to
surface. This misses the gap: fresh but slightly farther vectors never enter the
candidate set.
The Solution
Modify the effective distance during candidate scoring:
Key Results
cargo build --release -p ruvector-td-hnsw)SOTA Gap
No existing vector database modifies the ANN distance function for temporal
preference. TANNS (ICDE 2025) is closest — hard validity gating — but does not
do soft recency weighting during traversal. This PoC fills that gap.
Ecosystem Fit
DecayConfiginto HNSW greedy traversalhalf_life_secsfrom session-level retrieval utilitydecay_configas a per-query parameterDecayConfig::weight()is WASM-safe, no heap allocationdefault_decay_configfield for cognitive package portabilityFiles Changed
Research Loop
Benchmark Command
git checkout research/nightly/2026-06-03-temporal-decay-hnsw cargo build --release -p ruvector-td-hnsw cargo test -p ruvector-td-hnsw cargo run --release -p ruvector-td-hnsw --bin td-benchmarkThis branch should either become a production RuVector capability (starting with HNSW graph integration) or a falsified research path with useful evidence.
https://claude.ai/code/session_0153VnjXwTfTuLjmSg7WVgcc
Generated by Claude Code