-
Notifications
You must be signed in to change notification settings - Fork 199
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
[BUG] Cagra index search segfaults for vectors with 1024+ dimensions #1948
Comments
@Ngalstyan4 CAGRA CUDA kernels are templated on the dataset dimension and we need to define a new template argument for larger dimensions. Some of these RAG embeddings go up to extremely large numbers of dimensions. Any specific range you'd are targeting or just as high as we can go? |
1536 dimensional openai embeddings are probably most widely used these days, so having support for that out of the box would be the primary ask. It would also be great to throw an informative error when the templates are used with unsupported vector sizes instead of segfaulting, as it happens now. |
Totally agree witht his. We're going to prioritize this, and do a PoC to at least enable 1536 in the meantime. We can work our way up to even higher dimensions depending on the perf of enabling 1536. For example, it might take some significant improvements to the CUDA kernels to support 4096 dims, but we'll know once we dive in. |
While integrating CAGRA into Lucene, I ran into this issue as well. It seems that dimensions of more than 1024 segfaults while running search. Here is how we encountered this issue. |
This PR updates the CAGRA search implementation to support 1024+ dim vectors. For 1024+ dim vectors, the distance between a vector and the query vector is calculated by splitting the vector into multiple 1024 dim vectors and accumulating the distances of each sub-vector. Rel: #1948 Authors: - tsuki (https://github.com/enp1s0) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #1994
Describe the bug
Cagra index creation via the CPP api (
cagra::build
) seems to succeed for vectors of dimension 1025 but search (cagra::search
) results in a Segmentation Fault.The issues exists both in the cuda API and in the runtime API of cagra.
Steps/Code to reproduce bug
Change this line in cagra example to
int64_t n_dim = 1025;
, compile and run. This should cause a segmentation fault.To test on the runtime API, use
raft::runtime::neighbors::cagra::{build, search}
in place ofraft::neighbors::cagra::{build, search}
.Expected behavior
Expected the index creation and search to succeed without any issues, as it does for smaller dimensional vectors.
Environment details (please complete the following information):
Additional context
This is important because OpenAI embeddings are 1536 dimensional. There are many other models that produce 1024+ dimensional embeddings.
The fix might be as simple as adding an element to this array but I have not tried it.
The text was updated successfully, but these errors were encountered: