-
Notifications
You must be signed in to change notification settings - Fork 134
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
[BUG] Different score translations for ann search and exact search #2319
Comments
@wdongyu good catch! if we make the score calculation consistent, that should fix the problem. |
@VijayanB Thanks for the fix. I notice that you mention only the nmslib engine is affected with this change. But faiss engine also uses the scoreTranslation function, why is it not affected? |
My mistake, faiss doesn't support cosine similarity yet. But once it supports, we can also keep the consistent scores for all engines using cosine similarity, right? |
Yes. |
Will close this issue once i update doc |
What is the bug?
After introducing the settings
index.knn.advanced.approximate_threshold
in #2188, we may encounter such a scenario that two segments exist in one single shard. Suppose Segment_1 includes a graph and segment_2 does not, and they both include the same vector X.When we conduct a search with a vector Q, we will get two different scores for the same vector X, because score translations for ann search and exact search are sightly different. For example, for cosine metric we have a score(
1 / (2 - cos(Q, X))
) in ann search, but get another score ((1 + cos(Q, X)) / 2
) in exact search.How can one reproduce the bug?
Steps to reproduce the behavior:
index.knn.advanced.approximate_threshold
to -1, so that it never build a graph:index.knn.advanced.approximate_threshold
to 1, so that it always build a graph:What is the expected behavior?
Should get a consistent score for the same query and data vector.
What is your host/environment?
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
Add any other context about the problem.
The text was updated successfully, but these errors were encountered: