推荐系统是什么?TikTok 与 Shopee 如何推荐产品
Trí tuệ nhân tạo

推荐系统是什么?TikTok 与 Shopee 如何推荐产品

推荐系统是什么?了解 TikTok For You 和 Shopee 如何通过 AI 推荐内容和产品,以及在电商中的应用。

系列文章: Trí tuệ nhân tạo
  1. 1 向量数据库是什么?语义 AI 搜索的基础
  2. 2 推荐系统是什么?TikTok 与 Shopee 如何推荐产品
  3. 3 什么是AI Agent?智能体如何自动化完成复杂任务?
  4. 4 Deepfake 是什么?如何检测和保护自己
  5. 5 什么是Prompt Engineering?高效指令AI的艺术
  6. 6 Fine-tuning 是什么?为企业定制 AI 模型
  7. 7 什么是RAG?Retrieval-Augmented Generation — 让AI学会查阅文档
  8. 8 什么是越南AI法律?人工智能监管框架(2026年更新)
✦ 快速摘要
推荐系统是什么?了解 TikTok For You 和 Shopee 如何通过 AI 推荐内容和产品,以及在电商中的应用。
这篇文章怎么样?

每当你打开TikTok,发现自己不知不觉地连续刷视频,或者Shopee向你展示了一件你没有搜索过但最终下单购买的商品——你正在亲身体验推荐系统的运作。这些无形的引擎是当今人工智能在实际应用中最强大、商业价值最高的系统之一。对于任何在数字商务、内容或营销领域运营的企业而言,理解它们的运作方式至关重要。

什么是推荐系统?

推荐系统是一种引擎,它根据特定用户的历史行为以及与其相似用户的行为,预测并呈现该用户可能感兴趣的内容、产品或服务。其目标因场景而异:对于TikTok,主要目标是最大化用户参与度(让用户在平台上停留更长时间);对于Shopee,主要目标是最大化转化率(将浏览行为转化为购买)。

推荐系统与搜索引擎之间的本质区别在于用户意图。当用户搜索"防水防晒霜SPF50"时,他们有明确的购买意图——他们知道自己想要什么,正在主动寻找。而推荐系统在用户没有明确意图的情况下运作。用户打开Shopee首页时没有具体的购买计划,系统必须从间接行为信号中推断出此刻最可能对用户有用或令其满意的商品。

这使得推荐问题比搜索问题复杂得多。没有可以匹配的查询语句。系统必须仅从间接信号中建模用户的偏好、当前场景和可能的近期兴趣。

这一问题的商业意义极为深远。Netflix曾报告,平台上75%至80%的观看内容来自推荐,而非主动搜索。对于拥有数亿订阅用户的平台而言,这意味着推荐引擎实际上是Netflix最主要的内容发现机制——远比其搜索栏重要。这一模式在各平台普遍存在:亚马逊将可观的收入归因于"购买此商品的顾客也购买了……"推荐功能,而TikTok的整个内容分发模式就是围绕算法推荐构建的,而非对特定创作者的订阅。

从实际操作角度来看,推荐系统的输入包括:(1)用户的互动历史——他们观看、点击、购买、跳过或评分的内容;(2)物品属性——可推荐产品或视频的类别、价格、描述、标签或内容特征;(3)上下文信号——一天中的时间、设备类型、地理位置、当前会话行为。输出是一个有序列表,其中包含预测对该用户在当前时刻最相关的物品。

推荐系统的三种主要类型

推荐系统领域自20世纪90年代以来持续发展,形成了三种主要架构方式,每种方式都有其独特的优势、劣势和适用场景。

协同过滤是最广为人知的方法。它基于一个直觉:过去意见一致的人往往在未来也会保持一致。如果用户A和用户B都购买了产品X、Y和Z,而用户A还购买了产品W,那么用户B也喜欢产品W的可能性就相当高——即使系统对产品W本身一无所知。

协同过滤基于用户-物品交互矩阵运作,其中行代表用户,列代表物品,值代表交互(购买、评分、观看时长、点击)。系统找到交互模式相似的用户或物品,并利用这些相似性生成推荐。有两个子类型:基于用户的协同过滤(找到与目标用户相似的用户,然后推荐这些用户喜欢的物品)和基于物品的协同过滤(找到与目标用户交互过的物品相似的物品,然后推荐这些相似物品)。对于大型商品目录,基于物品的方式通常具有更好的可扩展性。

协同过滤的主要局限是冷启动问题:它需要大量的交互数据才能正常运作。一个没有历史记录的新用户会收到糟糕的推荐。一个没有互动记录的新物品永远不会被推荐。各平台通过新用户引导问卷、基于热度的备选方案或混合方法来解决这一问题。

基于内容的过滤采取了不同的方法:它不去研究相似用户喜欢什么,而是分析用户交互过的物品属性,并推荐具有相似属性的物品。如果用户一直在购买描述中含有"透明质酸"和"无香料"的保湿产品,基于内容的系统将推荐具有这些属性的其他保湿产品——即使没有其他用户做过相同的购买组合。

