research(nightly): graph-degree-adaptive-quantization - #743
Draft
ruvnet wants to merge 4 commits into
Draft
Conversation
Introduces ruvector-gdq: hub-aware mixed 4/8-bit quantization guided by HNSW graph in-degree. Hub vectors (high in-degree) receive 8-bit precision; peripheral vectors receive 4-bit, saving 34% memory. Key engineering findings: - Per-dimension min/max scaling is required for usable 4-bit recall - Global min/max makes 4-bit step size ~4.67 for clustered data (unusable) - Per-dimension scaling reduces step to ~0.3–0.5 (usable recall) Four variants benchmarked: - Baseline (uniform 8-bit): 256 KB, Recall@10=0.967 - GraphGuided (30%8+70%4): 170 KB, Recall@10=0.712 (+3.5% vs Random) - AccessFreq (30%8+70%4): 166 KB, Recall@10=0.683 - RandomMixed (30%8+70%4): 166 KB, Recall@10=0.677 All 5 acceptance tests pass. All 16 unit tests pass.
Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01GzrxGAhFgjo3WqxJZB1o6J
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
Adds nightly RuVector research for Graph-Degree Adaptive Quantization (GDQ) — a hub-aware mixed-precision compression strategy that assigns 8-bit precision to high-in-degree HNSW hub vectors and 4-bit (nibble) precision to peripheral vectors.
Key finding: Graph-degree-based hub selection outperforms random selection at the same memory budget, delivering +3.5% recall at 34% memory savings vs uniform 8-bit storage on clustered 128-dim data.
What's included
Working Rust PoC (
crates/ruvector-gdq) — zero external deps beyond workspacerand/rand_distrAdaptiveQuantStorewith four variants: Baseline, GraphGuided, AccessFreq, RandomMixedADR —
docs/adr/ADR-273-graph-degree-adaptive-quantization.mdResearch document —
docs/research/nightly/2026-07-29-graph-degree-adaptive-quantization/README.mdPublic gist —
docs/research/nightly/2026-07-29-graph-degree-adaptive-quantization/gist.md(SEO-optimized)Real benchmark results (cargo run --release)
Acceptance tests (all PASS)
Core engineering insight
Per-dimension min/max scaling is required for usable 4-bit recall on real clustered data. Global scalar quantization (one min/max for all dims) fails because the step size (~4.67 for range-70 data with 15 levels) exceeds intra-cluster variance (~1.5), making reconstruction error larger than the signal.
RuVector ecosystem connections
memory_compacttool trigger for auto-precision demotionFiles changed
crates/ruvector-gdq/(new crate, 6 source files + Cargo.toml)Cargo.toml(workspace member added)docs/adr/ADR-273-graph-degree-adaptive-quantization.mddocs/research/nightly/2026-07-29-graph-degree-adaptive-quantization/README.mddocs/research/nightly/2026-07-29-graph-degree-adaptive-quantization/gist.mdGenerated by Claude Code