Maximum Marginal Relevance (MMR) is a greedy algorithm that iteratively selects documents or sentences by maximizing a linear combination of query relevance and information novelty. The core mechanism penalizes a candidate's similarity to items already chosen, ensuring the final ranked list or summary is both pertinent to the user's intent and diverse in content, directly combating the redundancy common in top-k retrieval results.
Glossary
Maximum Marginal Relevance (MMR)

What is Maximum Marginal Relevance (MMR)?
A greedy algorithm for information retrieval and summarization that balances the relevance of a sentence to a query with its novelty relative to already-selected sentences to reduce redundancy.
Formally, MMR computes a score for each unselected candidate D_i as λ * Sim(D_i, Q) - (1-λ) * max(Sim(D_i, D_j)), where Q is the query and D_j are already selected items. The parameter λ controls the relevance-novelty trade-off. This approach is foundational in extractive summarization and diverse retrieval, serving as a lightweight re-ranking step before final answer synthesis.
Key Characteristics of MMR
Maximum Marginal Relevance (MMR) is a greedy algorithm that constructs a ranked list by iteratively selecting items that maximize a linear combination of relevance to a query and novelty relative to items already selected.
The Core Trade-Off: Relevance vs. Novelty
MMR operates on a linear combination of two competing objectives. The first term measures query relevance—how similar a candidate document or sentence is to the original query. The second term measures maximum similarity to any item already selected for the output set. A tunable λ (lambda) parameter controls the balance. When λ=1, the algorithm behaves as a pure relevance ranker. When λ=0, it maximizes diversity by selecting items most dissimilar to everything already chosen. This explicit trade-off is what distinguishes MMR from simple deduplication heuristics.
Greedy Incremental Selection
MMR is a greedy algorithm, meaning it makes the locally optimal choice at each step without backtracking. The process begins by selecting the single most relevant item to the query. For each subsequent selection, the algorithm re-scores all remaining candidates by computing:
- Sim1: Cosine similarity between the candidate and the query.
- Sim2: The maximum cosine similarity between the candidate and any item already in the selected set. The candidate with the highest MMR score is added to the set, and the process repeats. This greedy approach is computationally efficient—O(n²) in the number of candidates—but does not guarantee a globally optimal diverse set.
Cosine Similarity as the Default Metric
The standard MMR formulation uses cosine similarity as its similarity function, operating on TF-IDF vector representations of text. Cosine similarity measures the cosine of the angle between two vectors, producing a score from -1 to 1, where 1 indicates identical orientation. In practice, MMR is embedding-agnostic. Modern implementations often substitute:
- Dense embeddings from models like BERT or Sentence-BERT for semantic similarity.
- Sparse lexical overlap metrics like BM25 for keyword-level relevance. The choice of similarity function fundamentally alters the behavior of the algorithm, with dense embeddings capturing paraphrastic relationships that TF-IDF would miss.
Application in Summarization Pipelines
In extractive summarization, MMR is applied to sentence selection. The algorithm treats the entire document or document cluster as the candidate set and the user query (or the document centroid) as the query vector. Key behaviors include:
- Redundancy elimination: Prevents selecting multiple sentences that convey the same information, a common failure mode of pure relevance ranking.
- Information coverage: By penalizing similarity to already-selected sentences, MMR implicitly maximizes the breadth of concepts covered in the summary.
- Query-focused summarization: When a specific query is provided, MMR balances answering the question directly with providing necessary context that a purely extractive approach might omit.
The Lambda Parameter in Practice
The λ parameter (typically in the range [0,1]) is the primary control knob for MMR behavior. Empirical guidance for common use cases:
- λ = 0.7 to 0.9: Standard information retrieval and search result diversification. Strong preference for relevance with moderate redundancy penalty.
- λ = 0.3 to 0.5: High-diversity summarization where covering distinct subtopics is prioritized over strict query alignment.
- λ = 1.0: Degrades to pure relevance ranking. Useful as a baseline ablation.
- λ = 0.0: Maximum diversity. The algorithm selects items maximally dissimilar to the current set, often producing an unfocused but highly varied output. Tuning λ requires domain-specific evaluation, typically measuring ROUGE or BERTScore against reference summaries.
Limitations and Modern Alternatives
MMR has several known limitations that motivate modern alternatives:
- Greedy suboptimality: The incremental selection can lock in early choices that prevent a globally better diverse set.
- Fixed similarity function: TF-IDF cosine similarity fails to capture semantic equivalence, leading to redundant selections of paraphrased content.
- No global coherence modeling: MMR selects sentences independently without considering how they flow together as a narrative. Modern approaches like Determinantal Point Processes (DPPs) provide a probabilistic framework for diverse subset selection with global normalization. Submodular optimization with monotone submodular functions like facility location offers theoretical guarantees on solution quality that MMR lacks. In neural systems, cross-encoder rerankers with diversity-aware training objectives have largely replaced MMR for production summarization.
Frequently Asked Questions
Clear, technical answers to the most common questions about the Maximum Marginal Relevance algorithm and its role in reducing redundancy in information retrieval and summarization.
Maximum Marginal Relevance (MMR) is a greedy algorithm for information retrieval and text summarization that constructs a ranked list or summary by iteratively selecting items that maximize a linear combination of relevance to a user query and novelty relative to items already selected. The core mechanism uses a parameter, lambda (λ), to control the trade-off. When λ is high, the algorithm prioritizes query relevance; when λ is low, it aggressively penalizes redundancy. The algorithm computes the marginal relevance of a candidate document D_i using the formula: MMR = argmax_{D_i ∈ R\S} [ λ * Sim_1(D_i, Q) - (1 - λ) * max_{D_j ∈ S} Sim_2(D_i, D_j) ], where R is the set of unselected candidates, S is the set of already selected items, Q is the query, and Sim is a similarity function, typically cosine similarity over TF-IDF or embedding vectors. This ensures the final set is both pertinent and diverse, avoiding the common pitfall of returning near-duplicate information at the top of a search result page.
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.
Related Terms
Understanding Maximum Marginal Relevance requires familiarity with the core retrieval and synthesis concepts it bridges. These terms define the input signals, competing objectives, and evaluation frameworks that MMR algorithms operate within.

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