-
Notifications
You must be signed in to change notification settings - Fork 441
Fix normalized cosine distance consistency for PQ graphs #1298
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
Open
juchen-ms (partychen)
wants to merge
9
commits into
microsoft:main
Choose a base branch
from
partychen:juchen-microsoft-fix-pq-graph-distances
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+124
−13
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
27f3858
Fix normalized cosine distances for PQ graphs
partychen a856d14
Address PQ distance review feedback
partychen 1012ce6
Simplify PQ cosine-normalized scaling
partychen 9431929
Clarify PQ cosine approximation
partychen 1d48e99
Fix hybrid cosine-normalized distance scaling
partychen ffdef64
Clarify hybrid normalized-cosine consistency
partychen 138baa7
Align PQ pruning distances with search
partychen 6948332
Cover Quantized PQ pruning distances
partychen f140b00
Add normalized cosine PQ integration coverage
partychen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Using raw squared L2 consistently may be valid while these values are used only for internal ordering and pruning, However, the resulting values no longer follow the standard
CosineNormalizedcontract if they are returned to or otherwise consumed by a caller as distances.The underlying issue seems to be that the Product-PQ
CosineNormalizedpaths already have different contracts:Overriding
CosineNormalizedwithL2in the pruning strategy hides the existing contract mismatch and also changesu8/i8from angular to Euclidean behavior.Aditya Krishnan (@arkrishn94) any thoughts on these contracts?
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.
Agreed on the contract distinction. The remapped computer here is module-private and used only by Vamana pruning; it is not returned as a
CosineNormalizeddistance, and the public PQ distance behavior remains unchanged.The narrow intent is to make
distance_jkuse the same approximation as the search-pooldistance_ik, since they participate in the same pruning ratio. I agree this does not resolve the broader Product-PQ contract inconsistency, particularly foru8/i8. If those inputs should preserve angular semantics, the query/PQ path and pruning path would need to be addressed together. I’m happy to follow the contract decision here.