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.
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
Learn it in a course
Sources and further reading
- https://www.mlforseo.com/machine-learning-implementation-guides/keyword-research/how-to-do-keyword-clustering-with-keybert/ MLforSEO
- https://www.mlforseo.com/machine-learning-tutorials/topic-modeling-clustering/topic-modeling-for-seo-with-bertopic/ MLforSEO
- Carbonell and Goldstein (1998), The use of MMR, diversity-based reranking for reordering documents and producing summaries
- KeyBERT documentation: Maximal Marginal Relevance
- BERTopic documentation: Topic representation models
Other terms from ML Models & Algorithms
- BERT (Bidirectional Encoder Representations from Transformers)Google's 2018 transformer language model that reads text in both directions to produce context-aware embedding…
- BERTopicA modular topic modelling technique that clusters transformer embeddings and labels each cluster with class-ba…
- BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies)BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies) clusters very large numeric datasets by s…
- BM25A classic ranking function that scores documents by how often query words appear, adjusted for word rarity and…
- Boyer-MooreA fast exact string-search algorithm that compares a pattern from right to left and skips ahead after mismatch…
- c-TF-IDFClass-based TF-IDF: treats each cluster as one document to find the words that best describe it, used by BERTo…
- Centroid-based ClusteringA clustering family that groups data around central points (centroids), each the average of its cluster's memb…
- Convolutional Neural Network (CNN)A deep learning architecture that scans data with small learned filters to detect local patterns; the classic…
- DBSCANDensity-based clustering that groups closely packed points, finds the number of clusters itself and labels iso…
