research(nightly): coherence-adaptive quantization — negative result - #830
Draft
ruvnet wants to merge 3 commits into
Draft
research(nightly): coherence-adaptive quantization — negative result#830ruvnet wants to merge 3 commits into
ruvnet wants to merge 3 commits into
Conversation
Nightly research crate testing whether mutual-kNN boundary detection (a lightweight, ground-truth-free proxy for local graph conductance) can drive per-vector 4-bit/8-bit scalar quantization allocation. Baseline (uniform 8-bit), candidate A (uniform 4-bit), and candidate B (coherence-adaptive) are implemented with real bit-packed storage, deterministic synthetic datasets, and a reproducible benchmark. Result documented separately: hypothesis is falsified on the tested workload.
Documents the falsified hypothesis, benchmark methodology, raw results, failure analysis, and next-research direction for ruvector-coherence-quant.
Records the decision not to adopt mutual-kNN coherence as a quantization bit-allocation signal, with measured evidence, alternatives considered, and open questions for future revisits.
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.
Hypothesis
Given a 4,000-vector corpus (dim=32, 12 clusters, noise=0.18), when per-vector scalar
quantization bit-width is chosen by mutual-kNN coherence (a lightweight, ground-truth-free
proxy for local graph conductance/cluster-boundary detection, in the spirit of
ruvector-mincut'sconductance signal) instead of a uniform 4-bit budget, then recall@10 should recover to within
1.5pp of the uniform 8-bit baseline, subject to total memory staying at or below 65% of baseline.
Result: REJECT. The hypothesis is falsified as tested — see evidence below.
Architecture
New crate
ruvector-coherence-quant:dataset.rs— deterministic clustered corpus + held-out jittered queries + brute-force ground truthcoherence.rs— brute-force k-NN graph + mutual-kNN coherence scorequantize.rs— per-vector min-max scalar quantization, real bit-packed storage (two 4-bit codes/byte)search.rs— brute-force search over the quantized indexbin/benchmark.rs— baseline (uniform 8-bit) vs candidate A (uniform 4-bit) vs candidate B (coherence-adaptive 4/8-bit)flowchart LR A[Clustered corpus] --> B[k-NN graph, k=12] B --> C[Mutual-kNN coherence score] C --> D{coherence >= 0.5?} D -->|core| E[4-bit quant] D -->|boundary| F[8-bit quant] E --> G[QuantizedIndex] F --> G G --> H[recall@10 / memory / latency]Files changed
crates/ruvector-coherence-quant/(new crate: lib, dataset, coherence, quantize, search, metrics, benchmark bin, 16 unit tests)Cargo.toml— new workspace memberdocs/research/nightly/2026-08-15-coherence-adaptive-quant/{README.md,gist.md}— full writeupdocs/adr/ADR-305-coherence-adaptive-quant.md— decision recordBenchmark command
cargo test --release -p ruvector-coherence-quant cargo run --release -p ruvector-coherence-quant --bin benchmarkReal benchmark results
Deterministic and reproducible: two independent runs produced bit-identical recall/memory values.
Acceptance result
REJECT. Mutual-kNN coherence is a real, reproducible structural signal (verified higher on
clustered vs. random data by a dedicated unit test) but does not transfer to quantization
bit-allocation on this workload — it measures local density agreement, not per-vector
quantization sensitivity. Full failure analysis in the research README.
Darwin / Flywheel / MetaHarness
npx metaharness --helpand repo tooling were inspected; MetaHarness in this environment is aproject-scaffolding generator, not a live research-orchestration daemon for this repo, and
ruvector harnesssubcommands (Darwin/Flywheel CLI) were not resolvable here. No evolutionarysearch or flywheel replay was run as a result — this PoC used a single pre-registered
baseline/candidate-A/candidate-B comparison instead, with the acceptance gates fixed before the
benchmark ran and not adjusted afterward.
Security review
No new attack surface: standalone benchmark crate, no network I/O, no external input parsing, not
wired into any production index or MCP surface.
Main limitations
Production recommendation
Do not adopt. Keep uniform quantization. If the general direction (content-aware bit allocation)
is revisited, test a quantization-error-derived signal (per-dimension coordinate range) instead of
a neighbourhood-mutuality signal, and validate against the real
ruvector-mincutconductance API.Generated by Claude Code