research(nightly): anisotropic-pq-search — AQ codebook training for high-recall cosine ANN - #803
Draft
ruvnet wants to merge 1 commit into
Draft
research(nightly): anisotropic-pq-search — AQ codebook training for high-recall cosine ANN#803ruvnet wants to merge 1 commit into
ruvnet wants to merge 1 commit into
Conversation
Adds 2026-08-06 nightly RuVector research: Anisotropic Product Quantization (AQ) for high-recall angular ANN search. - feat: crates/ruvector-aq-search — AQ codebook training with ScaNN- style directional penalty (η), IsotropicFlat / AnisotropicFlat / AnisotropicResidual variants, AqSearch trait, benchmark binary - test: 14 unit tests pass; all acceptance tests pass - bench: recall@10 = 0.2456 (flat AQ) / 1.0000 (residual 16×), latency 425–533µs mean, QPS 1876–2428 on N=10K×128-dim clustered data - docs: ADR-296-anisotropic-pq-search.md - docs: docs/research/nightly/2026-08-06-anisotropic-pq-search/README.md - docs: gist.md (SEO-optimised public article)
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 2026-08-06 nightly RuVector research: Anisotropic Product Quantization (AQ) for high-recall angular ANN search.
Standard PQ trains codebooks with isotropic L2 loss, but cosine similarity search penalises residuals parallel to the query direction — not total L2. This is the fundamental metric mismatch ScaNN (Guo et al., NeurIPS 2020) quantified. This PR implements AQ in safe Rust, fixes the mismatch, and benchmarks three variants.
What's included
crates/ruvector-aq-search/— new standalone crateAqSearchtrait (unified interface for all variants)AqCodebook— k-means with ScaNN-style directional penalty ηIsotropicFlat— standard PQ baseline (isotropic training, IP ADC scan)AnisotropicFlat— AQ training, same ADC scan, same memory footprintAnisotropicResidual— AQ scan + exact f32 inner-product re-rankcargo run --release -p ruvector-aq-search --bin aq-benchmarkdocs/adr/ADR-296-anisotropic-pq-search.md— architecture decision recorddocs/research/nightly/2026-08-06-anisotropic-pq-search/README.md— full research document with SOTA survey, forward-looking thesis, real benchmark results, failure modes, MCP/WASM/ruFlo implicationsdocs/research/nightly/2026-08-06-anisotropic-pq-search/gist.md— SEO-optimised public articleReal benchmark results
Key findings
AnisotropicResidualwith overfetch=16 achieves recall@10 = 1.00 at <540µs mean latencyruvector-pq-search— AQ is a drop-in codebook improvementEcosystem connections
ruvector-pq-searchruvector-coherence-hnsw,ruvector-agent-memory,ruvector-bounded-ragResearch loop passes completed
3 (Discover → Deepen → Critique and harden)
Alternatives rejected
OPQ (rotation-only, no directional penalty), RaBitQ (binary, different trade-off), DPQ (gradient-based, needs tensor library)
Generated by Claude Code