Repository navigation
feat(index): support SQ8 quantized refinement - #11126
Conversation
63e6df6 to
da48673
Compare
Xuanwo
left a comment
There was a problem hiding this comment.
Please reuse the HNSW SQ8 distances in candidates.batch when selecting the final top K. The graph search has already scored those candidates with the same SQ8 calculator. Keep the larger candidate budget, segment filtering and distance bounds, and retain the separate scoring pass for RQ, where the scores differ.
With nprobes=2 and ef=64, I compared the first eight rows of native k=32 with k=8, quantized_refine=4. The ordered row IDs and distance bits matched in all 24 combinations of metric, bounds, SQL prefilter and cache setting. On cold unbounded queries the second pass added 64 comparisons. With the index cache disabled, partition loads doubled from two to four. Please add a focused regression that checks the returned scores and catches the duplicate partition load. Scoring path
The persisted remap and snapshot tests passed with the compact storage from #11141. Please update the PR description to reflect that layout and remove the references to retained tombstone routing slots and the deleted doctests.
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The duplicate HNSW SQ8 scoring pass identified in the maintainer review is removed. Graph-search distances now feed final selection directly, preserving the larger candidate budget, segment ownership filtering, and distance bounds. RQ retains its separate Accurate scoring pass. The compact-storage remap fix from merged #11141 remains intact. I found no remaining merge blocker.
AI-assisted verification on 9ef9f9cd: both Linux architectures passed the SQ8 score-reuse regression with two partition loads and equal comparison counts on both cache-disabled paths. The PR now documents the compact layout. CI
9ef9f9c to
3240f06
Compare
dc121d0 to
fdde5c4
Compare
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
fdde5c4 to
3184048
Compare
feat(index): support SQ8 quantized refinement
quantized_refine_factorsupports current-formatIVF_SQandIVF_HNSW_SQalongside flat
IVF_RQ. Flat SQ8 uses its native bounded scan. HNSW expandsthe graph candidate pool and reuses distances computed during graph search
at the native eight-bit precision. An explicit
efmust coverk * refine_factor * quantized_refine_factor. The default grows with thecandidate budget. Flat RQ uses Fast discovery and Accurate scoring for
unbounded queries, and searches directly in Accurate mode for bounded queries.
HNSW loads compact, realigned partitions through the existing IVF loader
from #11141. Deferred
compaction, explicit remapping, and prewarming use that same storage and
graph alignment. Candidate discovery and final selection apply segment
ownership and distance bounds.
Fully indexed row-ID and distance queries can run from stored index data.
Optional exact refinement, unindexed fragments, and stale overlays can
read original vectors. Completed partition results use the existing snapshot
identity and session cache budget. Batch queries use the existing per-query
path. Python and Java use the same options and Rust validation.
Validation
The cache-disabled regression searches two SQ8 partitions with
ef=64and compares native
k=32withk=8, quantized_refine_factor=4.It checks the first eight ordered row IDs and distance bits, recall against
exact search, partition loads, and comparison counts. The bounded case
also verifies an inclusive lower bound and exclusive upper bound against
native SQ8 search with the same candidate budget.
On the reviewed head (
da48673e9), the results matched before theregression failed on partition loads. Native search loaded two partitions
and recorded 147 comparisons. Quantized refinement loaded four and
recorded 211 comparisons.
On
9ef9f9cd9, both queries loaded two partitions and recorded equalcomparison counts. The bounded and unbounded results matched native
search bit for bit, and recall@8 against exact search met the 0.5 threshold.
The persisted-remap regression inspects the replacement files directly
after deleting one row from a 400-row fixture, compacting with deferred
remapping, and explicitly remapping the index. It checks for 399 physical
rows, zero tombstones, exact live membership, and matching graph coverage.
Lifecycle cases exercise cold and prewarmed loads after compaction.
Rust validation passed on
9ef9f9cd9with the pinned toolchain and theciprofile. The focused score-reuse regression passed, along with 183refinement tests (including the focused regression), 60 segment tests,
four batch segment-ownership tests, and two persisted-remap tests.
cargo fmt --all -- --checkand workspace Clippy with--all --tests --benches -- -D warningspassed.The rebuilt Python extension passed all 32 focused vector-index tests.
uv run make lintpassed with 18 Pyright warnings and zero errors.The Java Maven run passed Spotless, all 19
VectorSearchTestcases,and all 39 JNI Rust tests. JNI formatting and Clippy passed.