-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Feature: Excluding vectors from search #40
Comments
An example would be: My query vector is actually a manual car but i would like to exclude the red ones from search. |
Hi! First, I think it is misleading to use semantic analogies. Faiss is not a SQL database engine with symbolic representations like red / manual There is no easy way of restricting elements from the search. The reason is because Faiss mainly relies on scanning strings of codes and computing distances. During the scan, it accesses the corresponding ID only if the code corresponds to a potentially interesting item. Skipping over some of the codes would require to do some ID-dependent operation, which slows the processing down. The most sensible thing to do is to query Faiss with a larger k than needed and filter out the irrelevant results post-hoc. |
@iNDicat0r: this is currently not implemented, since this would probably require some specific callback function to test whether an entry satisfies the external constraints, which could be of any kind and therefore out of the scope of a core library. We already have encountered this problem, and discussed about two possible turn-around strategies:
|
Gentlemen thanks for the quick responses. I completely understand that we are not talking about b-trees and sql like searches here, however there are scenarios where accuracy might be more important than efficiency. In any case the multiple index approach sounds applicable in my case(doing a classification first and use the classification label as an index???!!) |
Same scenario like @iNDicat0r . Otherwise, we need build [ number of attributes * categories of each attribute ] indexes. For example,
Sometimes, we only want all Toyotas, or all blue ones. |
Imagine a set of 1000 vectors, each vector is linked to an entity(images in my case) and lets say i perform a knn lookup with k = 5, now i would like to examine the scenario of dynamically excluding vectors based on some criteria.
Is this even possible?
The text was updated successfully, but these errors were encountered: