Inferensys

Glossary

Maximum Marginal Relevance (MMR)

A query-focused summarization method that selects passages by balancing their relevance to the query against their redundancy with already-selected passages.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
QUERY-FOCUSED SUMMARIZATION

What is Maximum Marginal Relevance (MMR)?

A method for selecting passages that balances relevance to a query against redundancy with already-selected passages, ensuring diverse and informative summaries.

Maximum Marginal Relevance (MMR) is a query-focused summarization algorithm that iteratively selects passages by maximizing a linear combination of their relevance to a user's query and their novelty relative to passages already chosen. Originally proposed by Carbonell and Goldstein in 1998, MMR constructs a ranked list where each new selection is both highly pertinent to the information need and minimally redundant with the existing set, preventing repetitive content in the final summary.

The algorithm operates by computing a marginal relevance score for each candidate passage, defined as λ * Sim1(D_i, Q) - (1-λ) * max Sim2(D_i, D_j), where λ controls the relevance-diversity trade-off. In legal text summarization, MMR is particularly valuable for multi-document fusion tasks, such as synthesizing case law, where it ensures the summary captures distinct legal arguments from different precedents rather than repeatedly selecting semantically similar holdings.

Algorithm Mechanics

Key Characteristics of MMR

Maximum Marginal Relevance (MMR) is a query-focused summarization method that selects passages by balancing their relevance to the query against their redundancy with already-selected passages.

01

The Core Formula

MMR operates on a greedy selection principle formalized as:

MMR = argmax[ λ * Sim(D_i, Q) - (1-λ) * max Sim(D_i, D_j) ]

  • D_i: Candidate document or passage under consideration
  • Q: The user's query or information need
  • D_j: Documents already selected for the summary
  • λ (lambda): A tunable parameter between 0 and 1

When λ=1, the algorithm behaves as a standard relevance-only ranker. When λ=0, it maximizes diversity by aggressively penalizing similarity to already-chosen items.

02

The Diversity-Recency Trade-off

The λ parameter is the critical control knob that determines the relevance-diversity balance:

  • High λ (0.7-0.9): Prioritizes query relevance. Useful when the information need is narrow and focused, such as finding a specific contract clause.
  • Low λ (0.3-0.5): Prioritizes novelty and diversity. Essential for multi-document legal summarization where covering distinct precedents matters more than repeating the same point.
  • Default practice: Most legal AI implementations start at λ=0.5 and tune based on ROUGE and BERTScore evaluation against attorney-written summaries.

In legal contexts, a lower λ prevents the summary from redundantly restating the same holding from multiple citations.

03

Greedy Incremental Selection

MMR builds the summary one passage at a time using an iterative greedy algorithm:

  1. Compute relevance scores for all candidate passages against the query
  2. Select the single most relevant passage as the first item
  3. For each subsequent selection, compute the MMR score for every remaining candidate, penalizing similarity to all already-selected passages
  4. Repeat until the desired summary length is reached

This greedy approach is not globally optimal but is computationally efficient—O(n²) in the number of candidates—making it practical for large legal document collections where exhaustive search would be infeasible.

04

Similarity Functions

The effectiveness of MMR depends heavily on the choice of similarity metric:

  • TF-IDF Cosine Similarity: The original and still widely-used approach. Represents passages as sparse vectors weighted by term frequency-inverse document frequency.
  • Dense Embedding Similarity: Modern legal AI systems use embeddings from models like Legal-BERT or Instructor-XL to capture semantic similarity beyond keyword overlap.
  • Hybrid Approaches: Combining lexical (BM25) and semantic (dense vector) similarity scores often yields the best results for legal text, where precise terminology matters.

For cross-document alignment in multi-case analysis, embedding-based similarity is essential because different courts may use distinct phrasing for identical legal concepts.

05

Application in Multi-Document Legal Summarization

MMR is particularly well-suited for synthesizing multiple legal documents:

  • Case law synthesis: When summarizing 50+ precedents on a legal question, MMR ensures the output covers distinct holdings rather than repeating the most-cited case.
  • Contract portfolio review: Analyzing hundreds of vendor agreements for a specific clause type benefits from MMR's diversity mechanism to surface unique variations.
  • Regulatory change detection: MMR can select a diverse set of changed provisions across multiple amended statutes, preventing the summary from focusing exclusively on one section.

In practice, legal AI platforms combine MMR with source attribution so each selected passage retains a citation link to its originating document.

06

Limitations and Modern Extensions

Despite its widespread adoption, MMR has known limitations:

  • Greedy suboptimality: The incremental selection can miss globally better passage combinations
  • Static λ: A single λ value applies uniformly, but optimal trade-offs may vary across different sections of a summary
  • No semantic compression: MMR selects full passages verbatim; it cannot fuse information from two passages into a single, denser statement

Modern extensions address these gaps:

  • Adaptive MMR: Varies λ dynamically based on the information content already covered
  • Neural MMR: Replaces the hand-crafted formula with a learned scoring function trained on attorney-annotated summaries
  • Chain-of-Density integration: Uses MMR for initial passage selection, then applies abstractive compression to fuse selected content
UNDERSTANDING MMR

Frequently Asked Questions

Clear answers to the most common questions about Maximum Marginal Relevance and its application in legal document summarization.

Maximum Marginal Relevance (MMR) is a query-focused summarization algorithm that selects passages by balancing their relevance to a user's query against their redundancy with already-selected passages. The algorithm operates iteratively: it first identifies the most relevant passage to the query, then for each subsequent selection, it scores remaining candidates using a linear combination of their similarity to the query and their maximum similarity to any already-chosen passage. A tunable lambda parameter (typically between 0 and 1) controls this trade-off. When lambda is high, relevance dominates; when low, diversity is prioritized. In legal contexts, this prevents a summary from repeatedly selecting the same precedent or statutory citation, ensuring broad coverage of distinct legal arguments across a case corpus.

Prasad Kumkar

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.