-
Notifications
You must be signed in to change notification settings - Fork 853
Add inner product metric to vector index #21814
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
Conversation
Happy to see you working on vector index again :) if I get this PR right, the difference between this and cosine is, that we do not normalize the vectors? |
Exactly, this one should be more efficient since we avoid normalization! 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See two small wishes in the comments. But I am also missing the place where the kCosine case and the inner product case differ w.r.t. normalization. Maybe I overlooked it, but can you explain to me where this difference is achieved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Scope & Purpose
Add inner product metric for vector index. Inner product metric is similar to the cosine metric except we won't normalize vectors on search and insertion. The example of using the inner product is here:
Also adding a new AQL function
APPROX_NEAR_INNER_PRODUCT
that uses vector index built with inner product metric. And using it in the query looks like this:Like in cosine metric with inner product metric, the bigger the similarity score more similar the vectors are, meaning we need to use
DESC
to get similar vectors.Checklist
Related Information
(Please reference tickets / specification / other PRs etc)