test(index): stabilize lightweight 4-bit PQ recall - #8784
Merged
Conversation
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
Restoring 32 subvectors for the 4-bit fixtures gives the affected IVF-PQ and IVF-HNSW-PQ matrices adequate code capacity while retaining the recall threshold and sub-second runtime. This is independently useful test coverage; #8767 can continue separately as the broader deterministic-training change.
Xuanwo
approved these changes
Aug 26, 2026
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.
Other Changes
The lightweight 4-bit IVF_PQ / IVF_HNSW_PQ matrix reduced PQ from 32 to 4 subvectors in #8733. With 32-dimensional inputs, that produces only a 2-byte code. The fixture seeds its input data but not IVF/PQ training, so the single-query R@10 result can fall below the required 0.5 threshold.
This change:
recall >= 0.5,refine=4,ef=64, and all production code unchangedThis is a test-only alternative to #8767. That PR makes production KMeans/IVF/PQ training seedable and covers the broader #8764 scope, including multivector. This PR intentionally limits itself to restoring quality margin in the 4-bit matrices without adding a production API.
Measurements
Environment: Apple M4, 24 GiB RAM, macOS 26.6.1, Rust 1.97.0, prebuilt debug test binary,
LANCE_CPU_THREADS=4, and--test-threads=1. Each configuration had 3 warm-ups. Per-metric results use 100 alternating M4/M32 runs; the complete matrix uses 30 alternating runs. Compilation time is excluded. Temporary measurement instrumentation was not committed.Lower is better for runtime:
Higher is better for recall:
The equal-weight mean across all three metrics improved from 0.744 to 0.992 (+24.8 pp). The complete M4 matrix passed 29/30 runs; M32 passed 30/30.
Validation
LANCE_CPU_THREADS=4 cargo test -p lance --lib pq_4bit -- --test-threads=1(6 passed)cargo clippy --all --tests --benches -- -D warningscargo fmt --all -- --checkgit diff --checkRelated to #8764 and #8767.