-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Check node existence before making reverse link in HNSW graph indexing #15478
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
base: main
Are you sure you want to change the base?
Conversation
|
Ran some benchmark to compare performance. For the benchmark I ran two tests, 1st Benchmark Run: Indexed 100k docs with no deletes followed by force-merge. We are seeing around 2-3% drop in indexing rate and no regression in recall
2nd Benchmark Run: Indexed 100k docs followed by force merge. Then deleted 40% random docs again followed by force merge. Results are same as 1st run i.e around 2-3% drop in indexing rate without regression in recall
|
| } else { | ||
| NeighborArray nbrsOfNbr = hnsw.getNeighbors(level, nbr); | ||
| nbrsOfNbr.addAndEnsureDiversity(node, candidates.getScores(i), nbr, scorer); | ||
| updateNeighbor(hnsw.getNeighbors(level, nbr), node, candidates.getScores(i), nbr, scorer); |
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.
Is it possible to make this conditional on whether we're being called by the link repair process? We could add a parameter controlling whether the check is done
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.
Yes, definitely. Let me do this and raise new revision.
Description
Fixes #15467.
This PR implements a brute-force check to prevent duplicate reverse links during HNSW graph indexing. Before creating a reverse link, we iterate through all neighbors of the neighbor node to verify if the current node already exists in its neighbor list. If found, we skip creating the redundant reverse link, preventing duplicate edges in the graph.