# 最大边际相关性

**最大边际相关性**（Maximal marginal relevance，MMR）是信息检索中的一种排序准则，它通过将文档与查询的相关性同文档与已选文档之间的不相似度进行加权组合，来逐篇选取文档，从而使结果集能够覆盖信息需求，而不至于充斥冗余的近重复内容。该方法由卡内基梅隆大学语言技术研究所的Jaime Carbonell和Jade Goldstein在1998年SIGIR会议上的一篇论文中提出，至今仍是现代向量搜索和检索增强生成（RAG）系统中标准的多样化步骤。<sup>[1](https://doi.org/10.1145/290941.291025)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | Carbonell与Goldstein，《MMR的应用：基于多样性的重排序，用于文档重排和摘要生成》，SIGIR '98，墨尔本，第335–336页<sup>[1](https://doi.org/10.1145/290941.291025)</sup> |
| 核心思想 | 若一篇文档既与查询相关，又与先前已选文档的相似度极低，则它具有较高的边际相关性<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup> |
| 权衡参数 | λ = 1 退化为标准的相关性排序列表；λ = 0 给出最大多样性排序；中间值则优化两者的线性组合<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup> |
| 推荐策略 | 先以较小的λ（约0.3）对信息空间进行采样，再用重新表述的查询和较大的λ（约0.7）重新聚焦<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup> |
| 典型实现 | 先获取较大的候选池（例如LangChain中fetch_k = 50），再以多样性权重（通常为0.5）重排序至最终的k个结果<sup>[3](https://api.python.langchain.com/en/latest/community/vectorstores/langchain_community.vectorstores.vectara.Vectara.html)</sup> |
| 最强的原始结果 | 非冗余的多文档摘要，其中MMR段落选择明显优于非MMR选择<sup>[4](https://www.researchgate.net/publication/2269571_The_Use_of_MMR_Diversity-Based_Reranking_for_Reordering_Documents_and_Producing_Summaries)</sup> |

## 算法

传统搜索引擎按与查询相关性递减的顺序返回文档。Carbonell和Goldstein主张将“相关的新颖性”作为附加准则：当许多检索到的文档彼此高度冗余，或部分或完全重复时，纯粹的相关性排序会将用户的注意力浪费在重复信息上。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>由于在词袋模型下没有直接度量新颖且相关的信息的方法，他们提出了一个初步近似：分别度量相关性和新颖性，再将二者线性组合。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>

给定查询\( Q \)、排好序的候选列表\( R \)，以及已选文档集合\( S \)，MMR迭代地从\( R \setminus S \)中选取使下式最大化的文档\( D_i \)：

\[ \operatorname{MMR} = \operatorname{Arg\,max}_{D_i \in R \setminus S} \left[ \lambda \cdot \mathrm{Sim}_1(D_i, Q) - (1-\lambda) \cdot \max_{D_j \in S} \mathrm{Sim}_2(D_i, D_j) \right] \]

其中\( \mathrm{Sim}_1 \)度量查询与文档的相似度，\( \mathrm{Sim}_2 \)度量候选文档与已选文档之间的相似度；这两个度量可以相同（例如余弦相似度），也可以不同，并且可以为\( \mathrm{Sim}_2 \)使用更精确但代价更高的度量，因为它只作用于已检索的集合而非整个文档集。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>选择是贪心的：每次迭代加入一篇文档，并针对不断增长的已选集合重新计算惩罚项。<sup>[5](https://www.cs.cmu.edu/~alad/lad-thesis.pdf)</sup>

参数λ控制权衡。当λ = 1时，算法复现标准的相关性排序；当λ = 0时，产生最大多样性排序；介于两者之间时，优化两个准则的线性组合。希望围绕查询对信息空间进行采样的用户将λ设低，希望获得多篇重叠或相互强化的文档的用户将λ设得接近1。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>

## 原始评估

**用户研究。** 作者进行了一项初步实验，五名本科生在不知道使用何种排序方法的情况下搜索文档。多数人偏好MMR排序的结果，认为其更广泛、更有趣，并且在被要求为一项任务选择搜索方法时，80%的人选择了MMR。用户在导航和快速定位相关候选文档时偏好MMR，而在考察某一区间内的相关文档时偏好纯相关性排序。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>

**摘要。** MMR还被应用于基于查询的抽取式摘要，此类摘要从构造上就必须避免冗余。在1998年5月对15个摘要系统进行的SUMMAC评测中，基于MMR的摘要器生成的查询相关摘要效用最高，F值为0.73，在信息性摘要上以70%的准确率得分最高，但需注意各系统的摘要长度有所不同。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>在10%和25%压缩率下的句子精度测试中，λ = 1、λ = 0.7和λ = 0.3之间的差异在统计上不显著，作者将此归因于多样性加权重排序拾取了纯相关性摘要所遗漏的相关材料的情况。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup>最明显的优势出现在新闻集合的多文档摘要中，检索到的段落大量重复背景信息；MMR在前10个段落中减少或消除了这种冗余。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup><sup> • </sup><sup>[4](https://www.researchgate.net/publication/2269571_The_Use_of_MMR_Diversity-Based_Reranking_for_Reordering_Documents_and_Producing_Summaries)</sup>

## 在现代检索系统中的应用

MMR已成为各类向量数据库和检索框架中内置的重排序选项。典型模式是两阶段：先用普通相似度搜索检索较大的候选池，再应用MMR选出最终的k个结果。<sup>[6](https://docs.datastax.com/en/ragstack/examples/mmr.html)</sup>在[LangChain](https://www.edgepedia.org/zh/langchain)的向量存储接口中，`max_marginal_relevance_search`接受一个用于候选池的`fetch_k`参数（Vectara实现中默认为50）和一个介于0和1之间的`lambda_mult`多样性权重，其中0表示最大多样性，1表示最小多样性，默认为0.5。<sup>[3](https://api.python.langchain.com/en/latest/community/vectorstores/langchain_community.vectorstores.vectara.Vectara.html)</sup>OpenSearch在3.3版本中引入了MMR重排序，带有`diversity`参数（默认0.5，其中1优先最大多样性）和默认为请求结果数三倍的候选数量。<sup>[7](https://docs.opensearch.org/latest/vector-search/specialized-operations/vector-search-mmr/)</sup>[Elasticsearch](https://www.edgepedia.org/zh/elasticsearch)在ES|QL中提供了`MMR`命令，用于丢弃彼此过于相似的行，Google Cloud的文档也介绍了LangChain在Bigtable上使用的同样的重排序方法。<sup>[8](https://www.elastic.co/docs/reference/query-languages/esql/commands/mmr)</sup><sup> • </sup><sup>[9](https://docs.cloud.google.com/bigtable/docs/mmr-vector-search)</sup>

注意，各实现对该权衡的参数化方式不同。原始公式以λ加权相关性，以\( 1-\lambda \)加权冗余惩罚，因此λ = 1意味着纯相关性；OpenSearch则写作\( \mathrm{MMR} = (1-\lambda) \cdot \mathrm{relevance\_score} - \lambda \cdot \max(\mathrm{similarity\_with\_selected\_docs}) \)，因此λ越接近1意味着多样性越高。<sup>[2](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)</sup><sup> • </sup><sup>[7](https://docs.opensearch.org/latest/vector-search/specialized-operations/vector-search-mmr/)</sup>因此，在调参之前有必要阅读系统文档，确认其多样性参数的方向。

Google Cloud文档中的一个具体例子：对于“红番茄”这样的电商查询，k近邻向量搜索可能返回多个相同新鲜红番茄的商品列表，而MMR搜索旨在返回新鲜红番茄、罐装红番茄丁、有机樱桃番茄，或许还有一份番茄沙拉食谱。<sup>[9](https://docs.cloud.google.com/bigtable/docs/mmr-vector-search)</sup>

## 局限与替代方案

MMR的贪心局部选择在每一步直接以相关性换取多样性，这是后来多样性排序研究中指出的一个缺陷。在一项受控的生物医学RAG基准测试中，以固定的生成模型和嵌入在250个BioASQ问答对上比较五种检索策略，MMR为多样性牺牲了答案相关性，而稠密向量基线取得了0.822的综合得分，与最佳策略（交叉编码器重排序，0.827）相差不超过0.005分。<sup>[10](https://zenodo.org/records/19774692)</sup>

若干替代方案对该目标进行了改进或替换。行列式点过程以概率方式选取多样化子集，具有全局而非贪心的多样性保证。<sup>[11](https://www.researchgate.net/publication/403529895_Principled_and_Scalable_Diversity-Aware_Retrieval_via_Cardinality-Constrained_Binary_Quadratic_Programming)</sup>[IBM Research](https://www.edgepedia.org/zh/ibm-research)研究员Marc Pickett及其同事提出的相关信息增益度量将多样性视为对查询相关信息总量的概率度量的涌现属性，并在检索增强生成基准问答上报告了最先进的结果，优于直接优化相关性和多样性的度量。<sup>[12](https://arxiv.org/abs/2407.12101)</sup>专门的变体则重构了计算本身：DL-MMR是一种面向检索增强摘要的长度感知变体，避免了穷举式的成对示例比较，在相同信息量水平下报告了781,513倍的内存节省和500,092倍的计算成本降低；SMMR则应用采样来加速推荐和检索中的MMR重排序。<sup>[13](https://arxiv.org/abs/2503.09249)</sup><sup> • </sup><sup>[14](https://www.hse.ru/data/2025/07/04/1995597406/%D0%90%D0%BD%D0%B0%D0%BD%D1%8C%D0%B5%D0%B2%D0%B0_%D1%81%D1%82%D0%B0%D1%82%D1%8C%D1%8F%2012.pdf)</sup>在理论方面，MMR的目标函数已被刻画为非单调次模函数，从而将贪心算法与更广泛的次模最大化数学联系起来。<sup>[11](https://www.researchgate.net/publication/403529895_Principled_and_Scalable_Diversity-Aware_Retrieval_via_Cardinality-Constrained_Binary_Quadratic_Programming)</sup>

## References

1. [Jaime Carbonell, Jade Goldstein (1998). The Use of MMR, Diversity-Based Reranking for Reordering Documents and Producing Summaries. SIGIR '98, pages 335–336.](https://doi.org/10.1145/290941.291025)
2. [Carbonell & Goldstein SIGIR 1998 paper PDF, Carnegie Mellon University](https://www.cs.cmu.edu/afs/cs/Web/People/jgc/publication/MMR_DiversityBased_Reranking_SIGIR_1998.pdf)
3. [Vectara vector store, LangChain Python API reference](https://api.python.langchain.com/en/latest/community/vectorstores/langchain_community.vectorstores.vectara.Vectara.html)
4. [The Use of MMR, Diversity-Based Reranking for Reordering Documents and Producing Summaries, ResearchGate](https://www.researchgate.net/publication/2269571_The_Use_of_MMR_Diversity-Based_Reranking_for_Reordering_Documents_and_Producing_Summaries)
5. [A Framework for Evaluation and Optimization of Diversified Search (CMU thesis)](https://www.cs.cmu.edu/~alad/lad-thesis.pdf)
6. [VectorStore QA with MMR, RAGStack, DataStax Docs](https://docs.datastax.com/en/ragstack/examples/mmr.html)
7. [Vector search with MMR reranking, OpenSearch Documentation](https://docs.opensearch.org/latest/vector-search/specialized-operations/vector-search-mmr/)
8. [ES|QL MMR command, Elasticsearch Reference](https://www.elastic.co/docs/reference/query-languages/esql/commands/mmr)
9. [Perform Maximal Marginal Relevance search with LangChain on Bigtable, Google Cloud Documentation](https://docs.cloud.google.com/bigtable/docs/mmr-vector-search)
10. [Benchmarking Retrieval Strategies for Biomedical Retrieval-Augmented Generation, Zenodo preprint](https://zenodo.org/records/19774692)
11. [Principled and Scalable Diversity-Aware Retrieval via Cardinality-Constrained Binary Quadratic Programming, ResearchGate](https://www.researchgate.net/publication/403529895_Principled_and_Scalable_Diversity-Aware_Retrieval_via_Cardinality-Constrained_Binary_Quadratic_Programming)
12. [Marc Pickett and colleagues (2024). Better RAG using Relevant Information Gain. arXiv:2407.12101.](https://arxiv.org/abs/2407.12101)
13. [Considering Length Diversity in Retrieval-Augmented Summarization. arXiv:2503.09249.](https://arxiv.org/abs/2503.09249)
14. [SMMR: Sampling-Based MMR Reranking for Faster, More Diverse, and Balanced Recommendations and Retrieval](https://www.hse.ru/data/2025/07/04/1995597406/%D0%90%D0%BD%D0%B0%D0%BD%D1%8C%D0%B5%D0%B2%D0%B0_%D1%81%D1%82%D0%B0%D1%82%D1%8C%D1%8F%2012.pdf)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › 基础模型方法与训练 › 提示、推理与智能体

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/maximal-marginal-relevance

English original: https://www.edgepedia.org/maximal-marginal-relevance