基于内容的过滤完全依赖物品元数据和单个用户自身的历史记录。这使它对用户冷启动问题免疫:购买了一件商品的新用户会立即获得基于该商品属性的推荐。然而,它存在一个不同的局限:倾向于推荐过于相似的内容,造成推荐范围狭窄。购买了某品牌防晒霜的用户可能永远只看到该品牌的产品被推荐。

混合系统结合了两种方法,几乎所有主要的生产推荐系统都使用这种方式。组合可以通过几种方式实现:一个将两个模型分数混合的集成方法;一个加权组合(对有丰富历史的用户以协同过滤为主,对新用户则基于内容为主);或者一个切换型混合系统,检测哪种方法更合适并相应路由。Netflix、Spotify、亚马逊以及所有主要电商平台都使用混合架构,通常在其上叠加深度学习层。

TikTok For You 页面如何运作

TikTok的For You Page(FYP)被广泛认为是消费者规模上部署的最先进的内容推荐系统。理解其架构揭示了适用于各推荐领域的通用原则。

该系统以多阶段排序管道运作。它要解决的根本问题是规模问题:TikTok上有超过100亿个视频,系统需要在下一个会话中为用户选出大约20至30个视频。没有一个单一模型可以实时高效地对100亿个物品进行排序。管道逐步缩小候选池。

**第一阶段——候选生成。**从100亿+视频的完整语料库中,系统检索出大约500至1,000个候选视频。该阶段使用轻量级模型,侧重于召回而非精确率。检索基于宽泛信号:用户关注的账号、与用户历史互动相似的视频、用户所在地理区域的热门内容、用户表现出兴趣的类别内容,以及适合用户设备和网络条件的内容。

**第二阶段——检索与过滤。**约1,000个候选视频按质量、安全性和政策合规性进行过滤。删除重复内容,过滤用户已看过的内容。系统还应用多样性约束,确保候选池不全来自同一类别。

**第三阶段——排序。**这是推荐系统的核心。一个深度学习模型同时对每个候选视频的多个预测结果进行评分:预测观看时长(这个用户会看这个视频多少百分比?)、预测点赞概率、预测分享概率、预测评论概率以及预测"不感兴趣"概率。最终排序分数是这些预测的加权组合,其中观看时长通常权重最高,因为它是真实参与度最强的信号。

**第四阶段——多样性注入。**TikTok刻意在最终动态中注入10%至15%的"探索性"内容——来自用户此前未互动过的类别或创作者的视频。这有两个目的:防止系统收敛到过于狭窄的信息茧房,并允许系统探索可能成为该用户未来强烈偏好的新内容空间。

驱动TikTok排序的行为信号通过逆向工程和TikTok自身的透明度报告得到了充分记录。观看时长百分比是最重要的正向信号——看完一个60秒的视频比看完一个15秒的视频信号更强,而重复观看同一视频是非常强的正向信号。分享被视为强正向信号,比点赞更强,因为分享需要主动决定将内容传递给他人。评论是正向的。点赞是正向的,但略弱于分享。"不感兴趣"是强烈的负向信号,会抑制类似内容。观看视频后访问创作者主页是非常强的正向信号,表明对创作者有高度兴趣。

对于内容创作者来说,TikTok的系统意味着,如果内容在前200至500次观看中产生高观看时长,新账号可以相对快速地进入For You Page。系统最初将新内容分发给一小批测试受众;如果参与信号强烈,则逐步分发给越来越大的受众。这造就了TikTok特有的现象:不知名的创作者如果内容引发共鸣,可以在48小时内走红。

Shopee 如何推荐产品

Shopee的推荐架构与TikTok的不同,其主要目标是转化而非参与——但底层技术方法相似。Shopee上主要的推荐页面包括首页信息流、商品页面上的"猜你喜欢"、"一起购买"捆绑商品、品类推荐页面和搜索结果个性化。

物品到物品协同过滤是Shopee"一起购买"功能的基础。系统分析数百万笔交易中的共同购买模式:哪些产品出现在同一个购物车或同一购买会话中?购买手机壳的用户很可能还需要屏幕保护膜。购买粉底的用户很可能还需要定妆粉。这些关联从汇总的交易数据而非个人用户档案中计算得出,即使对历史记录有限的用户也能可靠运作。

序列推荐对用户随时间变化的购买旅程进行建模。Shopee不仅追踪用户购买了什么,还追踪购买的顺序和时间。三个月前购买了基础洁面乳、两个月前购买了爽肤水、上个月购买了精华的用户,正在遵循护肤例程逐步建立的模式。系统预测该用户的下一次购买很可能是保湿产品或防晒霜。这种时序建模使Shopee能够在用户消费旅程的正确节点推荐合适的产品。

基于会话的实时个性化根据用户在当前会话中的浏览行为调整推荐,而不仅仅基于历史档案。如果一个通常购买服装的用户突然花十分钟浏览露营装备,基于会话的组件将暂时将推荐转向户外产品——即使其历史档案显示对户外活动没有兴趣。这种会话上下文对于季节性购物或礼品购物场景尤为重要。

