Zenaique

What Maximal Marginal Relevance does for retrieved results

Flashcard·Easy·4.0 · 0·~30s·Asked atKrutrimTcs
Attempt it
TL;DR

MMR picks chunks one at a time, rewarding query relevance but penalizing similarity to chunks already chosen — so the top-k covers different facets instead of repeating one.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine you ask five friends to recommend a movie and four of them say the exact same film. You've technically gotten five answers, but you only learned about one movie. A smarter approach: after the first friend names a movie, you ask the next one for something different and just as good. That way your short list covers comedy, thriller, and drama instead of the same blockbuster five times. MMR does this for the passages a search pulls up. It still wants pieces that match your question, but each time it picks one, it docks points from anything that just repeats what it already grabbed. So the handful of passages you end up feeding the model cover several angles of your question rather than saying one thing over and over.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Retrieval quality is usually framed as "did we find the relevant chunks?" That's recall, and it's the first thing to get right. But there's a second, quieter failure that bites well-tuned systems: the chunks you find are all the same chunk. Five passages that each restate one fact look like five good results and behave like one.

Maximal Marginal Relevance is the standard, cheap fix for that. It's a small idea with an outsized effect on how an answer reads, and it shows up everywhere from LangChain retrievers to summarization pipelines. The reason it's worth understanding precisely is that people routinely misremember what it does. It is not a better retriever and it is not a reranker for relevance. It is a diversifier, and knowing exactly which problem it solves — and which it can't — is the whole point of the question.

The stakes rise as context budgets tighten. Every chunk you place in the prompt costs tokens and dilutes the model's attention, so a slot spent on a duplicate is a slot stolen from a fact the answer needed. MMR is the tool that protects that budget without a heavier reranker, which is why it remains a default option on almost every vector retriever even in 2026.

The redundancy trap in plain top-k retrieval

Ordinary dense retrieval scores every chunk by similarity to the query and returns the highest few. On paper that's optimal: you get the most relevant passages. In practice, relevance and redundancy travel together.

Real corpora repeat themselves. Documentation restates the same install command on three pages. A news event is covered by ten outlets that all paraphrase the same wire copy. Internal wikis duplicate a policy across team spaces. When you ask a question that one of these clusters answers, every member of the cluster scores high, so the top-5 fills up with near-identical passages.

The cost is concrete. The context you hand the model is a fixed budget — a fixed number of tokens. Spend five slots on one fact and you've crowded out the other facets the question needed. For a query like "compare the cost and latency of X," plain top-k might return five chunks about cost and none about latency, and the answer comes back half-complete. The retriever did its job by its own metric; the metric was just the wrong one for building a good context set.

The MMR selection rule, one pick at a time
The lambda knob and what its extremes do
Where MMR fits — and where rerankers and dedup take over
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • LangChain and LlamaIndex both expose an MMR search mode on vector retrievers, with a lambda-style parameter to trade relevance against diversity.
  • A documentation chatbot whose top-5 chunks were all the same install-step paragraph; switching to MMR surfaced install, config, and troubleshooting instead.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does MMR differ from using a cross-encoder reranker for the same top-k?
A

A reranker re-scores each candidate's relevance to the query independently; MMR re-scores relative to what's already selected to suppress redundancy. They optimize different things and are often combined: rerank for relevance, then MMR or dedup for diversity.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Thinking MMR improves relevance; it trades a little relevance for diversity, so the result set stops repeating the same fact across several near-duplicate chunks.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • What redundancy problem MMR exists to solve

  • The greedy one-at-a-time selection over an existing candidate pool

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Which metric best measures whether a RAG answer is grounded in the retrieved context?
MCQ·Medium