Wrap dropped-FP scalar-quantized float values so scoring stays quantized - #16415
Open
Pulkitg64 wants to merge 1 commit into
Open
Wrap dropped-FP scalar-quantized float values so scoring stays quantized#16415Pulkitg64 wants to merge 1 commit into
Pulkitg64 wants to merge 1 commit into
Conversation
Contributor
|
I think I understand the problem, but I confess the design of these classes is confusing, and I don't know how to evaluate whether this fix is correct. A test would help a lot! |
Contributor
Author
|
Thanks @msokolov for taking a look. I agree this PR is incomplete without the test case. I will add a test case in next revision to simulate the failing behavior. |
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.
Description
When an index has had its raw full-precision float vectors dropped (the read-only "drop-FP" / searcher-node optimization, where the flat raw-vector file is empty and only the scalar-quantized bytes remain), Lucene104ScalarQuantizedVectorsReader#getFloatVectorValues returned the bare dequantizing view OffHeapScalarQuantizedFloatVectorValues.
As a result, the scorer returned by those FloatVectorValues scores documents on the float values obtained by dequantizing the stored quantized vectors. This diverges from the normal path (full-precision vectors present), where the scorer computes scores directly on the quantized vectors.
The fix wraps the OffHeapScalarQuantizedFloatVectorValues with the quantized vector values, so that when full-precision vectors are absent, scoring uses the quantized vectors directly instead of first dequantizing them to floats and scoring on those. This mirrors the normal path: when full-precision vectors are present they are wrapped with the quantized values, and scorer() returns a quantized vector scorer.
TODO:
Add test case to simulate the behavior