# 基于内容的过滤

基于内容的过滤是一种推荐方法，它将物品的特征——如文本、标签、类型或学习到的嵌入向量——与单个用户过往偏好的画像进行匹配，且仅使用该用户自身的交互历史。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 它基于用户之前的操作或显式反馈，推荐与用户曾经喜欢过的物品相似的物品。<sup>[2](https://developers.google.com/machine-learning/recommendation/content-based/basics)</sup> 与依赖其他用户评分的[协同过滤](https://www.edgepedia.org/zh/collaborative-filtering)不同，基于内容的方法将用户喜欢的物品属性与其他目录物品的属性进行匹配，完全聚焦于物品本身的属性。<sup>[3](https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering/mechanics-of-content-based-recommenders)</sup>

| 关键事实 | 详情 |
|---|---|
| 架构 | 三个组件：内容分析器、画像学习器和过滤组件<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> |
| 数据需求 | 仅需当前用户的评分；不需要其他用户的评分<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> |
| 新物品 | 仅凭属性即可推荐，避免了首个评分者问题<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup><sup> • </sup><sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> |
| 主要相似度度量 | 余弦相似度，取值范围为-1到1<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup><sup> • </sup><sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup> |
| 主要弱点 | 过度专业化：反复推荐与已消费物品相似的物品<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup><sup> • </sup><sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> |
| 特征格式 | 历史上使用TF-IDF关键词向量；现代生产系统使用768至3072维的稠密嵌入<sup>[6](https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering)</sup><sup> • </sup><sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup> |
| 优势领域 | 新闻和职位匹配，这些领域协同信号稀疏或每个物品都是新的<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup> |

## 工作原理：基于内容的流水线

经典架构包含三个组件。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 内容分析器通过预处理步骤，从本身没有固有结构的物品（如自由文本）中提取结构化特征。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 画像学习器收集代表用户偏好的数据，并将其泛化为用户画像。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 过滤组件将画像与候选物品进行匹配，并按相似度排序。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup><sup> • </sup><sup>[2](https://developers.google.com/machine-learning/recommendation/content-based/basics)</sup>

画像并非静态不变。用户对推荐物品表达满意或不满，收集到这些反馈后，学习过程会在新的训练集上再次执行，使画像随时间推移而自适应调整。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup>

## 特征提取与表示

什么算作“内容”取决于物品类型。对于文本物品，标准的经典方法使用TF-IDF将非结构化文本转换为数值格式。<sup>[6](https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering)</sup>

现代生产系统通常用由神经编码器生成的标题、描述和图像的稠密嵌入来替代手工设计的属性，维度通常为768至3072维。<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup>

特征的选择决定了质量的上限。如果分析的内容不包含足够的信息来区分用户喜欢的物品和用户不喜欢的物品，任何基于内容的系统都无法提供合适的建议。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 稀疏或通用的元数据会阻碍系统对物品做出有意义的区分。<sup>[3](https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering/mechanics-of-content-based-recommenders)</sup>

## 画像学习与相似度计算

在经典向量空间模型中，用户画像是一个从用户评分过的物品中学习到的加权词项向量，画像通过相关性反馈随时间推移不断精炼。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> Rocchio风格的相关性反馈分类是其中一种方法，尽管它缺乏理论基础，对性能或收敛性也没有保证。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 学习到的评分函数是另一种选择：在生产环境中，对前100个候选物品应用Cohere Rerank或BGE等交叉编码器重排器，相比仅使用相似度检索可提升10至20个百分点的精确度。<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup>

三种相似度度量占主导地位。<sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup>

- [余弦相似度](https://www.edgepedia.org/zh/cosine-similarity)衡量两个向量之间的夹角；它可以取-1到1之间的任意值，分数越高表示越相似，广泛用于向量空间内容推荐器，尤其是在高维特征空间中。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup><sup> • </sup><sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup>
- 欧氏距离衡量连接两个向量点的线段长度；分数可以低至零且没有上限，距离越小表示物品越相似。<sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup>
- [点积](https://www.edgepedia.org/zh/dot-product)是两个向量之间夹角的余弦值乘以它们的欧氏模长；最适合用于比较模长差异显著的物品，如图书或电影的流行度。<sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup>

## 数据说话

相似度度量的直接对比可以反映典型的准确率水平。在一个真实学习平台数据集上，余弦相似度取得了MAE 0.6和RMSE 0.87的成绩，优于Jaccard相似度和欧氏距离（MAE 0.66，RMSE 0.91）以及Pearson相关系数（MAE 0.72，RMSE 0.94）。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 相似度度量并不总是瓶颈：在一个期刊推荐系统中，BM25排序在社会科学领域取得了平均NDCG 0.626、医学领域0.615的成绩，而余弦相似度分别为0.436和0.469，因此特征的加权和评分方式与使用哪种距离度量同样重要。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 基于内容的方法也能与矩阵分解良好结合：一种将矩阵分解精炼的物品特征与提升学习的用户画像相结合的方法在ML-1M、Last.fm和Netflix基准数据集上得到验证，相比最先进的基线方法在推荐质量上显示出显著提升。<sup>[8](https://dl.acm.org/doi/10.1016/j.eswa.2022.117849)</sup>

在成本方面，一篇2025年的综述指出，基于内容的算法通常呈现相对于物品数量的线性时间复杂度，<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 而一篇2024年的综述报告称计算成本可能随用户和物品数量呈二次或三次增长。<sup>[9](https://arxiv.org/html/2407.13699v2)</sup> 这一分歧尚未解决。一项2024年的实证比较补充了细节：余弦、内积和欧氏距离产生了可比的检索性能，但余弦相似度在高维数据集上的时间性能显著较差，三种度量的响应时间均随数据集规模线性增长。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 在工业规模下，HNSW、IVF-PQ或ScaNN等近似最近邻索引可在10毫秒内检索数百万个嵌入向量。<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup>

## 与协同过滤的比较

两种方法在冷启动行为上具有互补性。协同过滤面临用户和物品冷启动问题、数据稀疏性以及流行度偏差——即频繁交互的物品被过度推荐。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 基于内容的系统不依赖其他用户：它们仅利用当前用户提供的评分来构建该用户的画像。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 这使得它们对物品冷启动问题具有鲁棒性，因为新物品可以仅凭其属性立即被推荐，无需历史用户-物品交互数据。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup> 行业文档也表达了同样的观点：由于该方法不依赖其他用户及其观看行为，新物品无需被任何人观看即可被推荐。<sup>[10](https://docs.peach.ebu.io/technical/tutorials/algorithms/cbfiltering/)</sup>

与此相对，弱点则在于新用户。基于内容的系统必须收集足够的用户评分才能学习偏好。<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 相反，与基于内容的方法相比，协同过滤能更好地发现潜在偏好并促进意外发现。<sup>[4](https://doi.org/10.17721/ait.2025.1.07)</sup>

基于内容的系统也更加透明。可以通过明确列出导致某物品出现在推荐列表中的内容特征或描述来提供解释；<sup>[1](http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf)</sup> 例如，电影推荐器可以引用与之前观看过的电影在类型或演员上的重叠，让用户做出更明智的决定。<sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup> 这种透明性和更好的新物品处理能力是比较综述特别指出的基于内容的优势，<sup>[11](https://ijsrcseit.com/index.php/home/article/view/CSEIT24102142)</sup> 同时指出混合系统和深度学习架构代表了当前的最先进水平。<sup>[11](https://ijsrcseit.com/index.php/home/article/view/CSEIT24102142)</sup>

## 基于内容系统的实践应用

每个物品都是新的或用户交互数据稀薄的领域有利于基于内容的方法。文章到文章的新闻推荐几乎完全依赖文本嵌入上的基于内容的相似度，因为突发新闻的协同信号过于稀疏——每篇文章都是新的。<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup> LinkedIn、Indeed和Workable上的职位与候选人匹配将职位描述和候选人画像嵌入，并按相似度检索前k个匹配，这是一种自然的契合，因为匹配双方都有丰富的文本内容。<sup>[7](https://neurals.ca/deep-dive/algorithms/content-based/)</sup>

[流媒体](https://www.edgepedia.org/zh/streaming-media)展示了边界案例：2009年Netflix奖的获胜方案混合了多种预测模型，如矩阵分解和邻域模型，而非展示对协同与基于内容混合方法的采用。<sup>[5](https://www.ibm.com/think/topics/content-based-filtering)</sup><sup> • </sup><sup>[12](https://www.asc.ohio-state.edu/statistics/dmsl/GrandPrize2009_BPC_BellKor.pdf)</sup>

## References

1. Lops, P., De Gemmis, M., Semeraro, G., "Content-based Recommender Systems: State of the Art and Trends", http://www.ag-nbi.de/wp-content/uploads/2015/08/02_ContentBasedRS.pdf
2. Google Machine Learning Crash Course, "Content-based filtering", https://developers.google.com/machine-learning/recommendation/content-based/basics
3. APXML, "How Content-Based Recommenders Work", https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering/mechanics-of-content-based-recommenders
4. "An Analytical Review of Content-Based and Collaborative Filtering in Recommender Systems" (2025), https://doi.org/10.17721/ait.2025.1.07
5. IBM, "What is content-based filtering?", https://www.ibm.com/think/topics/content-based-filtering
6. APXML, "Content-Based Filtering for Recommenders", https://apxml.com/courses/building-ml-recommendation-system/chapter-2-content-based-filtering
7. neurals, "Content-based filtering, Tutorial", https://neurals.ca/deep-dive/algorithms/content-based/
8. "Item feature refinement using matrix factorization and boosted learning based user profile generation for content-based recommender systems", Expert Systems with Applications (2022), https://dl.acm.org/doi/10.1016/j.eswa.2022.117849
9. "A Comprehensive Review of Recommender Systems: Transitioning from Theory to Practice" (2024), https://arxiv.org/html/2407.13699v2
10. PEACH (EBU), "Generic Content-Based Filtering", https://docs.peach.ebu.io/technical/tutorials/algorithms/cbfiltering/
11. "Collaborative Filtering vs. Content-Based Filtering: A Machine Learning Perspective in Recommendation Systems" (2024), https://ijsrcseit.com/index.php/home/article/view/CSEIT24102142
12. GrandPrize2009 BPC BellKor (asc.ohio-state.edu). https://www.asc.ohio-state.edu/statistics/dmsl/GrandPrize2009_BPC_BellKor.pdf

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Recommender systems › Content-based recommendation

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/content-based-filtering

English original: https://www.edgepedia.org/content-based-filtering
