fix(index): pass PQ num_bits through distributed build#5215
Draft
ddupg wants to merge 1 commit into
Draft
Conversation
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.
Background
While building vector indexes with Ray distributed indexing, we found that
create_index(..., num_bits=4)did not apply the requested bit width to global PQ training. Segment builds could receivenum_bits=4, but the shared global PQ codebook was still trained through the default 8-bit path.The PQ codebook is parameterized by
num_bits: 4-bit PQ should use 16 centroids per sub-vector, while 8-bit PQ uses 256. If global training and worker segment builds disagree, the distributed index can reuse PQ artifacts that do not match the requested build settings, which can hurt quantization/index quality.This depends on lance-format/lance#7583, which adds the Python/PyO3
num_bitssupport needed by the global PQ training call. This PR should wait for that Lance change to land before moving forward.Summary
num_bitsto distributed vector index creation and pass it to global PQ trainingnum_bitsto worker segment builds for compressed vector indexesTests
uv run --frozen pytest tests/test_vector_index_options.py::test_create_index_uses_sample_rate_and_num_bits_for_global_traininguv run --frozen pytest 'tests/test_distributed_indexing.py::test_build_distributed_vector_index[IVF_PQ]'uv run --frozen ruff check lance_ray/index.py tests/test_distributed_indexing.py tests/test_vector_index_options.pyuv run --frozen ruff format --check lance_ray/index.py tests/test_distributed_indexing.py tests/test_vector_index_options.py