价格敏感度建模是Shopee特有的功能,它学习每个用户在各产品类别中的典型消费区间。始终购买中档护肤品的用户很少会在高端护肤品推荐上转化,即使这些产品很受欢迎。系统按推断的价格敏感度细分推荐,确保推荐产品落在该用户历史上愿意消费的区间内。

不同的推荐页面服务于不同的目的。商品页面上的"猜你喜欢"使用协同过滤寻找类似物品——它针对的是仍在浏览、尚未决定购买的用户。"一起购买"使用共同购买分析,针对已决定购买、可能对附加商品感兴趣的用户。"赞助"推荐是有机推荐层之上的付费覆盖层——广告主可以竞价在推荐位出现,系统在商业相关性和有机质量之间取得平衡,以避免降低用户体验。

Shopee推荐引擎的商业影响十分显著:Shopee约35%的商品交易总额(GMV)归因于推荐引擎,而非直接的搜索驱动购买。

衡量推荐系统效果的指标

构建推荐系统相对简单;构建一个真正改善业务成果的系统需要严格的度量。该领域已形成一套标准指标,但合适的指标在很大程度上取决于业务目标。

**点击率(CTR)**衡量点击至少一个推荐物品的用户百分比。这是最常报告的指标,因为它容易测量,但也是最容易被滥用的——纯粹优化CTR的系统会推荐标题党内容,而非真正有用的物品。CTR应始终与下游转化指标配合使用。

转化率衡量被点击的推荐中导致购买(或其他期望行为)的百分比。这比CTR更符合业务价值,但可能产生扭曲的激励机制——只推荐最普遍受欢迎的产品,而这些产品可能完全没有个性化。

每用户收入衡量通过推荐驱动的互动为每个用户平均产生的收入。这同时捕获了转化率和平均订单价值,从而更完整地反映商业影响。

新颖性衡量推荐系统推荐用户此前未曾遇到过的物品的程度。一个只推荐用户已购买物品的系统在转化率上表现良好,但没有提供发现价值。新颖性对于用户体验以及帮助平台展示新库存非常重要。

多样性衡量推荐列表中的品种丰富程度。包含十个来自同一类别同一品牌产品的列表,即使每条推荐都相关,其多样性也为零。低多样性会带来糟糕的用户体验,并错过交叉销售机会。

**意外惊喜性(Serendipity)**是最难优化的指标,可以说也是推荐质量最高的信号。具有意外惊喜性的推荐是让用户感到出乎意料的——用户不会预期它——但结果却真正相关。TikTok的"探索性"内容注入就是专门为创造这种意外时刻而设计的。意外惊喜性通常通过用户调查或追踪用户很少参与的类别中的内容互动来衡量。

在实践中,生产推荐系统会追踪所有这些指标并在它们之间进行权衡。纯粹优化CTR会产生标题党内容。纯粹优化转化率会产生枯燥、重复的推荐。最好的系统找到一个平衡点,使长期用户满意度和收入最大化,这通常需要接受较低的短期CTR,以换取更高的新颖性和多样性。

信息茧房问题

信息茧房是推荐系统最重要的意外后果之一,它以不同但同样重要的方式影响着内容平台和电商平台。

当一个推荐系统以推荐用户最可能参与的内容为优化目标时,就会发生信息茧房——它逐步缩小用户接触的内容范围。每一次互动都强化了系统对用户偏好的建模,促使其推荐更多类似内容,进而使用户与该类型内容产生更多互动,进一步强化模型。结果是一个反馈循环,将用户困在信息泡泡中——他们只看到确认现有兴趣和信念的内容,从不接触新的观点、产品或想法。

讨论最广泛的例子涉及政治内容。一个观看了某一特定政治观点视频的用户,很可能会被推荐更多持有类似观点的视频。经过数周或数月,系统可能已将其媒体饮食缩窄至单一的意识形态视角,这可能在更大范围内助长极化。TikTok、Facebook和YouTube都在这一背景下被学术界研究过。

对于电商而言,信息茧房问题形状不同,但对商业同样有害。如果一个客户的整个推荐体验被一个产品类别所主导——比如护肤品——他们可能永远不会发现同一品牌还有优质的护发产品。推荐系统以最大化转化概率为优化目标,持续呈现用户历史转化率最高的类别,从而错失跨类别收入机会。

各大平台实施的解决方案包括以下几种方法。探索与利用平衡(有时称为epsilon-贪婪算法)刻意注入一定比例的随机或新颖推荐。以概率ε(通常为5%至20%),系统推荐用户已建立偏好区域之外的内容;以概率1-ε,推荐预测相关性最高的物品。多样性注入如TikTok系统所描述的,是这一方法的结构化版本——确保推荐列表包含来自用户核心兴趣区域之外类别的最低百分比内容。用户控制设置允许用户在看到太多某类内容时发出信号("显示更多品种"、"对这个话题不感兴趣"),为系统提供直接的负向反馈。时间衰减对较旧的互动施加递减权重,使近期行为主导长期既有偏好——这意味着用户的兴趣可以随时间转变,而不是永久锚定于早期互动。

AlgoData 与推荐系统

AlgoData将推荐系统的概念应用于帮助越南品牌理解并利用从Shopee和TikTok Shop数据中提取的购买行为模式。

