MB-64513: Removing modification of max codes based on filtered document size #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently max codes is the number of scans performed at the faiss level. Without prefiltering, every single scan leads to a computation as well.
With prefiltering however, the logic is slightly different. Max codes is reduced from a percent of the total number of vectors to a percent of the filtered documents. This implies that we scan through max codes percent of the filtered vectors. Looking into the faiss code paths, this is not the case. We scan through max codes number of vectors and then apply the filtered vectors first before the distance computation. This means that max codes takes precedence over filtering and there is a very high possibility of not scanning the filtered vectors.
This fix removes the dependency between prefiltering and max codes by not reducing the max codes number from total vectors length to filtered vector length.