Prefetch RaBitQ HNSW 1 bit code - #5630
Open
TamimEhsan wants to merge 1 commit into
Open
TamimEhsan wants to merge 1 commit into
TamimEhsan wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Due to the scattered memory access pattern of HNSW, much of the cpu stalls for the memory fetching. Other HNSW implementation hides it with interleaving 4 computation in a batch. For RaBitQ HNSW, Prefetch is the minimal fix to hide the latency issue.
Results
GIST-1M, d=960, M=32, nb_bits=9, efConstruction=40, 1.37 GB index, top-10, 1000 queries, single thread. 8 rounds with arm order alternating; median QPS per ef.
Why prefetch and not batching
Both were implemented and measured as a 2×2 on the same index and binary:
They are substitutes, not additive — "both" lands below prefetch alone. Each buys the same thing, several code loads in flight at once, and whichever applies first collects it. Prefetch is roughly twice the gain for a far smaller diff, so only it is proposed here.
Note
Alternative implementation is to use batch like other paths. Open to discuss and modify implementation.