Skip to content

research(nightly): typed-edge-hnsw — hybrid vector+semantic retrieval in one pass#626

Draft
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-06-30-typed-edge-hnsw
Draft

research(nightly): typed-edge-hnsw — hybrid vector+semantic retrieval in one pass#626
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-06-30-typed-edge-hnsw

Conversation

@ruvnet

@ruvnet ruvnet commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

Nightly RuVector research (2026-06-30): Typed-Edge Navigable Graph (TENG) — integrates typed knowledge-graph edges (SameDocument, References, CoOccurs, Temporal, Causal) directly into the NSW navigation beam, enabling single-pass hybrid vector+semantic retrieval with no second graph-traversal step.

  • +22% semantic recall (EdgeExpand vs VectorOnly on semantic ground truth)
  • 0.992 constrained recall (EdgeConstrained/SameDocument vs filtered ground truth)
  • All 5 acceptance tests pass
  • No external dependencies beyond workspace rand/rand_distr
  • Zero unsafe code; WASM-compatible design

What's Included

  • Crate: crates/ruvector-tegraph/ — new standalone crate
    • src/types.rs: EdgeType, TypedEdge, Node
    • src/graph.rs: NswGraph with proper BinaryHeap beam search
    • src/variants.rs: TengIndex with three search variants
    • src/dataset.rs: deterministic seeded corpus generation
    • src/bin/benchmark.rs: benchmark binary with acceptance tests
  • ADR: docs/adr/ADR-272-typed-edge-hnsw.md
  • Research doc: docs/research/nightly/2026-06-30-typed-edge-hnsw/README.md
  • Public gist: docs/research/nightly/2026-06-30-typed-edge-hnsw/gist.md

Real Benchmark Numbers

From cargo run --release -p ruvector-tegraph --bin benchmark on x86_64 Linux:

Variant Vec R@10 Sem R@10 Mean μs p50 μs p95 μs QPS Mem MB
VectorOnly 0.733 232.8 229 290 4,295 4.46
EdgeExpand(f=0.30) 0.895 0.895 446.4 440 524 2,240 4.46
EdgeConstrained (SameDoc) 0.992 792.4 773 859 1,262 4.46

Dataset: 5,000 nodes × 128 dims, 100 docs × 50 nodes/doc, 500 queries, k=10.

Why This Is Novel

Current graph-RAG systems (GraphRAG, HippoRAG, LightRAG, G-Retriever) all run ANN retrieval and graph traversal as two separate passes. TENG folds typed graph edges into the navigation beam itself — the first RuVector-native approach to single-pass hybrid retrieval. The EdgeExpand variant discovers nodes that are vector-distant but graph-adjacent (22% more semantic coverage) without a second query.

Ecosystem Fit

Connects: RuVector vector search · graph storage · agent memory (ADR-268) · proof-gate (ADR-227) · MCP tools · WASM/edge · ruFlo automation · RVF cognitive packages · Cognitum Seed

Test Plan

  • cargo build --release -p ruvector-tegraph — clean build
  • cargo test -p ruvector-tegraph — 4 unit tests pass
  • cargo run --release -p ruvector-tegraph --bin benchmark — all 5 acceptance checks pass
  • Real text embedding evaluation (future work)
  • Multi-layer HNSW upgrade (Phase 2, ADR-272)

Research doc

docs/research/nightly/2026-06-30-typed-edge-hnsw/README.md

ADR

docs/adr/ADR-272-typed-edge-hnsw.md


Generated by Claude Code

Nightly RuVector research: Typed-Edge Navigable Graph — integrating
knowledge-graph edge types (SameDocument, References, CoOccurs, Temporal,
Causal) into NSW navigation for single-pass hybrid vector+semantic retrieval.

Three measured variants on 5,000×128-dim synthetic corpus:
  - VectorOnly:        recall@10=0.733, 232μs mean, 4,295 QPS
  - EdgeExpand(f=0.30): recall@10=0.895, 446μs mean, 2,240 QPS (+22% semantic)
  - EdgeConstrained:   recall@10=0.992, 792μs mean, 1,262 QPS (SameDocument)

All acceptance tests pass (cargo run --release -p ruvector-tegraph --bin benchmark).

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01DmGfJmpxVAQ421ygT3phHf
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