# Doc2vec

**Doc2vec**（最初发表时名为“段落向量”）是一种无监督算法，学习定长稠密向量来表示变长文本片段，如句子、段落和文档。它由 Quoc V. Le 和 Tomas Mikolov 提出，论文于2014年5月16日提交至 arXiv，是 word2vec 的扩展——word2vec 是 Mikolov 及其同事前一年提出的词嵌入方法。<sup>[1](https://arxiv.org/abs/1405.4053)</sup><sup> • </sup><sup>[2](https://aclanthology.org/W16-1609/)</sup> word2vec 为每个词产生一个向量，而 doc2vec 额外为每篇文档学习一个向量，于是整段文本可以表示为连续空间中的一个点，并通过距离或余弦相似度与其他文本比较。<sup>[3](https://link.springer.com/article/10.1186/s13326-026-00365-6)</sup>

| 关键事实 | 详情 |
|---|---|
| 原始发表 | Quoc V. Le 与 Tomas Mikolov 的《句子与文档的分布式表示》，arXiv:1405.4053，2014年5月16日提交<sup>[1](https://arxiv.org/abs/1405.4053)</sup> |
| 学习内容 | 为每篇文档学习一个稠密向量，训练目标是预测文档中的词，克服词袋模型忽略词序和语义的弱点<sup>[1](https://arxiv.org/abs/1405.4053)</sup> |
| 两种架构 | PV-DM（分布式记忆），类似于 word2vec 的 CBOW 并加入段落 ID 向量；PV-DBOW（分布式词袋），仅用段落向量预测随机采样的上下文词<sup>[4](https://link.springer.com/article/10.1007/s44248-025-00052-4)</sup><sup> • </sup><sup>[5](https://odr.chalmers.se/bitstreams/22600e8c-5571-42a1-afd8-20ffda272db9/download)</sup> |
| 原始主张 | 段落向量优于词袋及其他文本表示技术，在多个文本分类和情感分析任务上取得新的最优结果<sup>[1](https://arxiv.org/abs/1405.4053)</sup> |
| 复现发现 | Lau 与 Baldwin（2016）指出他人难以复现原始结果；doc2vec 在基于大型外部语料训练模型时表现稳健，使用预训练词嵌入可进一步提升<sup>[2](https://aclanthology.org/W16-1609/)</sup> |
| 标准实现 | Gensim 库的 Doc2Vec 模型；对新文档的向量推断是非确定性的，重复运行会得到不同结果<sup>[6](https://github.com/piskvorky/gensim/wiki/Recipes-%26-FAQ)</sup> |

## 工作原理

该算法用稠密向量表示每篇文档，训练目标是预测文档中出现的词。Le 与 Mikolov 将此定位为解决词袋特征两大弱点的方案——词袋丢失词序、忽略词语语义；在词袋空间中，“强大”“强壮”和“巴黎”彼此等距。<sup>[1](https://arxiv.org/abs/1405.4053)</sup>

文中描述了两种训练架构。在段落向量的分布式记忆模型（PV-DM）中，方法非常类似 word2vec 的连续词袋（CBOW）架构，但为训练语料中的每篇文档增加一个段落 ID 向量；段落向量与词向量结合，用于预测上下文窗口中的下一个词。<sup>[4](https://link.springer.com/article/10.1007/s44248-025-00052-4)</sup><sup> • </sup><sup>[5](https://odr.chalmers.se/bitstreams/22600e8c-5571-42a1-afd8-20ffda272db9/download)</sup> 段落向量的分布式词袋版本（PV-DBOW）则简化了问题，仅以段落向量为输入，预测从文档中随机采样的上下文词。<sup>[5](https://odr.chalmers.se/bitstreams/22600e8c-5571-42a1-afd8-20ffda272db9/download)</sup> 原始论文报告 DM 架构似乎表现更好，但后续研究得出了不同结论。<sup>[7](https://pmc.ncbi.nlm.nih.gov/articles/PMC6976149/)</sup>

训练完成后，词向量固定，新出现的未见过文档的向量可通过进一步优化推断得到，[Gensim](https://www.edgepedia.org/zh/gensim) 文档将这一过程描述为一种受约束的训练；正因如此，对同一文本的后续推断运行可能给出不同结果。<sup>[6](https://github.com/piskvorky/gensim/wiki/Recipes-%26-FAQ)</sup>

## 早期后续工作

Andrew M. Dai、Christopher Olah 和 Quoc V. Le 在2014年 NIPS 深度学习研讨会论文中，对段落向量进行了超出原始论文情感分析概念验证范围的测试。在两个文档相似度数据集（一个来自[维基百科](https://www.edgepedia.org/zh/wikipedia)，一个来自 arXiv）上，该方法显著优于包括潜在狄利克雷分配在内的其他文档建模算法，且段落向量上的向量运算——很像词嵌入——可以产生有用的语义结果。<sup>[8](https://research.google/pubs/document-embedding-with-paragraph-vectors/)</sup>

## 实证评估与比较

**可复现性与训练数据。** 计算语言学研究者 Jey Han Lau 和 Timothy Baldwin 在2016年 RepL4NLP 研讨会上发表了对 doc2vec 在两项任务上的严格实证评估，将其与两个基线和两种最先进的文档嵌入方法比较。他们发现，使用基于大型外部语料训练的模型时，doc2vec 表现稳健；使用预训练词嵌入可进一步提升性能；他们还发布了超参数建议及其训练好的模型。<sup>[2](https://aclanthology.org/W16-1609/)</sup>

**与更简单表示的比较。** 比较研究常发现经典方法具有竞争力。一项2017年关于文档分类特征表示的研究使用随机森林分类器，发现常用的词袋模型表现与 doc2vec 相当，而生成最多75个特征的低维 doc2vec 变体属于表现最好的表示之一。<sup>[9](https://arxiv.org/abs/1707.01321)</sup> 在对波兰语资质描述的无监督文本文档聚类中，基于 WordNet 的相似度度量可以与包括 doc2vec 和 BERT 在内的现代嵌入方法竞争甚至超越它们。<sup>[10](https://aclanthology.org/2021.gwc-1.24/)</sup> 在一项对临床笔记编码方法的系统评估中，TF-IDF 特征选择方法的 AUROC 显著高于 Doc2Vec（配置 D = 100，W = 5，DM），高出 0.24 ±0.10（P = 1.1e-17），在准确率、灵敏度和特异度上也有类似趋势。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC10919678/)</sup>

**情感分析。** 在一项以 SentiWordNet 为基准、对临床出院摘要和科学文本进行的无监督情感分析中，Word2Vec 的结果比 Doc2Vec 的结果与基于词典的评估更一致；在多类文本分类中，Word2Vec 优于 Doc2Vec；研究还发现这两种方法在某些场景下可互补。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC8364743/)</sup><sup> • </sup><sup>[13](https://arxiv.org/abs/1805.00352)</sup>

## 应用

由于 doc2vec 为每篇文档产生一个向量，它支持任何基于文档级表示的任务：计算文档间余弦相似度、聚类、分类和推荐。已记录的用途包括：从发布在广告平台上的广告备注中评估情感、重复问题检测、问答的候选答案排序，以及文本分类特征。<sup>[12](https://pmc.ncbi.nlm.nih.gov/articles/PMC8364743/)</sup><sup> • </sup><sup>[14](https://datascience.stackexchange.com/questions/23638/what-are-real-world-applications-of-doc2vec)</sup> 在数字图书馆推荐系统中，一项在线评估针对一组测试用户，使用 doc2vec 对来自 Lucene/ElasticSearch 的 MoreLikeThis 模块的 TF-IDF 推荐结果进行重排。<sup>[15](https://isg.beel.org/blog/2019/05/13/document-embeddings-vs-keyphrases-vs-terms-an-online-evaluation-for-digital-library-recommender-systems/)</sup> Doc2Vec 模型比 Word2Vec 模型更受训练集领域束缚，而 Word2Vec 的词嵌入更容易跨文档领域迁移。<sup>[16](https://reference-global.com/2/v2/download/article/10.2478/icas-2019-0043.pdf)</sup>

## 在后继方法中的位置

该方法仍可在 Gensim 中使用；在4核 2.6 GHz Intel Core i7 上以20轮训练复现原始 IMDB 段落向量实验约需一小时。<sup>[17](https://radimrehurek.com/gensim/auto_examples/howtos/run_doc2vec_imdb.html)</sup>

## References

1. [Quoc V. Le, Tomas Mikolov (2014). Distributed Representations of Sentences and Documents. arXiv:1405.4053.](https://arxiv.org/abs/1405.4053)
2. [Jey Han Lau, Timothy Baldwin (2016). An Empirical Evaluation of doc2vec with Practical Insights into Document Embedding Generation. Proceedings of the 1st Workshop on Representation Learning for NLP, pages 78–86.](https://aclanthology.org/W16-1609/)
3. [Benchmarking MeSH-augmented embeddings for biomedical document similarity. Journal of Biomedical Semantics.](https://link.springer.com/article/10.1186/s13326-026-00365-6)
4. [Evaluating text representations for unsupervised legal semantic textual similarity in Brazilian Portuguese. Discover Data.](https://link.springer.com/article/10.1007/s44248-025-00052-4)
5. [Chalmers thesis: Doc2Vec as an extension of Word2Vec; PV-DM and PV-DBOW.](https://odr.chalmers.se/bitstreams/22600e8c-5571-42a1-afd8-20ffda272db9/download)
6. [Gensim Wiki: Recipes & FAQ (doc2vec inference non-determinism).](https://github.com/piskvorky/gensim/wiki/Recipes-%26-FAQ)
7. [Measuring the diffusion of innovations with paragraph vector topic models. PMC6976149.](https://pmc.ncbi.nlm.nih.gov/articles/PMC6976149/)
8. [Andrew M. Dai, Christopher Olah, Quoc V. Le (2014). Document embedding with paragraph vectors. NIPS Deep Learning Workshop.](https://research.google/pubs/document-embedding-with-paragraph-vectors/)
9. [The Influence of Feature Representation of Text on the Performance of Document Classification. arXiv:1707.01321.](https://arxiv.org/abs/1707.01321)
10. [Marcińczuk et al. (2021). Text Document Clustering: Wordnet vs. TF-IDF vs. Word Embeddings. GWC 2021, pages 207–214.](https://aclanthology.org/2021.gwc-1.24/)
11. [Systematic evaluation of common NLP techniques to codify clinical notes. PMC10919678.](https://pmc.ncbi.nlm.nih.gov/articles/PMC10919678/)
12. [Specialists, Scientists, and Sentiments: Word2Vec and Doc2Vec in Analysis of Scientific and Medical Texts. PMC8364743.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8364743/)
13. [Word2Vec and Doc2Vec in Unsupervised Sentiment Analysis of Clinical Discharge Summaries. arXiv:1805.00352.](https://arxiv.org/abs/1805.00352)
14. [What are real world applications of Doc2Vec? Data Science Stack Exchange.](https://datascience.stackexchange.com/questions/23638/what-are-real-world-applications-of-doc2vec)
15. [Document Embeddings vs. Keyphrases vs. Terms: An Online Evaluation in Digital Library Recommender Systems. ISG Siegen.](https://isg.beel.org/blog/2019/05/13/document-embeddings-vs-keyphrases-vs-terms-an-online-evaluation-for-digital-library-recommender-systems/)
16. [On a method for identifying the most efficient data representation method for a corpus (Reuters 21578). ICAS 2019.](https://reference-global.com/2/v2/download/article/10.2478/icas-2019-0043.pdf)
17. [How to reproduce the doc2vec 'Paragraph Vector' paper. Gensim documentation.](https://radimrehurek.com/gensim/auto_examples/howtos/run_doc2vec_imdb.html)

---
*Initially written Oct 15, 2026*

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

Copyright 2026 Edgepedia

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

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

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