Does Weaviate Vector Search Reranking the ANN Results?

I saw there is a reranking module, but it’s reranking with another criteria. Is Weaviate performing build-in reranking upon vector searching?

Here is what I mean by “reranking”:

For ANN algorithm, the results are approximate. So, it might be helpful to perform a two-stage ranking.

Exmaple:
Stage1: ANN for top100 entities, the vectorDB will not traverse through all the entities.
Stage2: Reranking with traversing through the 100 entities, to find the top10.

hi @leonxia1018 ! Welcome to our community! :hugs:

Apart from the reranking module, as you mentioned, there isn’t a second search stage as you mentioned.

It could potentially be done, by leveraging the custom reranker

but that will indeed be a reranking.

Also, it only makes sense if the second search term is different from the first one, right?

Hi @DudaNogueira,
Based on my understanding, even if the second search term is the same as the first one reranking could sometimes also make sense.

As Weaviate use ANN, so searching on a large dataset you will get an approximate result.

Let’s say you want to find top10 in the collection.
In the example I mentioned before, stage2 does not apply ANN algorithm but calculating the similarity of each result from stage1 (top 100 entities).

This will reduce the accuracy loss of ANN by increasing the sampling size from 10 to 100.

I am not sure it would make a difference :thinking:

That’s because the 100 initial objects will be sorted out by the distance from the vector of the query you performed.

On that case, you can perform the second stage query yourself, doing 2 requests.

So, first stage, perform the search. Now you get 100 UUIDs.

Second stage, you filter out only those 100 UUIds (using contains any by property id) and pass the query you want (the same or a different one)

That would achieve what you are looking for.

Let me know if this helps and also I am curious about your findings :slight_smile: