A gpu index to be searched once and reset repeatedly (vs knn_gpu
)
#2813
Unanswered
SomeoneSerge
asked this question in
Q&A
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to decide on accommodating approximate 3NN queries of the following form:
...or, with an index (I assume this can get me further than the brute-force
knn_gpu
),I can afford quite a leeway accuracy-wise if quantization or such is of any help. In fact, I don't care about the distances, only about the ranking. I cannot afford much time on an iteration. I wish to avoid any GPU-CPU roundtrips (AFAIU,
OPQ
is only implemented for the CPU? Also, I still haven't exactly wrapped my head around what and when is being quantized when I use OPQ/PQ, and how these options interact wit the inverted lists). So far I have tried a simple"IVF24000,PQ4"
, which costs me 50-200 sec/iteration and I need to go orders of magnitude lower . I noticed that the documentation suggests adding and querying vectors in batches, which I haven't tried, because I was under impression that I would have to beadd()
ing batches sequentiallyMy assumption is that all vectors
y
inY
are sufficiently separated, and that on average everyx
inX
corresponds to a uniquey
. I expect that if I had allocated a bin pery
inY
and put eachx
in just a handful of nearest bins (maybe using some quantization or hashing, but I'm not an expert in these matters), I would have ended up with more or less equally sized lists that could be traversed in parallel. Am I correct in thinking that under these assumptions, and given that data is already on the GPU, it should be possible to run the above loop at 100s of milliseconds per iteration?Is faiss an appropriate tool for this task? Would anyone have suggestions on choosing an index and/or preprocessing?
EDIT of 2023-04-07
Alright, my fault,
setDefaultNullStreamAllDevices()
makes this 20 sec/it, andreserveVecs
maybe cuts a few more seconds off the period. Got to get another two orders of magnitude down. I'm still naively usingIVF24000,PQ4
.EDIT of 2023-04-14
I see now that
reset()
only empties the lists, but does not reset the quantizer or remove centroid information.I also see that re-training is explicitly un-supported: #597.
Looking for a way to re-create an index from scratch without re-allocating the memory or relying on the garbage collector
#assignment #bipartite #icp #transport
Beta Was this translation helpful? Give feedback.
All reactions