Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Score Fix for Binary Quantized Vector and Setting Default value in case of shard level rescoring is disabled for oversampling factor #2183

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

Vikasht34
Copy link
Contributor

Description

Change1

Problem
In Disk Vector Mode, while calculating the score for a binary quantized vector, the system was incorrectly using Inner Product as the similarity function. However, for binary quantized vectors, the correct distance metric should be Hamming Distance.

Impact:
This incorrect scoring mechanism led to poor results, particularly in cases with multiple segments. During the process of reducing to the top k candidates, the best candidates (those with the most relevant results) were being filtered out. As a result, the recall was zero, meaning no relevant results were being returned, which critically affected the accuracy of search results.

Expected Behavior:
The system should use Hamming Distance for binary quantized vectors, ensuring that the correct similarity metric is applied. This would allow the best candidates to be retained during the top-k reduction process, thereby maintaining high recall and improving overall search performance in multi-segment scenarios.

Change 2:

Problem:
The system already had a setting to disable shard-level rescoring, allowing for rescoring at the segment level. However, with a recent PR, a default oversampling factor was reintroduced to be applied when the user did not explicitly provide one. Unfortunately, this default oversampling factor was being applied in both cases — regardless of whether shard-level rescoring was enabled or disabled. With Segment level , we don't need high oversampling factor.

Solution:
This PR introduces changes to ensure that the default oversampling factor is only applied when shard-level rescoring is disabled. When segment-level rescoring is enabled, the system overrides the default oversampling factor, ensuring the correct sampling factor is applied based on dimesion.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…se of shard level rescoring is disabled for oversampling factor

Signed-off-by: VIKASH TIWARI <[email protected]>
@naveentatikonda naveentatikonda merged commit 01d7981 into opensearch-project:main Oct 4, 2024
34 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 4, 2024
…se of shard level rescoring is disabled for oversampling factor (#2183)

Signed-off-by: VIKASH TIWARI <[email protected]>
(cherry picked from commit 01d7981)
jmazanec15 pushed a commit that referenced this pull request Oct 4, 2024
…se of shard level rescoring is disabled for oversampling factor (#2183)

Signed-off-by: VIKASH TIWARI <[email protected]>
(cherry picked from commit 01d7981)
Signed-off-by: John Mazanec <[email protected]>
jmazanec15 pushed a commit that referenced this pull request Oct 7, 2024
…ult value in case of shard level rescoring is disabled for oversampling factor (#2187)

* Score Fix for Binary Quantized Vector and Setting Default value in case of shard level rescoring is disabled for oversampling factor (#2183)

Signed-off-by: VIKASH TIWARI <[email protected]>
(cherry picked from commit 01d7981)
Signed-off-by: John Mazanec <[email protected]>

* Java Docs Fix for 2.x in Linux Machine (#2191)

Signed-off-by: VIKASH TIWARI <[email protected]>
Signed-off-by: John Mazanec <[email protected]>

---------

Signed-off-by: VIKASH TIWARI <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Co-authored-by: Vikasht34 <[email protected]>
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.

3 participants