核心应用是购物篮分析——通过大规模分析交易数据来识别哪些产品经常被一起购买。对于在Shopee上销售的护肤品牌,AlgoData可以识别出购买特定防晒霜的顾客在14天内购买维生素C精华的比例远超随机水平。这种共同购买信号是"一起购买"推荐的基础,品牌可以利用它构建产品套装、优化交叉推广活动,并确保其SKU出现在平台上彼此的推荐位中。

跨类别机会识别将这一分析扩展到单一品牌产品目录之外。AlgoData检验在某一类别大量购买的顾客是否在相邻类别中显示出更高的购买可能性。正在建立护肤例程的顾客通常在30至60天内扩展到护发产品。识别这一转变时机使品牌能够精准安排营销活动——在顾客最开放于跨类别发现的时刻触达他们。

下次购买时间预测使用序列模式分析来估计特定顾客下次在某一类别购买的时间。对于防晒霜或洗面奶等以可预测速度消耗的消费品,这一预测相对简单。对于服装或电子产品等可自由支配的产品,则需要基于历史购买间隔和季节模式进行建模。品牌利用这一时间数据优化营销活动排期——在顾客处于购买模式时以相关推荐触达他们,而非在所有时间向所有顾客统一广播。

对于询问"我们的哪些产品应该在Shopee的'一起购买'栏目中相互出现?"的品牌,AlgoData基于实际的共同购买行为提供数据驱动的答案,而非依赖对产品互补性的直觉判断。

另请参阅:什么是AI Agent?

构建一个简单的推荐系统

对于希望在投入生产系统之前理解机制的团队,从头开始构建一个基础协同过滤引擎是一个很有价值的练习。以下演示使用Python、pandas和scikit-learn。

第一步:构建用户-物品交互矩阵。

Python
 1import pandas as pd
 2import numpy as np
 3from sklearn.metrics.pairwise import cosine_similarity
 4
 5# 示例交易数据
 6transactions = pd.DataFrame({
 7    'user_id': [1, 1, 1, 2, 2, 3, 3, 3, 4, 4],
 8    'product_id': ['A', 'B', 'C', 'A', 'D', 'B', 'C', 'D', 'A', 'C'],
 9    'purchase_count': [2, 1, 3, 1, 2, 1, 2, 1, 3, 1]
10})
11
12# 转换为用户-物品矩阵(行=用户,列=商品,值=购买次数)
13user_item_matrix = transactions.pivot_table(
14    index='user_id',
15    columns='product_id',
16    values='purchase_count',
17    fill_value=0
18)

第二步:计算用户相似度。

Python
1# 使用余弦相似度计算用户之间的相似性
2user_similarity = cosine_similarity(user_item_matrix)
3user_similarity_df = pd.DataFrame(
4    user_similarity,
5    index=user_item_matrix.index,
6    columns=user_item_matrix.index
7)

第三步:生成推荐。

Python
 1def recommend(user_id, n=5):
 2    # 找到最相似的用户(排除用户本身)
 3    similar_users = user_similarity_df[user_id].drop(user_id).nlargest(10)
 4
 5    # 获取相似用户购买过但目标用户尚未购买的商品
 6    target_purchases = set(
 7        user_item_matrix.loc[user_id][user_item_matrix.loc[user_id] > 0].index
 8    )
 9
10    scores = {}
11    for similar_user, similarity in similar_users.items():
12        similar_purchases = user_item_matrix.loc[similar_user]
13        for product, count in similar_purchases.items():
14            if count > 0 and product not in target_purchases:
15                # 相似度越高、购买次数越多,得分越高
16                scores[product] = scores.get(product, 0) + similarity * count
17
18    # 按分数降序返回前N个推荐
19    recommendations = sorted(scores.items(), key=lambda x: x[1], reverse=True)
20    return recommendations[:n]
21
22print(recommend(user_id=1, n=5))

这个简单实现展示了核心机制:构建交互矩阵,使用余弦距离衡量用户相似度,然后推荐相似用户已购买但目标用户尚未购买的物品。

**数据要求与局限性。**这种方法至少需要约1,000名用户,每人至少5次互动,才能避免严重的冷启动退化。低于该阈值,相似度分数不可靠,推荐实际上是随机的。

**生产环境注意事项。**生产系统无法实时重新计算所有用户对之间的余弦相似度——对于1000万用户,该矩阵有10^14个单元格。生产系统使用近似最近邻(ANN)算法(如FAISS、HNSW、ScaNN)在次线性时间内找到相似用户。用户和物品的表示被预先计算为稠密嵌入向量(通常64至256维),并按计划(每小时或每天)更新,而非实时计算。服务层从低延迟存储(Redis、DynamoDB)检索预计算的推荐,而非按需计算。

另请参阅:什么是向量数据库?

结论

推荐系统是驱动现代电商和内容平台的核心引擎。它们不是可选功能——对于TikTok和Shopee这样的平台,它们是用户发现内容和产品的主要机制。理解其架构和机制对于任何在数字商务或内容领域竞争的企业都至关重要。

