Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1623 +/- ##
========================================
Coverage 92.28% 92.29%
========================================
Files 633 634 +1
Lines 133933 134113 +180
========================================
+ Hits 123603 123776 +173
- Misses 10330 10337 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Reference Issues/PRs
What does this implement/fix? Briefly explain your changes.
Adds flat::binary_knn_search, an opt-in approximate search mode. It scans precomputed sign-bit signatures by Hamming distance, retains up to k × rescoring_factor candidate IDs, and asks the visitor to rescore those candidates with the original distance metric. Only the rescored distances determine the final top-k. Increasing rescoring_factor gives the second stage more candidates at the cost of additional vector reads and distance computations.
Any other comments?
Compared the two-stage search with exact
flat::knn_searchon two datasets of one million FP32 vectors each. All four configurations reached at least 99.9% mean Recall@K on the validation queries.rescoring_factorWe swept
rescoring_factoron 256 calibration queries per dataset and measured latency on 128 separate validation queries, with two interleaved runs per query on a single CPU thread. Both paths used inner product. OpenAI queries excluded their own source vector.The curves below show mean recall on the calibration queries. The lower panels zoom in on the 99.9% target. Diamonds mark the factors used for the latency comparison.
