Skip to content

Wrap dropped-FP scalar-quantized float values so scoring stays quantized - #16415

Open
Pulkitg64 wants to merge 1 commit into
apache:mainfrom
Pulkitg64:fallback-quantized
Open

Wrap dropped-FP scalar-quantized float values so scoring stays quantized#16415
Pulkitg64 wants to merge 1 commit into
apache:mainfrom
Pulkitg64:fallback-quantized

Conversation

@Pulkitg64

Copy link
Copy Markdown
Contributor

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

@msokolov

Copy link
Copy Markdown
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!

@Pulkitg64

Copy link
Copy Markdown
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.

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.

2 participants