# 排序

排序（ranking）的任务是把一组条目排出次序，使最相关、最受偏好或最重要的条目出现在列表靠前的位置。在信息检索中，针对一个查询对一组文档进行排序是一个核心问题；排序问题同样出现在推荐系统、协同过滤、生物特征认证和决策之中。<sup>[1](https://doi.org/10.1561/1500000016)</sup><sup> • </sup><sup>[2](https://arxiv.org/abs/1706.05933)</sup>

| 关键事实 | 具体内容 |
|---|---|
| 定义 | 构造一个模型或函数，按相关度、偏好度或重要度对对象排序<sup>[1](https://doi.org/10.1561/1500000016)</sup> |
| 传统方法 | 在监督式排序学习出现之前，使用的是 tf-idf、BM25 和语言模型等无监督打分函数<sup>[3](https://www.igi-global.com/chapter/from-tf-idf-to-learning-to-rank/137475)</sup> |
| 三种学习方式 | 逐点、逐对、逐列表，区别在于训练时把什么算作一个样本<sup>[1](https://doi.org/10.1561/1500000016)</sup> |
| 标准评价指标 | 归一化折损累计增益（NDCG）与平均精度均值（MAP）<sup>[4](https://ieeexplore.ieee.org/document/5170911/)</sup> |
| 基准数据集 | LETOR 数据集是各类排序学习方法进行实证比较的基准<sup>[1](https://doi.org/10.1561/1500000016)</sup> |
| 网络规模的应用 | 谷歌称其排序系统要筛检数千亿计的网页，并在几分之一秒内呈现结果<sup>[5](https://www.google.com/search/howsearchworks/how-search-works/ranking-results/?tab=suite)</sup> |
| 公平性研究 | NIST 于 2019 年在 TREC 上开设“公平排序”赛道，以度量排序系统中的偏差<sup>[6](https://www.nist.gov/news-events/news/2019/11/measure-bias-data-nist-initiates-fair-ranking-research-effort)</sup> |

## 排序学习

[排序学习](https://www.edgepedia.org/zh/learning-to-rank)（learning to rank）是排序任务的监督式机器学习表述：系统利用训练数据自动构造一个排序模型，从而能按相关度、偏好度或重要度对新的对象排序。<sup>[1](https://doi.org/10.1561/1500000016)</sup> 许多信息检索问题本质上是排序问题，检索技术可以借助这类方法得到增强。<sup>[1](https://doi.org/10.1561/1500000016)</sup> 这些方法也被应用于自然语言处理和数据挖掘。<sup>[7](https://www.jstage.jst.go.jp/article/transinf/E94.D/10/E94.D_10_1854/_article/-char/en)</sup>

在监督学习进入这一领域之前，文档是由 tf-idf、BM25 和语言模型等无监督函数打分的，这类函数为每篇文档给出的分数与训练样本无关。排序学习的框架则把排序函数本身视为应当从数据中学习得到的东西。<sup>[3](https://www.igi-global.com/chapter/from-tf-idf-to-learning-to-rank/137475)</sup>

**三种训练方式。** 微软亚洲研究院的刘铁岩在 2009 年发表于《信息检索基础与趋势》（*Foundations and Trends in Information Retrieval*）的一篇教程中，把已有算法归入逐点、逐对和逐列表三类，并分析了各自的长处与短处。<sup>[1](https://doi.org/10.1561/1500000016)</sup>

- 在逐点方法（pointwise）中，每篇文档被当作一个单独的样本，任务近似于对相关度做回归或分类。
- 在逐对方法（pairwise）中，学习时的样本是对象对；排序支持向量机（Ranking SVM）和 RankNet 等方法就是这样工作的。<sup>[8](https://www.microsoft.com/en-us/research/publication/learning-to-rank-from-pairwise-approach-to-listwise-approach/)</sup>
- 在逐列表方法（listwise）中，样本是整个对象列表，这反映了这样一个事实：排序是对列表的预测任务，而不是对孤立条目或条目对的预测任务。<sup>[8](https://www.microsoft.com/en-us/research/publication/learning-to-rank-from-pairwise-approach-to-listwise-approach/)</sup>

逐列表的表述由曹哲、秦涛、刘铁岩、蔡明峰和李航在 2007 年[微软研究院](https://www.edgepedia.org/zh/microsoft-research)的一份报告中明确提出，该报告引入排列概率和首位概率模型来定义逐列表损失函数，并用神经网络和梯度下降进行训练；他们在信息检索上的实验显示，逐列表方法的表现优于逐对方法。<sup>[8](https://www.microsoft.com/en-us/research/publication/learning-to-rank-from-pairwise-approach-to-listwise-approach/)</sup> 在 LETOR 基准数据集上的实证评估表明，逐列表方法在各类方法中最为有效。<sup>[1](https://doi.org/10.1561/1500000016)</sup>

统计学习文献记载了逐对损失的一个局限：最小化逐对损失未必能提升排序表现，而且排序结果可能偏向那些相关文档众多的查询，于是只含少量相关文档的查询可能排得很差，而整体表现看上去仍然很高。秦涛及其同事把逐列表损失称为查询级损失函数，并指出通常的逐对替代损失几乎无法推广到查询层面。<sup>[9](https://link.springer.com/article/10.1007/s10994-021-06122-3)</sup>

## 评价指标

排序质量要用为有序列表而非单一预测设计的指标来评判。两个被广泛使用的指标是归一化折损累计增益（NDCG）和平均精度均值（MAP）。<sup>[4](https://ieeexplore.ieee.org/document/5170911/)</sup> NDCG 既可用于二值相关判定，也可用于多级相关判定；而 MAP 是一种二值指标，适用于相关标签为 0 或 1 的情形。<sup>[10](https://xgboost.readthedocs.io/en/release_3.2.0/tutorials/learning_to_rank.html)</sup>

指标的选择对训练和评价同样重要。被广泛使用的梯度提升库 XGBoost 通过基于 LambdaMART 的目标函数实现排序学习，LambdaMART 是 LambdaRank 框架在梯度提升树上的改造；它的默认目标是 `rank:ndcg`。<sup>[11](https://xgboost.readthedocs.io/en/release_3.0.0/tutorials/learning_to_rank.html)</sup> LambdaMART 是一种逐对模型，它对一个查询组内每一对样本比较相关度，并为每一对计算一个代理梯度，用 NDCG 等排序指标对逻辑损失进行缩放，从而把排序信息带入损失之中。<sup>[11](https://xgboost.readthedocs.io/en/release_3.0.0/tutorials/learning_to_rank.html)</sup><sup> • </sup><sup>[10](https://xgboost.readthedocs.io/en/release_3.2.0/tutorials/learning_to_rank.html)</sup> 这种指标缩放是否真的比未缩放的逐对损失更有效，仍有争议。<sup>[10](https://xgboost.readthedocs.io/en/release_3.2.0/tutorials/learning_to_rank.html)</sup>

## 从用户反馈中学习

点击和其他隐式反馈是丰富而廉价的训练信号，但它们带有偏差。位置偏差是最明显的一例：文档显示在哪个名次，极大地影响它能获得多少点击，因此在排序学习中直接把点击数据当作训练信号，得到的结果并非最优。<sup>[12](https://www.ijcai.org/proceedings/2018/738)</sup> 为解决这一问题，反事实排序学习（counterfactual learning to rank）利用已部署的日志排序器所收集的历史点击数据来学习排序器，用逆倾向评分消除位置偏差；而在线排序学习（online learning to rank）则通过记录用户与多个排序器所产生的结果列表之间的交互来更新排序器，通常采用交错法（interleaving）；也有人提出将反事实与在线结合的算法，以兼取两者之长。<sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC7148247/)</sup> 一个反事实推断框架为在数据有偏的情况下仍能通过经验风险最小化实现无偏排序学习提供了理论基础，由它导出的倾向加权排序支持向量机已被证明对噪声和倾向模型设定错误具有稳健性。<sup>[12](https://www.ijcai.org/proceedings/2018/738)</sup>

## 网络搜索中的排序

商业搜索引擎是规模最大的应用场景。据谷歌称，其排序系统要筛检数千亿计的网页及其他在线材料，并在几分之一秒内把最相关、最有用的结果呈现在第一页上，所依据的信号包括查询的措辞、网页的相关性与可用性、来源的专业性，以及用户的位置和设置；每个因素都带有一个权重，而权重会随查询类型而变化，因此内容的新鲜度对新闻搜索比对词典释义更重要。<sup>[5](https://www.google.com/search/howsearchworks/how-search-works/ranking-results/?tab=suite)</sup><sup> • </sup><sup>[14](https://support.google.com/websearch/answer/7585859?hl=en)</sup> 谷歌声明，它不接受付费以换取被收录进搜索结果或获得更高排名。<sup>[14](https://support.google.com/websearch/answer/7585859?hl=en)</sup> 该公司把常设的排序系统与周期性的核心更新区分开来，并为其重要系统维护一份公开指南。<sup>[15](https://developers.google.com/search/blog/2022/11/introducing-guide-to-ranking-systems?hl=en)</sup>

基于链接的打分早于学习型排序器。由劳伦斯·佩奇（Lawrence Page）、谢尔盖·布林（Sergey Brin）、拉吉夫·莫特瓦尼（Rajeev Motwani）和[特里·威诺格拉德](https://www.edgepedia.org/zh/terry-winograd)（Terry Winograd）描述的 PageRank，客观而机械地评定网页，借助网络链接图的结构，有效地度量了人们投注于这些网页的兴趣与注意力。<sup>[16](https://www.cs.uml.edu/~haim/teaching/iws/tirsaa/sources/google/PageRank_Citation_cover.html)</sup>

## 排序聚合

另有一类问题，是把同一组条目的若干种排序合并成一个共识排序。排序聚合在社会选择、生物信息学、信息检索、元搜索和推荐系统中都有用武之地；2024 年 IJCAI 的一篇综述把它的算法分为无监督、有监督和半监督三类。<sup>[17](https://www.ijcai.org/proceedings/2024/915)</sup> 经典的投票规则同时也可用作聚合方法：相对多数制、否决票制和波达计数法等计分体系都能把若干排序聚合为一个社会排序。<sup>[18](https://ojs.aaai.org/index.php/AAAI/article/view/25685)</sup> 这些规则在性质上各有不同；例如，波达计数法不满足孔多塞性质——按照该性质，在两两多数比较中击败所有其他候选人的候选人应当胜出。<sup>[19](https://www.sciencedirect.com/science/article/pii/S0096300306017814)</sup>

## 偏差与公平

由于排序列表把注意力集中在靠前的位置，排序系统塑造着曝光机会，也可能放大偏差。NIST 计算机科学家埃伦·沃里斯（Ellen Voorhees）指出，排序系统可能因其训练所依据的历史数据而放大既有偏差；作为回应，NIST 于 2019 年在其文本检索会议（TREC）中开设了“公平排序”赛道，该赛道由来自微软、博伊西州立大学和 NIST 的研究人员提议并组织，使用的是艾伦人工智能研究所提供的 [Semantic Scholar](https://www.edgepedia.org/zh/semantic-scholar) 搜索引擎的查询、返回列表和点击计数数据库，容量达 400 GB。<sup>[6](https://www.nist.gov/news-events/news/2019/11/measure-bias-data-nist-initiates-fair-ranking-research-effort)</sup> 按该赛道的度量方式，一个公平的算法不会总是以同样的次序返回同样的列表，从而让不那么显眼的条目获得可量化的曝光份额。<sup>[6](https://www.nist.gov/news-events/news/2019/11/measure-bias-data-nist-initiates-fair-ranking-research-effort)</sup>

在推荐系统中，与之类似的问题是流行度偏差：本已流行的条目通过推荐获得更多曝光，可能形成“富者愈富”的反馈循环。2024 年的一篇综述梳理并归类了该主题下的 123 篇论文，发现缓解方法可分为预处理、处理中（建模）和后处理三类，其中在文献中最常见的是同时权衡多个相互竞争目标的处理中技术。<sup>[20](https://link.springer.com/article/10.1007/s11257-024-09406-0)</sup>

## References

1. [Tie-Yan Liu (2009). Learning to Rank for Information Retrieval. Foundations and Trends in Information Retrieval 3(3): 225–331.](https://doi.org/10.1561/1500000016)
2. [Ranking to Learn and Learning to Rank: On the Role of Ranking in Pattern Recognition Applications. arXiv.](https://arxiv.org/abs/1706.05933)
3. [Muhammad Ibrahim, Manzur Murshed (2016). From Tf-Idf to Learning-to-Rank: An Overview. IGI Global.](https://www.igi-global.com/chapter/from-tf-idf-to-learning-to-rank/137475)
4. [An Overview of Learning to Rank for Information Retrieval. IEEE CSIE 2009.](https://ieeexplore.ieee.org/document/5170911/)
5. [How Google Determines Ranking Results. Google Search.](https://www.google.com/search/howsearchworks/how-search-works/ranking-results/?tab=suite)
6. [To Measure Bias in Data, NIST Initiates 'Fair Ranking' Research Effort. NIST, November 14, 2019.](https://www.nist.gov/news-events/news/2019/11/measure-bias-data-nist-initiates-fair-ranking-research-effort)
7. [A Short Introduction to Learning to Rank. IEICE Transactions on Information and Systems.](https://www.jstage.jst.go.jp/article/transinf/E94.D/10/E94.D_10_1854/_article/-char/en)
8. [Zhe Cao, Tao Qin, Tie-Yan Liu, Ming-Feng Tsai, Hang Li (2007). Learning to Rank: From Pairwise Approach to Listwise Approach. Microsoft Research MSR-TR-2007-40.](https://www.microsoft.com/en-us/research/publication/learning-to-rank-from-pairwise-approach-to-listwise-approach/)
9. [A review on instance ranking problems in statistical learning. Machine Learning (2021).](https://link.springer.com/article/10.1007/s10994-021-06122-3)
10. [Learning to Rank. XGBoost 3.2.1 documentation.](https://xgboost.readthedocs.io/en/release_3.2.0/tutorials/learning_to_rank.html)
11. [Learning to Rank. XGBoost 3.0.5 documentation.](https://xgboost.readthedocs.io/en/release_3.0.0/tutorials/learning_to_rank.html)
12. [Unbiased Learning-to-Rank with Biased Feedback. IJCAI 2018.](https://www.ijcai.org/proceedings/2018/738)
13. [Counterfactual Online Learning to Rank. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC7148247/)
14. [Google Search consumer information. Google Search Help.](https://support.google.com/websearch/answer/7585859?hl=en)
15. [Introducing our new guide to Google Search ranking systems. Google Search Central Blog, November 21, 2022.](https://developers.google.com/search/blog/2022/11/introducing-guide-to-ranking-systems?hl=en)
16. [Lawrence Page, Sergey Brin, Rajeev Motwani, Terry Winograd. The PageRank Citation Ranking: Bringing Order to the Web.](https://www.cs.uml.edu/~haim/teaching/iws/tirsaa/sources/google/PageRank_Citation_cover.html)
17. [A Survey on Rank Aggregation. IJCAI 2024.](https://www.ijcai.org/proceedings/2024/915)
18. [Rank Aggregation Using Scoring Rules. AAAI.](https://ojs.aaai.org/index.php/AAAI/article/view/25685)
19. [An algorithm for rank aggregation problem. Applied Mathematics and Computation.](https://www.sciencedirect.com/science/article/pii/S0096300306017814)
20. [A survey on popularity bias in recommender systems. User Modeling and User-Adapted Interaction (2024).](https://link.springer.com/article/10.1007/s11257-024-09406-0)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Sorting, searching, and selection › Searching and sorting related problems

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/ranking

English original: https://www.edgepedia.org/ranking