合适的推荐架构取决于企业的成熟度和规模。早期阶段、交易数据有限的企业应从简单的购物篮分析和基于内容的过滤入手——这些方法需要的数据更少,即使只有几千笔交易也能提供有意义的结果。成长阶段的企业应投资于混合协同过滤系统,并开始对序列购买行为进行建模。拥有数百万笔交易的企业级规模应探索深度学习推荐架构和多阶段排序管道。

对于在Shopee和TikTok Shop上销售的越南企业来说,即使将基础的购物篮分析应用于现有交易数据,也可以发现价值额外15%至20%收入的交叉销售机会。这些数据存在于你的交易历史中;问题在于你是否在系统化地分析它。AlgoData提供这类分析,将来自越南电商平台的原始交易数据转化为品牌可执行的推荐信号。

驱动TikTok和Shopee的推荐系统并不神奇——它们是在巨大规模下对成熟统计原理的系统化应用。同样的原理,以适合越南品牌规模的方式应用,可以带来同类别的商业影响。

另请参阅:什么是RFM?

Every time you open TikTok and find yourself watching video after video without consciously choosing any of them, or every time Shopee shows you a product you didn't search for but end up buying — you are experiencing a recommendation system at work. These invisible engines are among the most powerful and commercially significant applications of artificial intelligence in use today. Understanding how they operate is essential for any business operating in digital commerce, content, or marketing.

What Is a Recommendation System?

A recommendation system is an engine that predicts and surfaces content, products, or services that a specific user is likely to find relevant, based on that user's past behavior and the behavior of users who are similar to them. The goal differs depending on context: for TikTok, the primary goal is maximizing engagement (keeping users on the platform longer); for Shopee, the primary goal is maximizing conversion (turning browser behavior into purchases).

The fundamental distinction between a recommendation system and a search engine lies in user intent. When a user searches for "waterproof sunscreen SPF 50," they have a clear, explicit intent — they know what they want and are looking for it. A recommendation system operates in the absence of explicit intent. The user opens their Shopee homepage without a specific purchase in mind, and the system must infer from behavioral history what is most likely to be useful or desirable at that moment.

This makes the recommendation problem significantly harder than the search problem. There is no query to match against. The system must model the user's tastes, current context, and likely near-future interests from indirect signals alone.

The commercial significance is enormous. Netflix has reported that 75–80% of the content watched on their platform comes not from active search but from recommendations. For a platform with hundreds of millions of subscribers, this means that the recommendation engine is effectively Netflix's primary product discovery mechanism — far more important than its search bar. The pattern holds across platforms: Amazon attributes a significant portion of its revenue to "Customers who bought this also bought…" recommendations, and TikTok's entire content delivery model is built around algorithmic recommendation rather than subscription to specific creators.

In practical terms, a recommendation system takes as input: (1) a user's interaction history — what they watched, clicked, purchased, skipped, or rated; (2) item attributes — the category, price, description, tags, or content features of available products or videos; and (3) contextual signals — time of day, device type, location, current session behavior. It produces as output an ordered list of items predicted to be most relevant to that user at that moment.

The Three Main Types of Recommendation Systems

The field of recommendation systems has been developing since the 1990s, and three main architectural approaches have emerged, each with distinct strengths, weaknesses, and use cases.

Collaborative Filtering is the most widely known approach. It is based on the intuition that people who agreed in the past tend to agree in the future. If User A and User B have both purchased products X, Y, and Z, and User A has also purchased product W, then there is a reasonable chance that User B would also like product W — even if the system knows nothing about what product W actually is.

Collaborative Filtering operates on a user-item interaction matrix, where rows represent users, columns represent items, and values represent interactions (purchases, ratings, watch time, clicks). The system finds users or items with similar interaction patterns and uses those similarities to generate recommendations. There are two sub-variants: user-based collaborative filtering (find users similar to the target user, then recommend items those users liked) and item-based collaborative filtering (find items similar to items the target user has interacted with, then recommend those similar items). Item-based tends to be more scalable for large catalogs.

The major limitation of Collaborative Filtering is the cold start problem: it requires substantial interaction data to function well. A new user with no history gets poor recommendations. A new item with no interactions never gets recommended. Platforms address this with onboarding questionnaires, popularity-based fallbacks, or hybrid approaches.

Content-Based Filtering takes a different approach: instead of looking at what similar users liked, it looks at the attributes of items the user has interacted with and recommends items with similar attributes. If a user has been buying moisturizers with "hyaluronic acid" and "fragrance-free" in their descriptions, a content-based system will recommend other moisturizers with those attributes — even if no other user has made the same combination of purchases.

Content-Based Filtering works entirely from item metadata and a single user's own history. This makes it immune to the cold start problem for users: a new user who purchases one item immediately gets recommendations based on that item's attributes. However, it suffers from a different limitation: it tends to recommend more of the same, creating a narrow recommendation space. A user who bought one brand of sunscreen may only ever see that brand's products recommended.

Hybrid Systems combine both approaches, and they are what almost every major production recommendation system uses today. The combination can be implemented in several ways: an ensemble that blends the scores from both models; a weighted combination where Collaborative Filtering dominates for users with rich history and Content-Based takes over for new users; or a switching hybrid that detects which approach is appropriate and routes accordingly. Netflix, Spotify, Amazon, and all major e-commerce platforms use hybrid architectures, often augmented with deep learning layers on top.

