# 生成模型

生成模型是一种关于数据如何分布的统计模型：它学习数据本身的概率分布，要么是输入与标签的联合分布 p(X, Y)，要么在没有标签时学习分布 p(X)，并可以利用该分布生成新样本、评估给定样本的可能性，或通过贝叶斯法则进行分类。<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> 这与判别模型形成对比，后者只学习给定输入时标签的条件概率 p(Y | X)，从不建模数据分布。<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> 条件生成模型学习 p(x | y)，即给定标签或其他条件信号时生成数据；在现代实践中，这种形式最为常见。<sup>[2](https://cs231n.stanford.edu/slides/2025/lecture_13.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 学习 p(X, Y) 或 p(X)；判别模型只学习 p(Y \| X)<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> |
| 分类路径 | 生成模型通过贝叶斯法则从其学习到的分布计算 p(y \| x)<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> |
| 深度模型家族 | 变分自编码器、生成对抗网络和流模型是斯坦福 CS236 课程讲授的标准深度模型家族<sup>[3](https://bulletin.stanford.edu/courses/2205691)</sup> |
| 奠基论文 | VAE：金马与韦林，arXiv 2013 年 12 月；GAN：古德费洛等，arXiv 2014 年 6 月；扩散模型：索尔-迪克斯坦等，arXiv 2015<sup>[4](https://arxiv.org/abs/1312.6114)</sup><sup> • </sup><sup>[5](https://arxiv.org/abs/1406.2661)</sup><sup> • </sup><sup>[6](https://arxiv.org/abs/1503.03585)</sup> |
| 样本效率 | 吴恩达与迈克尔·乔丹（2001）表明，生成式分类器可以用随参数数量呈对数而非线性增长的训练样本数逼近其渐近误差<sup>[7](https://www.cs.cmu.edu/~guestrin/Class/10701-F07/readings/ng-jordan-2001.pdf)</sup> |
| 评估 | Inception 得分和弗雷歇 Inception 距离是常用指标，但 2023 年的一项人类研究发现，包括 FID 在内，当前没有哪种指标与人类对真实感的判断强相关<sup>[8](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cdt2/5384331)</sup><sup> • </sup><sup>[9](https://arxiv.org/abs/2306.04675)</sup> |
| 已知失效模式 | 扩散模型会记忆训练样本，尤其是训练集较小时<sup>[10](https://proceedings.mlr.press/v267/shah25b.html)</sup> |

## 生成式与判别式

这两类模型针对同一数据回答不同的问题。给定数据实例 X 和标签 Y，生成模型捕捉联合概率 p(X, Y)，或在没有标签时只捕捉 p(X)，因此包含了数据本身的分布；判别模型捕捉 p(Y \| X)，忽略给定实例是否可能。<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> 在 CS231n 的表述中，判别模型学习 p(y \| x)，生成模型学习 p(x)，条件生成模型学习 p(x \| y)。<sup>[2](https://cs231n.stanford.edu/slides/2025/lecture_13.pdf)</sup>

这一区分有一种几何解读。判别模型试图在数据空间中划出区域，而生成模型则试图捕捉数据在该空间中的分布方式：判别模型可以通过识别少数几个有区分度的特征来分辨狗和猫，而生成模型必须捕捉让一只狗看起来可信的相关性。<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup> 一个后果是，判别模型必须为每一个可能的输入给出标签分布，无论该输入多么不合理；而生成模型可以通过给不合理输入分配很小的概率质量来拒绝它们。<sup>[2](https://cs231n.stanford.edu/slides/2025/lecture_13.pdf)</sup>

**额外建模带来了什么。** 由于生成模型表示数据分布，它可以做判别模型做不到的事情：生成新样本、检测异常值、无标签地学习特征，以及通过边缘化处理缺失特征。<sup>[2](https://cs231n.stanford.edu/slides/2025/lecture_13.pdf)</sup> 代价是容量被用于建模 x，而纯分类任务从来不需要这样做。<sup>[11](https://holehouse.org/mlclass/05_Probability_and_Bayes_Rule.html)</sup>

## 生成-判别对

有些模型家族成对出现。如果一个生成式参数族和一个判别式参数族能够表示同一组条件概率分布，它们就构成一个生成-判别对。<sup>[12](https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1036/new_handouts/cs224l6.pdf)</sup> 经典例子是朴素贝叶斯与逻辑回归配对，以及当 p(x \| y) 为高斯分布、p(y) 为多项分布时，高斯判别分析（GDA）与逻辑回归配对。<sup>[7](https://www.cs.cmu.edu/~guestrin/Class/10701-F07/readings/ng-jordan-2001.pdf)</sup>

斯坦福计算机科学家吴恩达（Andrew Y. Ng）和伯克利机器学习研究者[迈克尔·乔丹](https://www.edgepedia.org/zh/michael-i-jordan)（Michael I. Jordan） 在 2001 年的一篇论文中从理论和实验两方面研究了这些配对。他们证实了主流观点，即随着训练数据增长，判别学习的渐近误差更低，但也表明生成式分类器可能更快地逼近其较高的渐近误差，所需训练样本数可能仅随参数数量对数增长，而非线性增长。<sup>[7](https://www.cs.cmu.edu/~guestrin/Class/10701-F07/readings/ng-jordan-2001.pdf)</sup> 这根据训练集大小形成了两种性能区间：数据少时生成模型可能胜出，数据充足时判别模型表现更好。<sup>[7](https://www.cs.cmu.edu/~guestrin/Class/10701-F07/readings/ng-jordan-2001.pdf)</sup> 后来一项关于循环文本分类器的研究发现了相同模式：生成模型比判别模型更快地逼近其渐近错误率。<sup>[13](https://arxiv.org/abs/1703.01898)</sup>

## 深度生成模型家族

用神经网络参数化生成模型，结合随机优化的进展，使得对图像、文本和语音等复杂高维数据的可扩展建模成为可能。<sup>[3](https://bulletin.stanford.edu/courses/2205691)</sup> 斯坦福 CS236 课程围绕三个家族组织该领域：变分自编码器（VAE）、生成对抗网络（GAN）和流模型。<sup>[3](https://bulletin.stanford.edu/courses/2205691)</sup>

**变分自编码器。** VAE 由后来在 DeepMind 担任研究科学家的迪德里克·P·金马（Diederik P. Kingma）和[阿姆斯特丹大学](https://www.edgepedia.org/zh/university-of-amsterdam)机器学习教授[马克斯·韦林](https://www.edgepedia.org/zh/max-welling)（Max Welling） 在《Auto-Encoding Variational Bayes》（arXiv，2013 年 12 月）中提出，用随机变分推断算法训练潜变量模型。其目标函数结合了将近似后验拉向先验的 KL 散度正则项与期望重建误差，重参数化技巧使所需梯度可通过反向传播计算。<sup>[4](https://arxiv.org/abs/1312.6114)</sup>

**生成对抗网络。** 伊恩·J·古德费洛（Ian J. Goodfellow）及其同事，包括[约书亚·本吉奥](https://www.edgepedia.org/zh/yoshua-bengio)（Yoshua Bengio），于 2014 年 6 月提出 GAN。<sup>[5](https://arxiv.org/abs/1406.2661)</sup> GAN 训练一个生成器对抗一个判别器，已被应用于图像超分辨率、自然语言生成、医疗合成数据和风格迁移。<sup>[14](https://arxiv.org/abs/2010.03549)</sup> 2025 年的一篇系统综述指出其在计算机视觉和自然语言处理中的突破性表现，包括监控、自动驾驶和自动化编程辅助。<sup>[8](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cdt2/5384331)</sup>

**扩散模型。** 扩散方法由[亚沙·索尔-迪克斯坦](https://www.edgepedia.org/zh/jascha-sohl-dickstein)（Jascha Sohl-Dickstein）及斯坦福和伯克利的同事在《Deep Unsupervised Learning using Nonequilibrium Thermodynamics》（arXiv，2015）中提出：一个前向过程系统而缓慢地破坏数据分布中的结构，一个学习到的逆向扩散过程将其恢复，从而产生灵活且可处理的生成模型。<sup>[6](https://arxiv.org/abs/1503.03585)</sup> 去噪扩散概率模型（何（Ho）等，2020）后来使这一家族与 VAE 和 GAN 并驾齐驱。<sup>[15](https://doi.org/10.29220/csam.2025.32.2.235)</sup>

一份精选的斯坦福阅读清单将该领域的骨干定位于这些论文：深度潜变量模型的随机反向传播（雷曾德（Rezende）等，2014）、GAN（古德费洛等，2014）、从 NICE（丁（Dinh）等，2014）到 Real NVP（2016）和 Glow（金马与达里瓦尔（Dhariwal），2018）的可逆流模型、自回归 PixelRNN 和 PixelCNN（范登奥尔德（van den Oord）等，2016 至 2017），以及 StyleGAN（卡拉斯（Karras）等，2018）。<sup>[16](https://web.stanford.edu/~mrifaki/generative-modeling-readings.html)</sup>

## 评估与记忆

评估生成模型比评估分类器更难，因为没有单一正确输出。常见的 GAN 指标包括 Inception 得分（IS）、弗雷歇 Inception 距离（FID）、结构相似性指数（SSIM）和峰值信噪比（PSNR）。<sup>[8](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cdt2/5384331)</sup> 2023 年一项针对生成图像评估的迄今最大规模人类实验发现，包括 FID 在内，当前没有哪种指标与人类对真实感的评估强相关，这种不匹配对扩散模型尤其不利，而在计算弗雷歇距离时用 DINOv2 替换 Inception 网络可以解决该问题。<sup>[9](https://arxiv.org/abs/2306.04675)</sup>

**记忆。** 生成模型可能复现训练样本而非生成新颖内容，而指标往往无法检测这种过拟合。<sup>[15](https://doi.org/10.29220/csam.2025.32.2.235)</sup> 对于扩散模型，有强有力的经验证据表明存在训练集记忆，尤其是训练集较小时；2025 年的一篇 ICML 论文给出了理论证据，表明记忆仅在低噪声尺度下去噪时才必要，而这些尺度用于高频细节，并表明在大噪声尺度上对噪声数据训练可以减少记忆而不降低图像质量。<sup>[10](https://proceedings.mlr.press/v267/shah25b.html)</sup> 在医学影像中，为合成数据生成而训练的无条件潜扩散模型已被证明会记忆患者影像数据，可通过自监督复制检测方法发现。<sup>[17](https://www.nature.com/articles/s41551-025-01468-8)</sup> 对扩散动力学的理论分析发现了一种记忆区间，在该区间内生成坍缩到精确的训练点；要在有限时间内避免这一点，需要数据集规模随数据维度指数增长，除非通过正则化近似学习得分函数，而这正是实践所依赖的。<sup>[18](https://doi.org/10.1038/s41467-024-54281-3)</sup>

## 应用

深度生成模型被广泛应用于计算机视觉、语音和自然语言处理以及强化学习。<sup>[3](https://bulletin.stanford.edu/courses/2205691)</sup> 语言模型是一个熟悉的例子：自回归语言模型是词元序列上的概率分布，其中每个条件分布 p(x_i | x_{1:i-1}) 都可以用神经网络高效计算。<sup>[19](https://stanford-cs324.github.io/winter2022/lectures/introduction/)</sup> 预测序列中下一个词的模型是生成式的，因为它们可以为词序列分配概率。<sup>[1](https://developers.google.com/machine-learning/gan/generative)</sup>

在科学领域，生成模型已成为研究工具。2024 年发表在《Nature》上的 [AlphaFold 3](https://www.edgepedia.org/zh/alphafold-3) 使用大幅更新的基于扩散的架构来预测包含蛋白质、核酸、小分子、离子和修饰残基的复合物的联合结构，通过扩散模块预测原始原子坐标；扩散过程中的低噪声水平促使网络改善局部结构。<sup>[20](https://www.nature.com/articles/s41586-024-07487-w)</sup> 一篇关于科学中人工智能的综述将深度生成模型确定为学习自然语言和生物序列以及生成科学假说的核心技术。<sup>[21](https://ai.stanford.edu/~jure/pubs/discovery-nature23.pdf)</sup>

## References

1. [Background: What is a Generative Model? Google Machine Learning Crash Course](https://developers.google.com/machine-learning/gan/generative)
2. [Stanford CS231n, Lecture 13 slides (2025): Generative vs Discriminative Models](https://cs231n.stanford.edu/slides/2025/lecture_13.pdf)
3. [CS236 Deep Generative Models, Stanford University Bulletin](https://bulletin.stanford.edu/courses/2205691)
4. [Diederik P. Kingma, Max Welling (2013). Auto-Encoding Variational Bayes. arXiv.](https://arxiv.org/abs/1312.6114)
5. [Ian J. Goodfellow et al. (2014). Generative Adversarial Networks. arXiv.](https://arxiv.org/abs/1406.2661)
6. [Jascha Sohl-Dickstein et al. (2015). Deep Unsupervised Learning using Nonequilibrium Thermodynamics. arXiv.](https://arxiv.org/abs/1503.03585)
7. [Andrew Y. Ng, Michael I. Jordan (2001). On Discriminative vs. Generative Classifiers: A comparison of logistic regression and naive Bayes. NIPS.](https://www.cs.cmu.edu/~guestrin/Class/10701-F07/readings/ng-jordan-2001.pdf)
8. [Khan (2025). A Systematic Literature Review on the Applications, Models, Limitations, and Future Directions of Generative Adversarial Networks. IET Computers & Digital Techniques.](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/cdt2/5384331)
9. [Exposing flaws of generative model evaluation metrics and their unfair treatment of diffusion models. arXiv.](https://arxiv.org/abs/2306.04675)
10. [Shah, Kalavasis, Klivans, Daras (2025). Does Generation Require Memorization? Creative Diffusion Models using Ambient Diffusion. ICML, PMLR 267.](https://proceedings.mlr.press/v267/shah25b.html)
11. [Stanford Machine Learning course notes: Probability and Bayes' Rule](https://holehouse.org/mlclass/05_Probability_and_Bayes_Rule.html)
12. [Stanford CS224N handout: Discriminative Models in NLP, generative-discriminative pairs](https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1036/new_handouts/cs224l6.pdf)
13. [Generative and Discriminative Text Classification with Recurrent Neural Networks. arXiv.](https://arxiv.org/abs/1703.01898)
14. [On the Evaluation of Generative Adversarial Networks By Discriminative Models. arXiv.](https://arxiv.org/abs/2010.03549)
15. [A review on the generative models and its performance metrics. Communications in Statistical Applications and Methods (2025).](https://doi.org/10.29220/csam.2025.32.2.235)
16. [Mouhssine Rifaki. Generative Modeling: 10 Key Papers, Stanford Electrical Engineering reading list](https://web.stanford.edu/~mrifaki/generative-modeling-readings.html)
17. [Unconditional latent diffusion models memorize patient imaging data. Nature Biomedical Engineering (2025).](https://www.nature.com/articles/s41551-025-01468-8)
18. [Dynamical regimes of diffusion models. Nature Communications (2024).](https://doi.org/10.1038/s41467-024-54281-3)
19. [Stanford CS324: Introduction, language models](https://stanford-cs324.github.io/winter2022/lectures/introduction/)
20. [Accurate structure prediction of biomolecular interactions with AlphaFold 3. Nature (2024).](https://www.nature.com/articles/s41586-024-07487-w)
21. [Scientific discovery in the age of artificial intelligence. Nature (2023), Stanford.](https://ai.stanford.edu/~jure/pubs/discovery-nature23.pdf)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Supervised, unsupervised, and semi-supervised learning › Classification algorithms

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/generative-model

English original: https://www.edgepedia.org/generative-model
