# 算法稳定性

**算法稳定性**是机器学习理论中学习算法的一种性质：若改变单个训练样本时，算法的输出及该输出所产生的损失变化很小，则该算法是稳定的。稳定性为泛化界提供了一条途径——这些界保证算法在未见数据上的表现将接近其在训练集上的表现——其依赖于算法如何搜索假设空间，而非该空间的大小或复杂度。<sup>[1](https://proceedings.neurips.cc/paper/2000/hash/49ad23d1ec9fa4bd8d77d02681df5cfa-Abstract.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义性质 | 若将任意一个训练点替换为任意其他可能的点，任一测试点处的损失变化不超过β，则称该算法是β-稳定的。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup> |
| 奠基性论文 | Olivier Bousquet 与 André Elisseeff，《稳定性与泛化》，*Journal of Machine Learning Research* 2(Mar):499–526，2002年。<sup>[3](https://www.jmlr.org/papers/v2/bousquet02a.html)</sup> |
| 更早的根源 | 学习中的稳定性分析可追溯至三十多年前的 Devroye 与 Wagner（1979）。<sup>[4](https://proceedings.mlr.press/v80/charles18a/charles18a.pdf)</sup> |
| 经典界 | 对于取值在[0, 1]内的损失，在n个样本上运行的γ-一致稳定算法，其泛化误差以至少1 − δ的概率落在经验误差的O((γ + 1/n) √(n log(1/δ)))范围内。<sup>[5](https://arxiv.org/abs/1812.09859)</sup> |
| 改进的界 | Feldman 与 Vondrak（NeurIPS 2018）将其加强为O(√((γ + 1/n) log(1/δ)))，并证明了泛化误差二阶矩的紧O(γ² + 1/n)界。<sup>[6](https://proceedings.neurips.cc/paper/2018/hash/05a624166c8eb8273b8464e8d9cb5bd9-Abstract.html)</sup> |
| 有用的速率 | 当β(m) = O(1/m)时，基于稳定性的泛化界可达到通常的O(1/√m)速率，这对许多感兴趣的算法均成立。<sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup> |
| 隐私关联 | 损失在[0, 1]内的(ε, δ)-差分隐私算法是(e<sup>ε</sup> − 1 + δ)-一致稳定的。<sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup> |

## 定义

稳定性通过比较算法在训练集上的行为与其在该训练集的一个扰动副本上的行为来衡量。给定包含n个点的训练集S，令S<sub>i,z</sub>表示将S的第i个点替换为新点z后得到的集合。若对每个训练集、每个替换点和每个测试点，在S上训练得到的假设的损失与在S<sub>i,z</sub>上训练得到的假设的损失之差至多为β，则称算法A具有一致稳定性β（是β-稳定的）。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup> 换言之：改变任意训练集中的一个点，所得的假设在任意测试点上的行为几乎相同。<sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup>

稳定性参数β通常是样本量n的函数，有时写作β<sub>n</sub>；当β<sub>n</sub>随n增大而趋于零时，称该算法是一致稳定的。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup><sup> • </sup><sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup> 一致稳定性是一个很强的要求，因为它忽略了训练集上的概率分布：即使抽取到一个极不可能的训练集，输出也必须变化很小。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup>

## 与泛化的关系

稳定性分析的目的是界定泛化差距，即模型真实风险与其经验风险之间的差异。该方法不同于VC维或Rademacher复杂度等基于复杂度的理论：它不是约束假设类，而是约束学习算法本身，追问当训练集被轻微修改时，算法所产生的函数能变化多少。<sup>[1](https://proceedings.neurips.cc/paper/2000/hash/49ad23d1ec9fa4bd8d77d02681df5cfa-Abstract.html)</sup><sup> • </sup><sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup> 由于所得的界依赖于算法如何搜索假设空间，而非该空间复杂度的任何度量，因此即使VC维为无穷大也可以应用。<sup>[1](https://proceedings.neurips.cc/paper/2000/hash/49ad23d1ec9fa4bd8d77d02681df5cfa-Abstract.html)</sup>

Bousquet 与 Elisseeff 定义了几种稳定性概念，并展示了如何利用它们基于经验误差和留一误差推导泛化误差界，并将其应用于回归以及通过对实值函数取阈值进行分类。<sup>[3](https://www.jmlr.org/papers/v2/bousquet02a.html)</sup> 他们的分析将稳定性与集中不等式联系起来，特别是 McDiarmid 不等式，该不等式量化了当每个变量的影响有限时，多个独立随机变量的函数如何集中在其均值附近。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup>

**定量界。** 对于取值范围在[0, 1]内的损失函数，经典结果表明：在n个样本上运行的γ-一致稳定算法，其泛化误差以至少1 − δ的概率落在经验误差的O((γ + 1/n) √(n log(1/δ)))范围内。<sup>[5](https://arxiv.org/abs/1812.09859)</sup> 该界在γ = O(1/n)时有意义，已知该区域内的界是紧的，但在γ ≥ 1/√n的常见情形下，它并不能给出有用的保证。<sup>[6](https://proceedings.neurips.cc/paper/2018/hash/05a624166c8eb8273b8464e8d9cb5bd9-Abstract.html)</sup> Feldman 与 Vondrak 在无额外假设的情况下消除了这一限制，证明了以至少1 − δ的概率成立的O(√((γ + 1/n) log(1/δ)))界，同时给出了泛化误差二阶矩的紧O(γ² + 1/n)界，改进了此前的O(γ + 1/n)。<sup>[6](https://proceedings.neurips.cc/paper/2018/hash/05a624166c8eb8273b8464e8d9cb5bd9-Abstract.html)</sup>

## 稳定性的变体

一致稳定性是常用概念中最强的一种；它蕴含其他概念，包括假设稳定性、误差稳定性、逐点假设稳定性、处处稳定性和CVLOO稳定性。<sup>[8](https://webdocs.cs.ualberta.ca/~daes/papers/ecml15b.pdf)</sup> 较弱的概念仍能产生非平凡的保证。例如，逐点假设稳定性仅要求在去掉的点处损失的期望变化很小，它足以建立泛化界——这一结果最初是针对确定性算法证明的，后来由 Elisseeff 及同事于2005年推广到随机算法。<sup>[4](https://proceedings.mlr.press/v80/charles18a/charles18a.pdf)</sup> 每个一致稳定算法也是平均替换一稳定的，但反之不成立。<sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup>

稳定性概念的家族已大幅扩展。2023年，学习理论研究者 Shay Moran、Hilla Schefler 与 Jonathan Shafer（在NeurIPS上发表）对贝叶斯稳定性定义进行了综述，在近似与纯差分隐私、可复制性、全局稳定性、完美泛化、全变差稳定性、互信息稳定性、KL散度稳定性和Rényi散度稳定性这两族定义内部建立了等价关系，并给出了放大学习规则稳定性的提升结果。<sup>[9](https://proceedings.neurips.cc/paper_files/paper/2023/hash/c2586b71fd150fb56952e253a9c551cc-Abstract-Conference.html)</sup>

## 哪些算法是稳定的

基于正则化的算法是经典例子。Bousquet 与 Elisseeff 研究了大类此类算法的稳定性，重点关注 Hilbert 空间正则化和 Kullback-Leibler 正则化，并展示了其结果如何应用于回归和分类的支持向量机。<sup>[3](https://www.jmlr.org/papers/v2/bousquet02a.html)</sup> 他们更早的 NIPS 2000 论文表明，正则化网络具备所需的稳定性性质。<sup>[1](https://proceedings.neurips.cc/paper/2000/hash/49ad23d1ec9fa4bd8d77d02681df5cfa-Abstract.html)</sup> 再生核 Hilbert 空间中的 Tikhonov 正则化表现出泛化界所需的稳定性。<sup>[2](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)</sup>

稳定性还能区分在其他度量下看起来相似的算法。经典案例是1-最近邻：Cover 与 Hart 在1967年表明，其风险的极限不超过[贝叶斯风险](https://www.edgepedia.org/zh/bayes-risk)的两倍，但其一致稳定性很弱，因为对训练集的单次改动可能改变受影响样本的 Voronoi 胞腔内任何位置的预测。<sup>[10](https://www.theorempath.com/topics/algorithmic-stability)</sup>

**随机梯度下降。** 近期大量工作分析了SGD——大规模模型训练的支柱——的稳定性。Charles 与 Papailiopoulos 在 Polyak-Łojasiewicz 条件和二次增长条件下，推导了仅依赖于算法收敛性和损失在极小值点附近几何性质的黑箱稳定性结果，并用其建立了SGD、梯度下降、随机坐标下降和SVRG的稳定性。他们的结果表明，在PL设定下SGD与梯度下降具有可比的稳定性，但存在具有多个局部极小值的简单神经网络，其中SGD稳定而梯度下降不稳定。<sup>[11](https://arxiv.org/abs/1710.08402)</sup> Kuzborskij 与 Lampert 为SGD引入了数据依赖的稳定性概念，表明在凸情形下泛化界依赖于初始化点处的风险，在非凸情形下依赖于目标函数在该点附近的期望曲率，这暗示了一种实用的策略：预筛选SGD初始化。<sup>[12](https://arxiv.org/abs/1703.01678)</sup> Lei 与 Ying 通过引入平均模型稳定性，放宽了早期分析的限制性假设——有界梯度、强光滑性和凸性——首次给出了损失函数不可微时SGD的稳定性和泛化界，并通过稳定性方法首次给出了低噪声设定下的快速界。<sup>[13](https://arxiv.org/abs/2006.08157)</sup> 关于紧性，Zhang 及同事在2021年表明，对于一般数据集，现有分析对凸和强凸损失是紧的，但对非凸损失可以改进。<sup>[14](https://arxiv.org/abs/2102.05274)</sup>

## 与隐私和可学习性的联系

[差分隐私](https://www.edgepedia.org/zh/differential-privacy)——一个本质上关注算法稳定性而非仅仅隐私的框架——蕴含稳定性：损失在[0, 1]内的(ε, δ)-差分隐私算法是(e<sup>ε</sup> − 1 + δ)-一致稳定的。<sup>[7](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)</sup> 这一链条——差分隐私蕴含稳定性，稳定性蕴含泛化——被用于界定隐私学习器的泛化，稳定性条件也支撑着差分隐私的验证和参数调优流程。<sup>[15](https://proceedings.neurips.cc/paper_files/paper/2013/file/e6d8545daa42d5ced125a4bf747b3688-Paper.pdf)</sup>

稳定性也已从充分条件提升为刻画。当时还是机器学习博士研究员的 Ibrahim M. Alabdulmohsin 在 NIPS 2015 上证明，推理过程中的算法稳定性等价于对所有参数化损失函数的一致泛化；其推论将稳定性与数据处理、观测空间的大小（为降维提供依据）以及假设空间复杂度联系起来，恢复了经典的PAC结果，即复杂度应受控制。<sup>[16](https://proceedings.neurips.cc/paper_files/paper/2015/hash/6512bd43d9caa6e02c990b0a82652dca-Abstract.html)</sup> 更早，Shalev-Shwartz 及同事表明，在 Vapnik 的一般设定下，一致收敛对可学习性并非必要，并提出算法稳定性作为可学习性的替代关键条件。<sup>[17](https://papers.neurips.cc/paper/6019-algorithmic-stability-and-uniform-generalization.pdf)</sup>

## 扩展

稳定性分析已超越其最初的监督、独立同分布设定。它已被适配到无监督学习，其中损失衡量重建误差而非与已知标签的偏差，方法是在稳定性定义中以重建损失替代监督损失。<sup>[8](https://webdocs.cs.ualberta.ca/~daes/papers/ecml15b.pdf)</sup> 已为非独立同分布过程推导出界，以应对不满足独立同分布采样假设的机器学习应用。<sup>[18](https://proceedings.neurips.cc/paper_files/paper/2007/hash/85d8ce590ad8981ca2c8286f79f59954-Abstract.html)</sup> 2026年 JMLR 上 Shuang Zeng 与 Yunwen Lei 的论文提出了首个针对有偏随机梯度方法（包括零阶SGD和 Clipped-SGD）的稳定性与泛化框架，为两者推导了O(1/√n)阶的超额风险界。<sup>[19](https://www.jmlr.org/beta/papers/v27/24-0637.html)</sup>

## References

1. [Olivier Bousquet, André Elisseeff (2000). Algorithmic Stability and Generalization Performance. NIPS 13.](https://proceedings.neurips.cc/paper/2000/hash/49ad23d1ec9fa4bd8d77d02681df5cfa-Abstract.html)
2. [Generalization Bounds and Stability, MIT OCW 9.520 Statistical Learning Theory (Spring 2006), Class 14.](https://ocw.mit.edu/courses/9-520-statistical-learning-theory-and-applications-spring-2006/9a5f87123d8e36531b5959b031920fa8_class14.pdf)
3. [Olivier Bousquet, André Elisseeff (2002). Stability and Generalization. Journal of Machine Learning Research 2:499–526.](https://www.jmlr.org/papers/v2/bousquet02a.html)
4. [Zachary Charles, Dimitris Papailiopoulos (2018). Stability and Generalization of Learning Algorithms that Converge to Global Optima. PMLR v80.](https://proceedings.mlr.press/v80/charles18a/charles18a.pdf)
5. [Generalization Bounds for Uniformly Stable Algorithms (arXiv:1812.09859).](https://arxiv.org/abs/1812.09859)
6. [Vitaly Feldman, Jan Vondrak (2018). Generalization Bounds for Uniformly Stable Algorithms. NeurIPS 31.](https://proceedings.neurips.cc/paper/2018/hash/05a624166c8eb8273b8464e8d9cb5bd9-Abstract.html)
7. [Chapter 15 Stability, Statistical Learning Theory notes (UBC CPSC 532D).](https://www.cs.ubc.ca/~dsuth/532D/26w1/notes/html/chap_stability.html)
8. [Uniform β-stability for unsupervised learning (ECML 2015 paper).](https://webdocs.cs.ualberta.ca/~daes/papers/ecml15b.pdf)
9. [Shay Moran, Hilla Schefler, Jonathan Shafer (2023). The Bayesian Stability Zoo. NeurIPS 36.](https://proceedings.neurips.cc/paper_files/paper/2023/hash/c2586b71fd150fb56952e253a9c551cc-Abstract-Conference.html)
10. [Algorithmic Stability, TheoremPath topic page.](https://www.theorempath.com/topics/algorithmic-stability)
11. [Zachary Charles, Dimitris Papailiopoulos (2017). Stability and Generalization of Learning Algorithms that Converge to Global Optima. arXiv:1710.08402.](https://arxiv.org/abs/1710.08402)
12. [Ilja Kuzborskij, Christoph H. Lampert (2017). Data-Dependent Stability of Stochastic Gradient Descent. arXiv:1703.01678.](https://arxiv.org/abs/1703.01678)
13. [Yunwen Lei, Yiming Ying (2020). Fine-Grained Analysis of Stability and Generalization for Stochastic Gradient Descent. arXiv:2006.08157.](https://arxiv.org/abs/2006.08157)
14. [Yikai Zhang and colleagues (2021). Stability of SGD: Tightness Analysis and Improved Bounds. arXiv:2102.05274.](https://arxiv.org/abs/2102.05274)
15. [A Stability-based Validation Procedure for Differentially Private Machine Learning. NIPS 2013.](https://proceedings.neurips.cc/paper_files/paper/2013/file/e6d8545daa42d5ced125a4bf747b3688-Paper.pdf)
16. [Ibrahim M Alabdulmohsin (2015). Algorithmic Stability and Uniform Generalization. NIPS 28.](https://proceedings.neurips.cc/paper_files/paper/2015/hash/6512bd43d9caa6e02c990b0a82652dca-Abstract.html)
17. [Algorithmic Stability and Uniform Generalization (paper PDF).](https://papers.neurips.cc/paper/6019-algorithmic-stability-and-uniform-generalization.pdf)
18. [Stability Bounds for Non-i.i.d. Processes. NIPS 2007.](https://proceedings.neurips.cc/paper_files/paper/2007/hash/85d8ce590ad8981ca2c8286f79f59954-Abstract.html)
19. [Shuang Zeng, Yunwen Lei (2026). Stochastic Gradient Methods: Bias, Stability and Generalization. JMLR 27(6):1–55.](https://www.jmlr.org/beta/papers/v27/24-0637.html)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Learning theory and generalization › Generalization bounds

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/algorithmic-stability

English original: https://www.edgepedia.org/algorithmic-stability
