Maximum Marginal Relevance (MMR) is a greedy algorithm for information retrieval and text summarization that iteratively selects documents or sentences by maximizing a linear combination of query relevance and novelty relative to already-selected items. The core mechanism computes a marginal score: MMR = Argmax[ λ * Sim(D_i, Q) - (1-λ) * max Sim(D_i, D_j) ], where λ controls the relevance-redundancy trade-off and Sim is typically a cosine similarity metric over TF-IDF or embedding vectors.
Glossary
Maximum Marginal Relevance (MMR)

What is Maximum Marginal Relevance (MMR)?
A query-focused summarization and information retrieval metric that aims to reduce redundancy while maintaining relevance by balancing the novelty of a passage against its similarity to the query.
Developed by Carbonell and Goldstein in 1998, MMR directly addresses the problem of result set diversification in search engines and summarizers by penalizing passages that are too similar to previously ranked outputs. This prevents the common failure mode where top-k results are near-duplicates, ensuring the final set provides broad coverage of the information space. The technique is foundational to modern query-focused summarization, diversity-aware retrieval, and serves as a conceptual precursor to determinantal point processes in machine learning.
Key Characteristics of MMR
Maximum Marginal Relevance (MMR) is defined by a specific mathematical trade-off and distinct behavioral properties that differentiate it from pure similarity-based retrieval. The following cards break down its fundamental operating principles.
The Lambda-Driven Trade-Off
MMR operates via a linear combination of two competing scores controlled by the hyperparameter λ (lambda), typically set between 0 and 1.
- When λ = 1: The algorithm defaults to standard, greedy relevance ranking. It selects items solely based on their similarity to the query (maximizing Sim_1).
- When λ = 0: The algorithm maximizes novelty, selecting items that are maximally dissimilar to everything already chosen, regardless of the query.
- Standard Calibration: A λ of 0.5 to 0.7 is common in summarization to penalize redundancy without drifting off-topic.
The core formula is: MMR = argmax [ λ * Sim_1(D_i, Q) - (1 - λ) * max Sim_2(D_i, D_j) ]
Greedy Incremental Selection
MMR is a greedy algorithm, meaning it builds the final result set iteratively rather than finding the mathematically optimal global set.
- Process: It selects the single best item according to the MMR score, adds it to the summary set, and then recalculates the redundancy penalty for all remaining candidates against the newly expanded set.
- Computational Efficiency: This greedy approach avoids the combinatorial explosion of evaluating all possible subsets, making it scalable for real-time search and summarization.
- Order Dependency: Because it is greedy, the first item selected (which is always the most query-relevant) heavily influences the trajectory of the remaining selections.
Redundancy Penalization via Max Similarity
The novelty component of MMR does not penalize a candidate for its average similarity to the existing set; it penalizes it based on the maximum similarity to any single item already selected.
- Max Function: The term
max Sim_2(D_i, D_j)identifies the single most similar document already in the summary. - Diversity Guarantee: By subtracting this maximum similarity, MMR explicitly prevents the selection of near-duplicate content. If a candidate is highly similar to any existing summary member, its score is heavily penalized.
- Contrast with Centroid: This differs from centroid-based methods that push the summary toward the mean vector of the document cluster.
Dual Similarity Metric Flexibility
MMR abstracts the notion of 'similarity' into two distinct functions, Sim_1 (relevance) and Sim_2 (novelty), which do not need to be the same metric.
- Asymmetric Metrics: You can use a dense semantic embedding (e.g., cosine similarity of BERT vectors) for
Sim_1to capture topical relevance, while using a sparse lexical metric (e.g., Jaccard similarity or TF-IDF) forSim_2to penalize exact phrase overlap. - Cross-Modal Application: In video summarization,
Sim_1might measure visual similarity to a text query, whileSim_2measures temporal frame redundancy. - Practical Impact: This flexibility allows engineers to tune the algorithm to specific failure modes, such as penalizing verbatim repetition while rewarding semantic paraphrasing.
Context Window Independence
Unlike modern attention-based neural summarizers, MMR is a query-focused extractive model that operates without a learned context window limit.
- Extractive Nature: MMR selects whole sentences or passages verbatim from the source text; it does not generate new tokens or paraphrases.
- No Token Limit: The algorithm itself has no hard limit on input length, making it suitable for summarizing very long documents where transformer-based models might exceed their maximum context length.
- Comparison to RNNs: It avoids the recency bias found in recurrent neural networks, treating the first and last sentences of a document with equal statistical weight in the similarity matrix.
Carbonell & Goldstein (1998) Origin
MMR was introduced in the seminal 1998 paper 'The Use of MMR, Diversity-Based Reranking for Reordering Documents and Producing Summaries' by Jaime Carbonell and Jade Goldstein.
- Original Domain: It was initially designed for information retrieval to re-rank search engine results, ensuring the top 10 results were not merely 10 copies of the same document.
- Adaptation: It was rapidly adopted by the NLP community for multi-document summarization, where redundancy is the primary failure mode.
- Enduring Legacy: Despite the rise of neural abstractive summarization, MMR remains a strong, unsupervised baseline due to its transparency and lack of training data requirements.
MMR vs. Other Retrieval and Summarization Metrics
A technical comparison of Maximum Marginal Relevance against other core metrics used in information retrieval and text summarization tasks.
| Feature | MMR | TF-IDF | BM25 |
|---|---|---|---|
Primary Objective | Maximize relevance while minimizing redundancy | Measure term importance in a document relative to a corpus | Rank documents by probabilistic relevance of query terms |
Redundancy Handling | |||
Query-Document Similarity Basis | Cosine similarity of vector embeddings | Term frequency-inverse document frequency weighting | Probabilistic relevance framework with term saturation |
Diversity Mechanism | Linear combination penalty parameter (λ) | ||
Parameter Tuning Required | λ (lambda) balance parameter | None (deterministic) | k1 and b parameters |
Computational Complexity | O(n^2) for pairwise document comparisons | O(n) for term vector calculation | O(n) for term scoring |
Primary Use Case | Summarization and result set diversification | Keyword extraction and document indexing | Document retrieval and search ranking |
Handles Semantic Meaning |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technical answers to the most common questions about Maximum Marginal Relevance, its mechanisms, and its role in modern information retrieval and AI-driven content summarization.
Maximum Marginal Relevance (MMR) is a query-focused summarization and information retrieval metric that aims to reduce redundancy while maintaining relevance by balancing the novelty of a passage against its similarity to the query. The algorithm operates by iteratively selecting documents or sentences that maximize a linear combination of two scores: relevance to the user's query and dissimilarity to already-selected items. The core formula is MMR = Argmax[λ * Sim(D_i, Q) - (1-λ) * max Sim(D_i, D_j)], where λ is a tunable parameter controlling the relevance-novelty trade-off. When λ=1, the algorithm behaves like a standard relevance-only ranking; when λ=0, it maximizes diversity regardless of query relevance. This mechanism prevents the common retrieval failure mode where top-ranked results are near-duplicates that crowd out diverse, useful information. MMR was originally proposed by Jaime Carbonell and Jade Goldstein in their 1998 SIGIR paper and has since become foundational in extractive summarization, search result diversification, and RAG pipeline optimization.
Related Terms
Core concepts that intersect with Maximum Marginal Relevance in retrieval pipelines, summarization, and AI-driven content selection.
BM25 (Best Match 25)
A bag-of-words retrieval function that ranks documents by term frequency saturation and inverse document frequency. Unlike MMR, BM25 scores each document independently against the query without considering redundancy among results. It serves as the relevance baseline that MMR then re-ranks by penalizing documents too similar to already-selected passages. The k1 and b parameters control term frequency saturation and document length normalization respectively.
TF-IDF (Term Frequency-Inverse Document Frequency)
A foundational numerical statistic measuring word importance as the product of how often a term appears in a document and how rare it is across the corpus. MMR extends TF-IDF's core insight—that not all matching terms are equally valuable—by adding a diversity constraint. While TF-IDF treats each document independently, MMR explicitly models inter-document similarity to suppress near-duplicate content in result sets.
TextRank
A graph-based ranking algorithm inspired by PageRank that identifies key sentences or keywords by modeling text as a co-occurrence network. TextRank scores sentences by their centrality in the similarity graph, naturally surfacing diverse yet representative content. MMR and TextRank share the goal of reducing redundancy in extractive summarization, but MMR explicitly balances novelty against a query, while TextRank relies purely on graph structure.
Contrastive Learning
A self-supervised learning paradigm where models learn representations by pulling positive pairs (similar data points) together and pushing negative pairs apart in embedding space. The InfoNCE loss function used in contrastive learning formalizes a trade-off analogous to MMR's relevance-novelty balance. Models like SimCSE apply this to sentence embeddings, creating vector spaces where MMR-style diversity selection can operate efficiently on dense representations rather than sparse lexical features.
Latent Dirichlet Allocation (LDA)
A generative probabilistic model that discovers abstract topics within document collections by assuming each document is a mixture of topics and each topic is a distribution over words. LDA provides an alternative approach to diversity: instead of MMR's greedy pairwise comparison, LDA ensures coverage by selecting documents from different latent topic distributions. This topic-level diversity is computationally lighter but less precise than MMR's instance-level redundancy penalty.
Knowledge Distillation
A model compression technique where a smaller student model learns to mimic the output distribution of a larger teacher model. In retrieval contexts, MMR's diversity logic can be distilled into a learned scoring function: the teacher system applies explicit MMR re-ranking, and the student learns to predict the diversified ranking directly. This preserves MMR's redundancy suppression behavior while reducing inference latency for production search systems.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us