-
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
USearch integration and potential Vector Search performance improvements #12502
Comments
I don't think we need a native implementation. JNI stuff can be dangerous. I honestly don't know the history around Lucene and if there have ever been considerations in the area before. I think we should work on making vector search better in Java. We have yet to hit the ceiling here in vector search & index performance in Java and Lucene. @uschindler what do you think? |
Hi Ash, (1) Have you compared usearch directly with Lucene? This could be a useful starting point: https://github.com/jbellis/hnswrecall (2) My understanding is that it is a design goal for Lucene to have zero external dependencies at all, but I'm not a committer so hopefully others will chime in. |
Yes:
|
If you want to integrate it with Lucene:
|
FYI, if you want to see how others implemented native kNN search using JNI in custom codecs, look here: https://github.com/opensearch-project/k-NN/tree/main/src/main/java/org/opensearch/knn/index (they support faiss and nmslib). The problems is that you also need to work around non-standard lucene segments due to legacy formats not following the Lucene file format conventions and WORM files. All I/O need to go through the Lucene I/O layers, if it does not work you need workarounds. Those should not live inside Lucene. |
Thank you, @benwtrent, @jbellis, and @uschindler! It's very insightful! Nmslib.java seems like the right place to start. |
Put it in an "examples" directory to show how to extend Lucene with JNI. If you have a $1m spend on Lucene you will figure out JNI issues. As accelerators pop up you will also likely want MOJO native drivers. |
Description
I was recently approached by Lucene and Elastic users, facing low performance and high memory consumption issues, running Vector Search tasks on JVM. Some have also been using native libraries, like our USearch, and were curious if those systems can be combined. Hence, here I am, excited to open a discussion 🤗
cc @jbellis, @benwtrent, @alessandrobenedetti, @msokolov
I have looked into the existing HNSW implementation and related PR - #10047. The integration should be simple, assuming we already have a JNI, that passes CI and is hosted on GitHub. The upside would be:
f16
support andi8
optional automatic downcasting.io_uring
-based kernel-bypass tricks, similar to what we have in UCall.This may automatically resolve the following issues (in reverse chronological order):
uint40_t
: Improve encoding of HNSW graph offsets [LUCENE-9845] #10884As far as I understand, it is not common to integrate Lucene with native libraries, but it seems like it can be justified in such computationally-intensive workloads.
f32
f32
f16
i8
I am happy to contribute, and looking forward to your comments 🤗
The text was updated successfully, but these errors were encountered: