ML Models & Algorithms

Maximal Marginal Relevance (MMR)

In shortA re-ranking method that picks results that are relevant to a query but different from each other, reducing redundancy in keywords, topics or search results.

Updated 24 Oct 2026· 2 min read

Maximal Marginal Relevance (MMR) is a method for selecting a list of items that are both relevant and diverse. Introduced by Carbonell and Goldstein in 1998 for search results and summaries, it adds one item at a time, each time choosing the candidate that is most relevant to the query while being least similar to what has already been chosen. In SEO tooling it appears as the “diversity” setting in KeyBERT and BERTopic.

How it works

For each remaining candidate, MMR calculates a score that balances two parts: similarity to the query or document (relevance) minus its highest similarity to any item already selected (redundancy). A parameter, often called lambda or diversity, sets the balance. With no diversity, MMR behaves like a plain relevance ranking; with high diversity, it favours variety even at some cost to relevance. Similarities are usually cosine similarities between embeddings.

In KeyBERT you switch it on with use_mmr=True and a diversity value between 0 and 1. In BERTopic it is available as a representation model that refines each topic’s keywords after c-TF-IDF has produced the candidates.

How it’s used in SEO and marketing

  • Keyword extraction: avoiding lists such as “seo tool, seo tools, best seo tool” in favour of distinct concepts.
  • Topic labels: making BERTopic topic words more varied and readable.
  • Search and AI retrieval: diversifying retrieved passages so a RAG system or an AI search answer is not built from five near-identical sources; MLforSEO’s synthetic queries lesson lists MMR among the diversity controls in query fan-out.
  • Content recommendations: “related posts” that are relevant without all covering the same angle.

Example

Extracting five keywords from a guide on redirect mapping without MMR might return “redirect mapping”, “redirect map”, “mapping redirects”, “redirects” and “301 redirects”. With MMR at a diversity of around 0.5, the list could become “redirect mapping”, “site migration”, “fuzzy matching”, “404 errors” and “Python”, which describes the page far better.

Limitations and things to watch

  • The diversity value needs tuning per data set; too high and irrelevant terms creep in.
  • MMR only reorders candidates. If the candidate list is poor, the output will be too.
  • It is greedy (one item at a time), so it does not guarantee the best possible set.
  • For an AI search system, the implication is practical: a page that repeats what other sources say is easier to drop as redundant, which links MMR to information gain.

Learn it on MLforSEO

Where Maximal Marginal Relevance (MMR) shows up on MLforSEO

Sources and further reading

Other terms from ML Models & Algorithms

See all 50 ML Models & Algorithms terms →