# Rerank with HybridFusion.RELATIVE\_SCORE - How many are ranked?

**URL:** <https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212>\
**Category:** Support\
**Created:** [May 6, 2024, 9:15pm UTC](https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212 "2024-05-06T21:15:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gene\_Mc](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/gene_mc/32/1095_2.png) [@Gene\_Mc](https://forum.weaviate.io/u/Gene_Mc)\
**Post date:** [May 6, 2024, 9:15pm UTC](https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212/1 "2024-05-06T21:15:52Z")

</div>

### Description

Trying to understand what is actually happening with the combination of  
rerank with HybridFusion.RELATIVE\_SCORE.

HybridFusion.RELATIVE\_SCORE documentation says:  
[“To mitigate this effect, Weaviate automatically performs a search with a higher limit (100) and then trims the results down to the requested limit.”](https://weaviate.io/developers/weaviate/api/graphql/search-operators#oversearch-with-relativescorefusion)

If I specify a limit in the search query:

```auto
response = collection.query.hybrid(
    query=instring,
    alpha=0.6, #proportion of vector search 1.0 = 100% vector
    return_metadata=wvc.query.MetadataQuery(
                    score=True,
                    distance=True,
                    explain_score=True),
    fusion_type=HybridFusion.RELATIVE_SCORE,
    limit=8,
    rerank=Rerank(
        prop="search_text",
        query=instring
    ),
)

```

The code above works fine and returns both the normalized hybridFusion normalized scores and the rerank scores.

Does the rerank “rerank” only the limit=8 documents, or does it rerank the 100 initial documents retrieved by HybridFusion.RELATIVE\_SCORE behind the scenes?

I’d prefer a wider rerank, just unclear on what this combination does…  
If I want to rerank the top 50 documents, I guess I could start with limit=50 then trim the result to the final top 8?

### Server Setup Information

- Weaviate Server Version: 1.24.1
- Deployment Method: docker
- Multi Node? Number of Running Nodes: 1
- Client Language and Version: python 4.5.5

### Any additional Information

all above

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [May 6, 2024, 9:57pm UTC](https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212/2 "2024-05-06T21:57:26Z")

</div>

hi @Gene_Mc !!

Weaviate will do a 2 phase process. It will first perform the search you requested (hybrid, near vector, etc), and subsequently it will pass over those objects to the reranker module to get them resorted.

So on your case, it will only perform the rerank over the 8 objects, as your limited for your query.

from:

> **[Reranking | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/concepts/reranking)**
>
> Reranking seeks to improve search relevance by reordering the result set returned by a retriever with a different model.

Let me know if this helps!

Thanks!

---

<div class="post-metadata">

**Author:** ![Gene\_Mc](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/gene_mc/32/1095_2.png) [@Gene\_Mc](https://forum.weaviate.io/u/Gene_Mc)\
**Post date:** [May 7, 2024, 10:22pm UTC](https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212/3 "2024-05-07T22:22:48Z")

</div>

Hi @DudaNogueira

This answer does help me understand, so I’ve gone the route of returning 100 documents then plucking the top N for my RAG application.

```auto
        response = collection.query.hybrid(
            query=instring,
            alpha=0.6, #proportion of vector search 1.0 = 100% vector
            return_metadata=wvc.query.MetadataQuery(
                score=True,
                explain_score=True,
                ),
            limit=100,
            fusion_type=HybridFusion.RELATIVE_SCORE,
            rerank=Rerank(
                prop="page_content",
                query=instring
            ),
        )

```

This combination works pretty well… maybe too well? Now I wish I had an easy way to add back some diversity and/or eliminate redundancy… I’ll keep reading…

thank you for your help!

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [May 8, 2024, 12:16am UTC](https://forum.weaviate.io/t/rerank-with-hybridfusion-relative-score-how-many-are-ranked/2212/4 "2024-05-08T00:16:51Z")

</div>

That’s great, @Gene_Mc !!

Let us know if you have any other doubts along your journey learning those cool technology 🕶

Just be aware that with more objects being passed to rerank, costs will be higher 🤑

We are here to help!

Thanks!