How TikTok's For You Feed Works

TikTok's For You Page (FYP) is widely regarded as the most sophisticated content recommendation system deployed at consumer scale. Understanding its architecture reveals principles applicable across recommendation domains.

The system operates as a multi-stage ranking pipeline. The problem it solves is fundamentally one of scale: there are over 10 billion videos on TikTok, and the system needs to select approximately 20–30 videos to show a user in their next session. No single model can efficiently rank 10 billion items in real time. The pipeline progressively narrows the candidate pool.

Stage 1 — Candidate Generation. From the full corpus of 10 billion+ videos, the system retrieves approximately 500–1,000 candidates. This stage uses lightweight models focused on recall rather than precision. The retrieval is based on broad signals: user's followed accounts, videos similar to the user's historical interactions, trending content in the user's geographic region, content in categories the user has shown interest in, and content appropriate for the user's device and network conditions.

Stage 2 — Retrieval and Filtering. The ~1,000 candidates are filtered for quality, safety, and policy compliance. Duplicate content is removed. Content the user has already seen is filtered. The system also applies diversity constraints to ensure the candidate pool is not entirely from one category.

Stage 3 — Ranking. This is the core of the recommendation system. A deep learning model scores each candidate on multiple predicted outcomes simultaneously: predicted watch time (what percentage of this video will this user watch?), predicted like probability, predicted share probability, predicted comment probability, and predicted "not interested" probability. The final ranking score is a weighted combination of these predictions, with watch time typically weighted most heavily because it is the strongest signal of genuine engagement.

Stage 4 — Diversity Injection. TikTok deliberately injects 10–15% "exploration" content into the final feed — videos from categories or creators the user has not previously engaged with. This serves two purposes: it prevents the system from converging on an overly narrow filter bubble, and it allows the system to explore new content spaces that might become strong future preferences for that user.

The behavioral signals that drive TikTok's ranking are well-documented through reverse engineering and TikTok's own transparency reports. Watch time percentage is the most important positive signal — completing a 60-second video is a stronger signal than completing a 15-second video, and watching a video twice is a very strong positive signal. Shares are treated as a strong positive signal, stronger than likes, because sharing requires active decision to pass content to another person. Comments are positive. Likes are positive but somewhat weaker than shares. "Not interested" is a strong negative signal that suppresses similar content. Profile visits after watching a video are a very strong positive signal indicating high interest in the creator.

For content creators, TikTok's system means that new accounts can reach the For You Page relatively quickly if their content generates high watch time in its first 200–500 views. The system initially distributes new content to a small test audience; if engagement signals are strong, it distributes to a progressively larger audience. This creates TikTok's characteristic pattern where unknown creators can go viral within 48 hours if their content resonates.

How Shopee Suggests Products

Shopee's recommendation architecture differs from TikTok's in its primary objective — conversion rather than engagement — but the underlying technical approaches are similar. The major recommendation surfaces on Shopee include the homepage feed, "You Might Also Like" on product pages, "Frequently Bought Together" bundles, category recommendation pages, and search result personalization.

Item-to-item collaborative filtering is the foundation of Shopee's "Frequently Bought Together" feature. The system analyzes co-purchase patterns across millions of transactions: which products appear together in the same cart or within the same purchase session? A user buying a phone case is likely to also want a screen protector. A user buying a foundation is likely to also want a setting powder. These associations are computed from aggregate transaction data rather than individual user profiles, making them robust even for users with limited history.

Sequential recommendation models the user's purchase journey over time. Shopee tracks not just what a user has purchased but the sequence and timing of purchases. A user who bought a basic cleanser three months ago, a toner two months ago, and a serum last month is following a skincare routine build-up pattern. The system predicts that their next likely purchase is a moisturizer or sunscreen. This temporal modeling allows Shopee to surface the right product at the right point in a user's consumption journey.

Session-based real-time personalization adjusts recommendations based on what a user is browsing in their current session, not just their historical profile. If a user who typically buys clothing suddenly spends ten minutes browsing camping equipment, the session-based component will temporarily shift recommendations toward outdoor products — even if their historical profile suggests no interest in outdoor activities. This session context is especially important for seasonal or gift shopping scenarios.

Price sensitivity modeling is a Shopee-specific feature that learns each user's typical spending range per product category. A user who consistently purchases mid-range skincare products will rarely convert on luxury skincare recommendations, even if those products are popular. The system segments recommendations by inferred price sensitivity, ensuring that recommended products fall within the range where the user has historically been willing to transact.

The different recommendation surfaces serve different purposes. "You Might Also Like" on a product page uses collaborative filtering to find similar items — it targets users who are still in browse mode and haven't committed to a purchase. "Frequently Bought Together" uses co-purchase analysis and targets users who have decided to buy and may be receptive to add-ons. "Sponsored" recommendations are a paid overlay on the organic recommendation layer — advertisers can bid to appear in recommendation slots, with the system balancing commercial relevance and organic quality to avoid degrading user experience.

