Skip to content

Reject incompatible IndexScalarQuantizer merges (Issue #5599) - #5642

Open
martingherold wants to merge 1 commit into
facebookresearch:mainfrom
martingherold:fix-scalar-quantizer-merge
Open

martingherold wants to merge 1 commit into
facebookresearch:mainfrom
martingherold:fix-scalar-quantizer-merge

Conversation

@martingherold

Copy link
Copy Markdown

Summary

IndexScalarQuantizer::merge_from() accepts indexes with incompatible trained quantization ranges, causing moved vectors to be decoded incorrectly using the destination index's quantization state.

Add IndexScalarQuantizer::check_compatible_for_merge() to validate scalar quantizer compatibility before either index is modified.

Tests

Add test_merge_IndexScalarQuantizer_incompatible_ranges in tests/test_merge_index.py to verify that merging indexes with incompatible trained ranges raises an exception and leaves both indexes unchanged.

Fixes #5599

@meta-cla meta-cla Bot added the CLA Signed label Sep 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexScalarQuantizer.merge_from() accepts incompatible trained ranges and silently decodes merged vectors incorrectly

1 participant