# Get diverse search results with the MMR reranker

> Agno's new MMRReranker uses Maximal Marginal Relevance to pick knowledge results that are relevant but unlike each other, so near-duplicate chunks stop crowding out other answers.

- Published: 2026-09-23
- Author: Sannya Singal
- Categories: Changelog
- Canonical: https://www.agno.com/articles/get-diverse-search-results-with-the-mmr-reranker
- Markdown: https://www.agno.com/articles/get-diverse-search-results-with-the-mmr-reranker.md

Set `reranker=MMRReranker()` on Agno's `Knowledge`, and a help-center search for "I can't sign in to my account" also returns the SSO and two-factor recovery articles. Plain vector search can spend most of its results on three versions of the same password-reset article. The SSO article and two-factor recovery, which the user might have needed, fell off the list.

MMR, short for Maximal Marginal Relevance, picks results one at a time. Each pick discounts the remaining candidates by how similar they are to what it has already chosen, so a repeat of an answer ranks below a different answer.

```python
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reranker import MMRReranker

knowledge = Knowledge(
    vector_db=vector_db,
    reranker=MMRReranker(lambda_mult=0.5),
)
```

![The query "I can't sign in to my account" against six help articles in PgVector, top 4 results, real output. Plain vector search returns Locked out after failed attempts, Password reset email, then two repeats of the password reset article for web and mobile. MMRReranker with lambda_mult 0.5 keeps Locked out after failed attempts and Password reset email, then brings in Sign in with SSO and Recover two-factor access.](https://www.agno.com/images/v3-0-11-mmr-reranker.png)

`lambda_mult` sets the trade-off. 1.0 ranks by relevance alone, 0.0 by difference alone, and the default of 0.5 balances the two. `MMRReranker` fetches five candidates per requested result by default (`candidate_multiplier=5`), because it needs a pool to choose from. It embeds your query with the same embedder that indexed the documents.

MMR needs an embedding on every search result. PgVector, Qdrant vector and hybrid search, Chroma and LanceDB return one. Milvus, MongoDB, Redis, Valkey and Qdrant keyword search don't, and `MMRReranker` raises an error there so you never get unreranked results by surprise. Pinecone returns vectors when you build it with `return_vectors=True`.

Keep the order that `Knowledge.search()` returns. MMR scores each document against the ones it already chose, so its `reranking_score` values aren't in descending order, and sorting by them undoes the diversity.

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/07_knowledge/02_building_blocks/08_mmr_diverse_results.py), and learn more about the [MMR reranker](https://docs.agno.com/reference/knowledge/reranker/mmr) and [reranking](https://docs.agno.com/knowledge/concepts/search-and-retrieval/reranking) in the documentation.