The commercial impact of Shopee's recommendation engine is significant: approximately 35% of Shopee's Gross Merchandise Value (GMV) is attributed to the recommendation engine rather than direct search-driven purchases.

Metrics for Measuring Recommendation System Effectiveness

Building a recommendation system is straightforward; building one that actually improves business outcomes requires rigorous measurement. The field has developed a set of standard metrics, though the appropriate metric depends heavily on the business objective.

Click-Through Rate (CTR) measures the percentage of users who click on at least one recommended item. It is the most commonly reported metric because it is easy to measure, but it is also the most gameable — a system optimized purely for CTR will recommend clickbait rather than genuinely useful items. CTR should always be paired with downstream conversion metrics.

Conversion Rate measures the percentage of clicked recommendations that result in a purchase (or other desired action). This is more aligned with business value than CTR, but it can create perverse incentives to recommend only the most universally popular products, which may not be personalized at all.

Revenue Per User measures the average revenue generated per user through recommendation-driven interactions. This captures both conversion rate and average order value, making it a more complete picture of commercial impact.

Novelty measures the degree to which a recommendation system surfaces items the user has not previously encountered. A system that only recommends items the user has already bought scores well on conversion but provides no discovery value. Novelty is important for user experience and for helping platforms surface new inventory.

Diversity measures the variety within a recommendation list. A list containing ten products from the same category and the same brand has zero diversity, even if each individual recommendation is relevant. Low diversity creates a poor user experience and misses cross-sell opportunities.

Serendipity is the hardest metric to optimize and arguably the highest-quality signal of recommendation excellence. A serendipitous recommendation is one that is surprising — the user would not have expected it — but turns out to be genuinely relevant. TikTok's "exploration" content injection is designed specifically to create serendipitous moments. Serendipity is typically measured through user surveys or by tracking engagement on content from categories the user rarely engages with.

In practice, production recommendation systems track all of these metrics and make tradeoffs between them. Optimizing purely for CTR creates clickbait. Optimizing purely for conversion creates boring, repetitive recommendations. The best systems find a balance that maximizes long-term user satisfaction and revenue, which often requires accepting lower short-term CTR in exchange for higher novelty and diversity.

The Filter Bubble Problem

The filter bubble is one of the most significant unintended consequences of recommendation systems, and it affects both content platforms and e-commerce platforms in different but important ways.

A filter bubble occurs when a recommendation system, optimized to surface content the user is most likely to engage with, progressively narrows the range of content a user is exposed to. Each interaction reinforces the system's model of the user's preferences, causing it to recommend more of the same, which causes the user to interact more with that type of content, further reinforcing the model. The result is a feedback loop that traps users in an information bubble — they see only content that confirms their existing interests and beliefs, and are never exposed to new perspectives, products, or ideas.

The most discussed examples involve political content. A user who watches one video expressing a particular political viewpoint is likely to be shown more videos with similar viewpoints. Over weeks or months, the system may have narrowed their media diet to a single ideological perspective, which can contribute to polarization at scale. TikTok, Facebook, and YouTube have all been studied in this context.

For e-commerce, the filter bubble problem has a different shape but is equally damaging commercially. If a customer's entire recommendation experience is dominated by one product category — say, skincare — they may never discover that the same brand has excellent haircare products. The recommendation system, optimized to maximize conversion probability, keeps surfacing the category where the user has the highest historical conversion rate, missing cross-category revenue opportunities.

The solutions that major platforms have implemented include several approaches. Exploration vs. exploitation balancing (sometimes called epsilon-greedy) deliberately injects a fraction of random or novel recommendations. With probability ε (typically 5–20%), the system recommends something outside the user's established preference zone; with probability 1-ε, it recommends the highest-predicted-relevance item. Diversity injection, as described in TikTok's system, is a structured version of this — ensuring the recommendation list contains a minimum percentage of content from categories outside the user's core interest areas. User control settings allow users to signal when they have seen too much of a particular type of content ("show more variety," "not interested in this topic"), giving the system direct negative feedback. Temporal decay applies decreasing weight to older interactions, allowing recent behavior to dominate over established long-term preferences — this means a user's interests can shift over time rather than being permanently anchored to early interactions.

AlgoData and Recommendation Systems

AlgoData applies recommendation system concepts to help Vietnamese brands understand and act on purchasing behavior patterns extracted from Shopee and TikTok Shop data.

The core application is market basket analysis — identifying which products are frequently purchased together by analyzing transaction data at scale. For a skincare brand selling on Shopee, AlgoData can identify that customers who buy a particular sunscreen also purchase Vitamin C serum within 14 days at a rate significantly above chance. This co-purchase signal is the foundation of "Frequently Bought Together" recommendations, and brands can use it to structure product bundles, optimize cross-promotion campaigns, and ensure their SKUs appear in each other's recommendation slots on the platform.

Cross-category opportunity identification extends this analysis beyond a single brand's product catalog. AlgoData examines whether customers who purchase heavily in one category show elevated purchase probability in adjacent categories. Customers who are building a skincare routine often expand into haircare products within 30–60 days. Identifying this transition point allows brands to time marketing campaigns to reach customers at the moment when they are most open to cross-category discovery.

