ModelRefs / Maximal Marginal Relevance (MMR) — AI Glossary

Maximal Marginal Relevance (MMR) — AI Glossary

A retrieval re-ranking algorithm balancing relevance to the query with diversity among selected documents.

Overview

MMR (Carbonell & Goldstein 1998) selects documents iteratively: pick the next document that maximizes relevance to the query minus similarity to already-selected documents. Prevents redundant, near-duplicate passages from filling the context window. Supported by LangChain retrievers and Pinecone, Weaviate, and Qdrant vector databases.

Reference details

Topicrag
Last reviewed2026-06-24

How it works

  1. The candidate set arrives already ranked by relevance, so this operates as a selection step rather than a retrieval one.
  2. The first item chosen is simply the most relevant, since there is nothing selected yet to be redundant against.
  3. Each subsequent choice maximises relevance to the query minus similarity to what is already selected, weighted by a parameter.
  4. That parameter sets the trade directly: at one extreme it reproduces the relevance ranking, at the other it selects for diversity almost regardless of relevance.
  5. The result is a set rather than a ranking — the output is chosen for coverage, which is a property of the whole selection and not of any item.

Example: What redundancy costs in a fixed budget

Top-5 by relevance returns five chunks, of which four are near-paraphrases of the same paragraph and one covers a second aspect. The model sees essentially two distinct facts in five slots, so 60% of the retrieval budget carried no new information. Selecting for marginal relevance might return three distinct aspects plus two supporting passages — the same five slots, roughly three times the distinct content. Nothing about the retriever improved; the selection stopped spending the budget on repetition.

Commonly confused with

A re-ranking step, but not a relevance reranker — a cross-encoder reranker asks which results are most relevant, while this asks which set is least redundant. Both reorder the candidates and they optimise for different things, so they compose: rerank for relevance, then apply this to stop the top-k being five near-identical chunks that crowd out the one covering the rest of the answer.

When to use it

Reach for it when:

  • Retrieval returns several near-duplicate passages that crowd out other aspects.
  • A fixed context budget must cover a question with multiple facets.
  • Summarising a corpus, where coverage matters more than ranking the single best passage.

Reach for something else when:

  • One precise answer is wanted, where diversity pulls in less relevant material.
  • The candidate set is already diverse, where the step adds computation and no benefit.
  • As a substitute for a relevance reranker — it optimises a different thing.

Continue your research

Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Maximal Marginal Relevance (MMR) — AI Glossary.

Frequently asked questions

What is Maximal Marginal Relevance (MMR)?

A retrieval re-ranking algorithm balancing relevance to the query with diversity among selected documents.

What concepts are related to Maximal Marginal Relevance (MMR)?

Closely related concepts include fusion retrieval, dense retrieval, context management.