-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement ACORN-1 search for HNSW #14085
base: main
Are you sure you want to change the base?
Conversation
Thank you for taking a stab at this @benchaplin ! I wonder if we can adjust the algorithm to more intelligently switch between the algorithms. something like:
The initial algorithm makes sense, we are trying to recover the graph connectedness for exploration. The bottom layer entry point is the initial "exploration zone". One idea also is that we allow multiple "exploration zones" from which we fan out finding the filtered values. These are just 🧠 ⚡ ideas. The initial numbers are promising. |
Hey @benchaplin there are a number of things broken with lucene util right now. Your recall numbers surprised me and I think they don't reflect actual performance. I am working on getting real numbers with some local patches & providing patches to Lucene util as I can. see: |
This is the branch I am using for testing recall/latency for filter cases for right now: https://github.com/mikemccand/luceneutil/compare/main...benwtrent:luceneutil:filter-testing?expand=1 |
Here are some benchmarks (100k float32[1024]). Baseline:
Candidate:
You can see until about 50% selectivity, latency & recall are worse in candidate. However, was we select even fewer than 50%, visited gets better, but recall suffers. This is likely because in the more restrictive cases we are actually dropping to brute-force because of excessive exploration (note the 1.0 recall in baseline). |
https://github.com/apache/lucene/compare/main...benwtrent:lucene:acorn_search?expand=1 Here are two of my ideas:
Tweaking the settings might take some steps. I also think there are things to do around:
|
Description
Playing around with some ideas from ACORN-1 to improve filtered HNSW search. The ideas are:
I benchmarked using Cohere/wikipedia-22-12-en-embeddings with params:
Here are some results:
Baseline:
Candidate (this code):
Pros: significantly faster for selective filters.
Cons: slightly worse recall across the board, slightly slower for inclusive filters.
There's a lot to play around with here, this code represents the best results I got with this testing. One thing that must be tested is correlation between filter and query vector (this is discussed and tested in the paper). luceneutil only offers zero correlation at the moment, so I'm working on adding a knob to turn there for future benchmarks.
Code should also be cleaned up, but for me, keeping everything in one method makes it easier to read the changes.