feat: add cosine and inner-product range search for IVF indexes - #108
Merged
jerry-024 merged 2 commits intoSep 21, 2026
Merged
Conversation
JunRuiLee
force-pushed
the
feat/ivf-cosine-ip-range-search
branch
from
September 20, 2026 03:26
b7761dd to
06eeb2a
Compare
JunRuiLee
marked this pull request as ready for review
September 20, 2026 03:32
Add metric-aware range search for IVF-Flat, SQ, PQ and RQ while preserving exact versus estimated membership, existing L2 behavior and top-K paths. Reuse bounded residual-IP lookup tables without changing floating-point addition order, remove redundant query preparation, and cover boundaries, filters, statistics, streaming and error recovery.
JunRuiLee
force-pushed
the
feat/ivf-cosine-ip-range-search
branch
from
September 20, 2026 05:17
06eeb2a to
20fa731
Compare
jerry-024
reviewed
Sep 20, 2026
Parallelize non-L2 coarse probing above the existing work threshold while preserving checked distances and query order. Apply cached residual-IP offsets in the PQ scanner without mutating lookup tables, preserving rounding and signed-zero behavior. Add threshold, worker-equivalence, error-path, and numerical regressions. Validation: workspace Debug and serialized-harness Release tests pass (667 passed, 2 ignored); Clippy with -D warnings, formatting, diff, and ASF header checks pass.
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
Existing L2 and top-K behavior, the storage format and C/JNI APIs remain unchanged. No original-vector reranking or top-K fallback is introduced.
Validation
Run locally on macOS/AArch64:
cargo test --offline --locked --workspace: 662 passed, 2 ignored after the performance fixes.cargo test --offline --locked --release --workspace -- --test-threads=1: 662 passed, 2 ignored after the performance fixes. This serializes the test harness, not the explicit 1/4-worker Rayon pools exercised by the tests.cargo clippy --offline --locked --workspace --all-targets -- -D warnings: passed.cargo fmt --all -- --checkandgit diff --check: passed.python3 tools/check_license_headers.py: passed.cargo test --offline --locked -p paimon-vindex-core --test range_search pq_range_coarse: both coarse-parallel regression tests passed.Local documentation links/anchors: 192 references passed across six changed HTML pages.
PQ coverage includes all metrics, PQ4/PQ8, both residual modes, dense 64D OPQ, scalar-oracle comparisons, adjacent-ULP membership, single/batch/filter equivalence, 1/4 workers and
optimize_for_searchinvariance. Streaming crosses the production 8 MiB LUT cache budget for PQ8; PQ4 scratch fallback is covered separately with a forced budget.Targeted performance check on Apple M2 Pro: a synthetic PQ8 thin-list fixture (d=768, m=96, 64 lists of four rows, zero coarse centroids, 16 queries, full probe, one worker) improved residual-IP batch median from 42.420 ms to 1.285 ms over five alternating before/after runs, with identical result checksums. This is a LUT-heavy fixture, not a general throughput guarantee.
Additional residual-IP streaming coverage uses nonzero coarse centroids, 33 queries crossing the PQ8 cache budget, PQ4/PQ8, 1/4 workers, filters and early stopping on nonfinite estimates.
Local independent read-only agent reviews of shared semantics/Flat/SQ/RQ and the PQ extension found no remaining in-scope blockers. A follow-up read-only review of the rebase conflict resolution and retained upstream optimizations also passed. Independent review of the LUT/query-preparation fixes and added streaming regression also found no blockers. Maintainer review and hosted CI remain separate requirements before merge.
Known validation limitation
Default-concurrent Release test runs have intermittently failed unchanged top-K tests that assert work was observed on multiple Rayon workers. A clean archive of an earlier #107 baseline, compiled into a separate target directory, reproduced the same category of IVF-Flat worker-count assertion failure. Isolated tests and the complete serialized Release test harness pass. This is not a claim that default-concurrent Release is consistently green.
The expanded SQ range parallelism test uses a bounded worker handshake to avoid that scheduling race in its own coverage; unrelated top-K tests are not changed here.
Rollback / follow-up
No data migration or format change is involved. Reverting this single squashed commit leaves the merged #107 implementation intact. Before merging, inspect hosted CI and maintainer feedback.