Next-purchase timing prediction uses sequential pattern analysis to estimate when a specific customer is likely to make their next purchase in a given category. For consumable products like sunscreen or face wash that deplete at predictable rates, this prediction is relatively straightforward. For discretionary products like clothing or electronics, it requires modeling based on historical purchase intervals and seasonal patterns. Brands use this timing data to optimize campaign scheduling — reaching customers with relevant recommendations when they are in purchase mode rather than broadcasting uniformly across all customers at all times.

For brands asking "which of our products should appear in each other's Frequently Bought Together sections on Shopee?", AlgoData provides data-driven answers based on actual co-purchase behavior rather than intuition about product complementarity.

See also: What is AI Agent?

Building a Simple Recommendation System

For teams that want to understand the mechanics before committing to a production system, building a basic collaborative filtering engine from scratch is a useful exercise. The following walkthrough uses Python with pandas and scikit-learn.

Step 1: Build the user-item interaction matrix.

Python
 1import pandas as pd
 2import numpy as np
 3from sklearn.metrics.pairwise import cosine_similarity
 4
 5# Example transaction data
 6transactions = pd.DataFrame({
 7    'user_id': [1, 1, 1, 2, 2, 3, 3, 3, 4, 4],
 8    'product_id': ['A', 'B', 'C', 'A', 'D', 'B', 'C', 'D', 'A', 'C'],
 9    'purchase_count': [2, 1, 3, 1, 2, 1, 2, 1, 3, 1]
10})
11
12# Pivot to user-item matrix
13user_item_matrix = transactions.pivot_table(
14    index='user_id',
15    columns='product_id',
16    values='purchase_count',
17    fill_value=0
18)

Step 2: Compute user similarity.

Python
1# Cosine similarity between users
2user_similarity = cosine_similarity(user_item_matrix)
3user_similarity_df = pd.DataFrame(
4    user_similarity,
5    index=user_item_matrix.index,
6    columns=user_item_matrix.index
7)

Step 3: Generate recommendations.

Python
 1def recommend(user_id, n=5):
 2    # Find top similar users (excluding the user themselves)
 3    similar_users = user_similarity_df[user_id].drop(user_id).nlargest(10)
 4
 5    # Get items purchased by similar users but not by the target user
 6    target_purchases = set(
 7        user_item_matrix.loc[user_id][user_item_matrix.loc[user_id] > 0].index
 8    )
 9
10    scores = {}
11    for similar_user, similarity in similar_users.items():
12        similar_purchases = user_item_matrix.loc[similar_user]
13        for product, count in similar_purchases.items():
14            if count > 0 and product not in target_purchases:
15                scores[product] = scores.get(product, 0) + similarity * count
16
17    # Return top N recommendations sorted by score
18    recommendations = sorted(scores.items(), key=lambda x: x[1], reverse=True)
19    return recommendations[:n]
20
21print(recommend(user_id=1, n=5))

This simple implementation illustrates the core mechanics: build the interaction matrix, measure user similarity using cosine distance, and recommend items that similar users have purchased but the target user has not yet bought.

Data requirements and limitations. This approach requires a minimum of around 1,000 users with at least 5 interactions each to avoid severe cold start degradation. Below that threshold, similarity scores are unreliable and recommendations are effectively random.

Production considerations. A production system cannot recompute cosine similarities across all user pairs in real time — at 10 million users, that matrix has 10^14 cells. Production systems use approximate nearest neighbor (ANN) algorithms (FAISS, HNSW, ScaNN) to find similar users in sub-linear time. User and item representations are pre-computed as dense embeddings (typically 64–256 dimensions) and updated on a schedule (hourly or daily) rather than in real time. The serving layer retrieves pre-computed recommendations from a low-latency store (Redis, DynamoDB) rather than computing them on demand.

See also: What is Vector Database?

Conclusion

Recommendation systems are the core engine driving modern e-commerce and content platforms. They are not optional features — for platforms like TikTok and Shopee, they are the primary mechanism through which users discover content and products. Understanding their architecture and mechanics is essential for any business competing in digital commerce or content.

The appropriate recommendation architecture depends on the maturity and scale of the business. Early-stage businesses with limited transaction data should start with simple market basket analysis and Content-Based Filtering — these approaches require less data and can deliver meaningful results even with a few thousand transactions. Growth-stage businesses should invest in hybrid collaborative filtering systems and begin modeling sequential purchase behavior. Enterprise-scale businesses with millions of transactions should explore deep learning recommendation architectures and multi-stage ranking pipelines.

For Vietnamese businesses selling on Shopee and TikTok Shop, even basic market basket analysis applied to existing transaction data can uncover cross-sell opportunities worth 15–20% additional revenue. The data exists in your transaction history; the question is whether you are analyzing it systematically. AlgoData provides this analysis, turning raw transaction data from Vietnamese e-commerce platforms into actionable recommendation signals for brands.

The recommendation systems powering TikTok and Shopee are not magic — they are systematic applications of well-understood statistical principles at enormous scale. The same principles, applied at a scale appropriate for a Vietnamese brand, can deliver the same category of commercial impact.

See also: What is RFM?