What Is a Recommendation System? How TikTok and Shopee Suggest Products
Trí tuệ nhân tạo

What Is a Recommendation System? How TikTok and Shopee Suggest Products

What is a Recommendation System? Learn how TikTok's For You page and Shopee use AI to suggest content and products, and how to apply this in e-commerce.

In this series: Trí tuệ nhân tạo
  1. 1 What Is a Vector Database? The Foundation of Semantic AI Search
  2. 2 What Is a Recommendation System? How TikTok and Shopee Suggest Products
  3. 3 What is an AI Agent? How Autonomous AI Agents Automate Complex Work
  4. 4 What Is Deepfake? How to Detect and Protect Yourself
  5. 5 What is Prompt Engineering? The Art of Giving AI Effective Instructions
  6. 6 What Is Fine-Tuning? Customizing AI Models for Enterprise Use
  7. 7 What is RAG? Retrieval-Augmented Generation — when AI knows how to look things up
  8. 8 What is Vietnam's AI Law? The Legal Framework for Artificial Intelligence (Updated 2026)
✦ Quick summary
What is a Recommendation System? Learn how TikTok's For You page and Shopee use AI to suggest content and products, and how to apply this in e-commerce.
How was this post?

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?

Recommendation System — hay hệ thống gợi ý — là công nghệ AI đứng sau mọi "For You Page" bạn thấy trên TikTok, mọi "Có thể bạn thích" trên Shopee, hay danh sách phim Netflix đề xuất tối nay.

Thuật toán này âm thầm quan sát từng hành vi nhỏ — bạn dừng lại bao lâu trước một video, bạn cuộn nhanh qua sản phẩm nào, bạn thêm gì vào wishlist lúc nửa đêm — rồi tổng hợp thành mô hình dự đoán sở thích cực kỳ chính xác.

Bài viết này giải thích Recommendation System là gì, ba kiến trúc chính, cách TikTok và Shopee triển khai ở quy mô hàng tỷ item, và ứng dụng thực tế trong chiến lược e-commerce cho doanh nghiệp Việt Nam.

Recommendation System là gì?

Recommendation System (hệ thống gợi ý) là một nhánh của trí tuệ nhân tạo chuyên dự đoán nội dung, sản phẩm hoặc dịch vụ mà một người dùng cụ thể có khả năng quan tâm — dựa trên lịch sử hành vi của người đó và hành vi của những người dùng tương tự.

Mục tiêu không chỉ là tìm ra sản phẩm người dùng sẽ thích mà còn tăng thời gian tương tác (TikTok), tỷ lệ chuyển đổi (Shopee), hoặc doanh thu trung bình trên mỗi người dùng (Netflix, Amazon).

Netflix ước tính 75–80% lượng xem đến từ gợi ý, không phải tìm kiếm chủ động — con số này cho thấy recommendation system là lõi kinh doanh cốt lõi, không phải tính năng phụ. Amazon công bố rằng 35% doanh thu đến từ công cụ "Khách hàng mua sản phẩm này cũng mua" và "Gợi ý cho bạn".

Điều quan trọng là phân biệt recommendation với search:

  • Search (tìm kiếm): Người dùng biết mình muốn gì, gõ từ khóa cụ thể. Hệ thống tối ưu cho relevance — kết quả có khớp ý định tìm kiếm không?
  • Recommendation (gợi ý): Người dùng chưa biết mình muốn gì, chỉ đang lướt feed. Hệ thống tối ưu cho engagement hoặc conversion — người dùng có dừng lại và mua không?

Điều làm recommendation system mạnh mẽ là khả năng khai thác implicit feedback (phản hồi ngầm). Người dùng hiếm khi chấm sao hay viết review, nhưng mỗi giây xem video, mỗi lần thêm vào giỏ hàng, mỗi lần bỏ qua quảng cáo đều là tín hiệu có giá trị.

Tổng hợp hàng triệu tín hiệu theo thời gian thực tạo ra hồ sơ hành vi chính xác hơn nhiều so với bất kỳ bảng khảo sát nào từng được thực hiện.

Ba loại chính của Recommendation System

Collaborative Filtering — Lọc cộng tác

Collaborative Filtering là phương pháp cổ điển và hiệu quả nhất khi có đủ dữ liệu: tìm những người dùng có hành vi tương tự bạn, rồi gợi ý những thứ họ thích mà bạn chưa thấy.

Ý tưởng đơn giản — "những người giống bạn đã thích X" — nhưng toán học đằng sau rất phức tạp khi quy mô lên đến hàng triệu người dùng và hàng triệu item. Các phương pháp phổ biến gồm:

  • Matrix Factorization (SVD, ALS): Phân tích user-item matrix thành hai ma trận nhỏ hơn đại diện cho latent features của user và item.
  • Memory-Based CF: Tính cosine similarity hoặc Pearson correlation trực tiếp giữa các user hoặc item mà không cần tối ưu mô hình.
  • Neural Collaborative Filtering (NCF): Dùng neural network để học tương tác phi tuyến giữa user embedding và item embedding.

Nhược điểm lớn nhất là cold start problem: người dùng mới chưa có lịch sử tương tác nên không thể tìm được "người tương tự" để so sánh. Tương tự, sản phẩm mới chưa ai mua cũng không có dữ liệu co-occurrence để xếp hạng — đây là khe hở lớn mà Content-Based Filtering lấp đầy.

Giải quyết cold start cho sản phẩm mới

Khi ra mắt sản phẩm mới trên Shopee hoặc TikTok Shop, đừng chờ Collaborative Filtering "học" từ dữ liệu. Hãy chủ động đặt sản phẩm mới vào các bundle với sản phẩm bán chạy, dùng hashtag và mô tả metadata chi tiết để Content-Based Filtering có đủ tín hiệu. Sau khi tích lũy được vài trăm lượt mua đầu tiên, co-purchase signal sẽ đủ mạnh để thuật toán tự điều chỉnh và đưa sản phẩm vào recommendation flow tự nhiên.

Content-Based Filtering — Lọc dựa trên nội dung

Content-Based Filtering tiếp cận theo hướng khác: phân tích thuộc tính của item — thể loại, từ khóa, giá, màu sắc, thương hiệu, mô tả sản phẩm — và gợi ý những item có thuộc tính tương tự những gì người dùng đã tương tác.

Ưu điểm là không cần dữ liệu từ người dùng khác, nên giải quyết được cold start cho người dùng mới. Chỉ cần biết 2-3 sản phẩm một người mới quan tâm, hệ thống đã có thể tạo gợi ý dựa trên metadata.

Tuy nhiên, phương pháp này có xu hướng tạo gợi ý quá giống nhau và thiếu tính khám phá. Nếu bạn thích áo phông đen, hệ thống sẽ mãi gợi ý áo phông đen khác, không bao giờ giới thiệu quần jeans hay phụ kiện phù hợp mà bạn có thể thích.

Hybrid System — Kết hợp thực tế

Hybrid System là cách tiếp cận mà hầu hết hệ thống sản xuất áp dụng: kết hợp Collaborative và Content-Based ở các tầng khác nhau của pipeline, bổ sung thêm context-aware features và deep learning.

Phương pháp Ưu điểm Nhược điểm Phù hợp khi
Collaborative Filtering Phát hiện sở thích ẩn, đa dạng Cold start, cần nhiều data Có ≥ 1.000 users có lịch sử
Content-Based Không cần data user khác Gợi ý đơn điệu, thiếu novelty User mới, catalog item rõ thuộc tính
Hybrid Kết hợp ưu điểm cả hai Phức tạp hơn, chi phí xây dựng cao Hệ thống production quy mô lớn

Netflix, YouTube, TikTok và Shopee đều vận hành Hybrid nhiều tầng với hàng trăm features, mỗi tầng được tối ưu cho một mục tiêu cụ thể và liên tục được cải tiến qua A/B testing hàng tuần.

Cách TikTok For You Feed hoạt động

For You Page (FYP) của TikTok được xem là recommendation engine mạnh nhất thế giới hiện nay. Khả năng cá nhân hóa cực cao ngay từ những phiên sử dụng đầu tiên là lý do chính giúp TikTok vượt qua các mạng xã hội lâu đời hơn để trở thành nền tảng có tốc độ tăng trưởng người dùng nhanh nhất lịch sử mạng xã hội.

Hệ thống hoạt động theo kiến trúc multi-stage ranking với ba giai đoạn chính, được thực thi trong chưa đến 200 milliseconds mỗi khi người dùng mở app hoặc swipe lên video tiếp theo.

Giai đoạn 1 — Candidate Generation

Từ kho hơn 10 tỷ video trên toàn cầu, hệ thống lọc nhanh xuống còn 500–1.000 video phù hợp dựa trên ngôn ngữ, khu vực địa lý, thiết bị và lịch sử tương tác gần nhất.

Bước này cần cực kỳ nhanh nên dùng các mô hình nhẹ, chủ yếu là approximate nearest neighbor search trên không gian embedding. TikTok chia candidate generation thành nhiều nguồn song song:

  • Video từ những creator đã theo dõi (social graph signal)
  • Video trending trong khu vực và toàn cầu (popularity signal)
  • Video tương tự những gì đã xem gần đây (similarity signal)
  • Một phần ngẫu nhiên để khám phá sở thích mới (exploration)

Giai đoạn 2 — Retrieval và Ranking

1.000 video ứng viên được xếp hạng bởi các mô hình phức tạp hơn, dự đoán xác suất cho từng hành động quan trọng:

  • Watch-through rate — Tỷ lệ % thời lượng video được xem (tín hiệu mạnh nhất)
  • Like probability — Xác suất người dùng nhấn thích
  • Share probability — Xác suất người dùng chia sẻ (trọng số cao vì cần nỗ lực)
  • Comment probability — Xác suất người dùng bình luận
  • Not-Interested probability — Xác suất nhấn "Không quan tâm" (tín hiệu tiêu cực)

Tín hiệu watch time percentage là quan trọng nhất: video được xem 80% được đánh giá cao hơn nhiều so với video được like nhưng chỉ xem 10%. Điều này có nghĩa là một video dài 60 giây nhưng được xem 50 giây sẽ outperform video 15 giây nhưng bị swipe qua sau 5 giây.

Đừng tối ưu like thay vì watch time

Nhiều thương hiệu khi làm TikTok Shop chạy chiến dịch kêu gọi like và comment để "boost" video, nhưng thuật toán FYP coi watch-through rate nặng hơn tương tác. Một video có 500 like nhưng bị xem trung bình 8 giây sẽ phân phối kém hơn video chỉ 50 like nhưng được xem đến 80% thời lượng. Thay vì thúc đẩy tương tác, hãy tập trung vào 3 giây đầu — đây là khoảng quyết định thuật toán có tiếp tục đẩy video hay không.

Giai đoạn 3 — Diversity Injection

Sau khi xếp hạng, hệ thống chủ động can thiệp để tránh feed quá đồng nhất. Ràng buộc đa dạng bao gồm: không để 5 video liên tiếp cùng creator, không để 3 video liên tiếp cùng âm thanh, không để quá 30% video trong một session thuộc cùng một chủ đề hẹp.

Khoảng 10–15% video trong FYP là nội dung "khám phá" nằm ngoài vùng sở thích quen thuộc, giúp phát hiện sở thích tiềm ẩn và tránh filter bubble. Phản hồi "Not Interested" hoặc "Don't recommend this creator" được xử lý trong thời gian thực và ảnh hưởng ngay đến các video tiếp theo trong session.

Cách Shopee gợi ý sản phẩm

Recommendation system của Shopee phức tạp hơn TikTok ở chỗ mục tiêu không chỉ là giữ người dùng lướt lâu hơn mà là tối đa hóa xác suất mua hàng — một bài toán khó hơn vì hành vi mua thường cách xa hành vi lướt nhiều bước và bị ảnh hưởng bởi giá, khuyến mãi, thời điểm trong tháng và lịch sử mua trước đó.

Shopee triển khai nhiều module gợi ý song song tùy theo vị trí hiển thị trong app:

  • Trang chủ: Gợi ý cá nhân hóa dựa trên lịch sử dài hạn và xu hướng thời điểm
  • Trang sản phẩm: "Sản phẩm liên quan" và "Người mua sản phẩm này còn mua..."
  • Giỏ hàng: Cross-sell sản phẩm bổ sung trước khi thanh toán
  • Trang thanh toán: Upsell và flash deal theo sở thích
  • Email/Push notification: Retargeting theo hành vi session và lịch sử mua

Item-to-Item Collaborative Filtering

Xương sống của phần "Sản phẩm liên quan": tìm những item thường xuyên được xem hoặc mua cùng nhau, sau đó dùng co-purchase graph để xếp hạng mức độ liên quan. Hiệu quả với sản phẩm thay thế (điện thoại cùng phân khúc) hoặc sản phẩm bổ sung tự nhiên (ốp lưng cho điện thoại, tai nghe cho laptop).

Co-purchase signal mạnh hơn co-view signal vì mua hàng đòi hỏi cam kết thực sự. Shopee kết hợp cả hai với trọng số khác nhau: mua cùng trong một transaction được tính cao nhất, mua trong cùng ngày tiếp theo, rồi mới đến xem sản phẩm trong cùng session.

Sequential Recommendation

Theo dõi hành trình mua sắm trong session và dự đoán sản phẩm tiếp theo dựa trên chuỗi hành vi gần nhất. Người vừa xem màn hình laptop thường tìm bàn phím cơ hoặc túi đựng laptop trong 15 phút tiếp theo — pattern này được học từ hàng triệu session của người dùng khác.

Shopee dùng mô hình Transformer-based như BERT4Rec hoặc SASRec để nắm bắt dependencies trong chuỗi hành vi tuần tự, cho phép gợi ý ngay trong phiên hiện tại thay vì chỉ dựa vào lịch sử dài hạn.

Real-time Personalization và Price Sensitivity Modeling

Hệ thống cập nhật profile người dùng trong thời gian thực khi họ đang lướt. Nếu bạn đột nhiên bắt đầu xem nhiều sản phẩm thể thao trong buổi chiều, các gợi ý trên trang chủ sẽ thay đổi ngay trong session đó — không chờ đến lần mở app tiếp theo.

Price Sensitivity Modeling là điểm khác biệt quan trọng: Shopee tích hợp ngưỡng giá lịch sử của từng người dùng vào ranking. Cùng một danh mục sản phẩm sẽ hiển thị phân khúc giá khác nhau cho hai người dùng với ngân sách mua sắm khác nhau — người thường chi 200.000 VND mỗi lần sẽ thấy gợi ý khác với người thường chi hơn 1 triệu VND.

Seller cần biết về price sensitivity

Vì Shopee cá nhân hóa theo ngưỡng giá, seller nên tránh định giá sản phẩm ở mức trung gian mờ nhạt. Một sản phẩm giá 180.000 VND có thể bị lọc ra khỏi gợi ý của cả phân khúc phổ thông lẫn phân khúc cao cấp. Phân tích giá các sản phẩm cạnh tranh được gợi ý nhiều nhất trong cùng danh mục sẽ cho thấy "ngưỡng giá ngọt" mà thuật toán đang ưu tiên hiển thị — đây là dữ liệu quan trọng khi đặt giá niêm yết và thiết kế chương trình giảm giá.

Metrics đo hiệu quả Recommendation System

Đo lường recommendation system không thể chỉ dùng accuracy vì một hệ thống luôn gợi ý những thứ người dùng chắc chắn thích có thể hoàn toàn vô ích về mặt kinh doanh — như gợi ý kem đánh răng cho người vừa mua kem đánh răng 5 phút trước.

Nhóm metrics kinh doanh

  • CTR (Click-Through Rate): Tỷ lệ nhấp vào gợi ý trên tổng số lần hiển thị. CTR thấp cho thấy gợi ý không đủ hấp dẫn hoặc không phù hợp với vị trí hiển thị.
  • Conversion Rate: Tỷ lệ chuyển đổi từ click thành giao dịch thực. Metric quan trọng hơn CTR vì đo lường tác động trực tiếp đến doanh thu.
  • Revenue Per User: Doanh thu trung bình trên mỗi người dùng trong một khoảng thời gian. Metric tổng hợp nhất vì phản ánh cả tần suất mua lẫn giá trị đơn hàng trung bình.

Nhóm metrics chất lượng gợi ý

  • Novelty (Độ mới): Hệ thống có gợi ý những thứ người dùng chưa từng biết đến không?
  • Diversity (Đa dạng): Các gợi ý trong cùng một feed có quá giống nhau không?
  • Serendipity (Khám phá bất ngờ): Hệ thống có đem lại phát hiện thú vị ngoài mong đợi không?

Một hệ thống chỉ tối ưu CTR thuần túy thường dẫn đến filter bubble, giảm novelty và ảnh hưởng xấu đến retention dài hạn. Người dùng cảm thấy nhàm chán và rời nền tảng sau vài tuần khi không còn thấy nội dung mới lạ nào trong feed. Các hệ thống tốt nhất như TikTok và Spotify đầu tư nghiêm túc vào cân bằng giữa tối ưu ngắn hạn và trải nghiệm dài hạn thông qua A/B testing liên tục.

Vấn đề Filter Bubble

Filter Bubble là hệ quả không mong muốn của recommendation system hiệu quả: khi thuật toán quá giỏi trong việc gợi ý những thứ người dùng thích, nó tạo ra một "bong bóng thông tin" khép kín.

Người dùng chỉ được tiếp xúc với quan điểm, nội dung và sản phẩm trong vùng sở thích quen thuộc, không bao giờ thấy những gì nằm ngoài vùng đó. Reinforcement loop diễn ra theo cơ chế: thuật toán gợi ý X → người dùng tương tác với X → thuật toán học rằng người dùng thích X → gợi ý thêm X, ít Y, Z hơn → người dùng dần không bao giờ thấy Y, Z.

Trên mạng xã hội, filter bubble bị chỉ trích vì củng cố định kiến và làm phân cực quan điểm xã hội — hiện tượng "echo chamber" được nhiều nhà nghiên cứu truyền thông ghi nhận trong thập kỷ qua.

Trên sàn thương mại điện tử, filter bubble gây thiệt hại doanh thu trực tiếp: khách hàng không được giới thiệu đến danh mục sản phẩm mới có tiềm năng, thương hiệu bỏ lỡ cơ hội cross-sell và upsell.

Giải pháp cho Filter Bubble

Exploration vs Exploitation (epsilon-greedy): Thay vì luôn gợi ý thứ có xác suất cao nhất, hệ thống định kỳ gợi ý những thứ ít chắc chắn hơn để khám phá sở thích mới. TikTok thiết lập tỷ lệ explore khoảng 10–15% mỗi feed — con số được A/B test liên tục để cân bằng engagement ngắn hạn và retention dài hạn. Khi người dùng phản ứng tích cực với nội dung khám phá, thuật toán ghi nhận và mở rộng vùng sở thích của người dùng đó.

Diversity Injection: Sau khi thuật toán xếp hạng xong, một lớp post-processing cưỡng chế độ đa dạng bằng cách đảm bảo không quá X% gợi ý đến từ cùng một nguồn, creator hay danh mục. Kỹ thuật này đơn giản nhưng hiệu quả trong việc tránh "chuỗi đơn điệu" mà người dùng nhận thức được dù không nói ra — họ chỉ thấy feed nhàm và rời app.

User Control Settings: Một số nền tảng như YouTube và Spotify cho phép người dùng tự điều chỉnh feed — xóa lịch sử xem, đánh dấu "không quan tâm", tạm dừng lịch sử xem — để phá vỡ bubble theo ý muốn. Trao quyền kiểm soát cho người dùng không chỉ giải quyết filter bubble mà còn tăng trust và loyalty với nền tảng.

AlgoData & Recommendation System trong e-commerce

AlgoData ứng dụng nguyên lý recommendation system để giúp các thương hiệu phân tích market basket analysis từ dữ liệu giao dịch Shopee và TikTok Shop — xác định những cặp hoặc nhóm sản phẩm thường được mua cùng nhau với xác suất cao hơn mức ngẫu nhiên đáng kể.

Từ dữ liệu này, thương hiệu có thể:

  • Thiết kế bundle khuyến mãi thông minh dựa trên co-purchase patterns thực tế từ thị trường
  • Điều chỉnh vị trí hiển thị sản phẩm bổ sung trong gian hàng để tăng cross-sell tự nhiên
  • Tối ưu chiến dịch cross-sell qua email và push notification với đúng sản phẩm, đúng timing
  • Xác định cơ hội cross-category mà trước đây không nhìn thấy qua báo cáo bán hàng thông thường
  • Dự đoán thời điểm mua tiếp theo để tối ưu frequency của chiến dịch retargeting

Thay vì xây dựng recommendation engine riêng — tốn vài tháng và cần nhiều kỹ sư ML chuyên biệt — thương hiệu có thể trực tiếp sử dụng insight từ AlgoData để triển khai cải tiến trong vài ngày.

Ví dụ case study thực tế: AlgoData phát hiện khách hàng mua kem chống nắng trên Shopee có xác suất 34% mua thêm serum vitamin C trong 14 ngày tiếp theo — cao hơn 6 lần so với mức nền của danh mục mỹ phẩm. Thương hiệu dùng insight này để thiết lập retargeting campaign với đúng sản phẩm và đúng timing, tăng conversion rate đáng kể mà không cần tăng ngân sách quảng cáo.

Mô hình Next Purchase Timing của AlgoData dự đoán khi nào một khách hàng cụ thể có khả năng mua lại, cho phép gửi voucher đúng lúc nhu cầu đang hình thành thay vì spam liên tục và gây phiền nhiễu. Cross-Category Opportunity Identification giúp phát hiện những nhóm khách hàng có tiềm năng mua thêm ở danh mục chưa từng thử — ví dụ người mua dụng cụ thể thao outdoor thường có nhu cầu về thực phẩm chức năng trong vòng 30 ngày tiếp theo.

Xây dựng Recommendation System đơn giản từ đầu

Để hiểu bản chất, hãy xây dựng một User-Based Collaborative Filtering cơ bản bằng Python. Bước đầu tiên là tạo user-item matrix: các hàng là người dùng, các cột là sản phẩm, giá trị là điểm đánh giá hoặc số lần mua.

Ma trận này thường rất thưa (sparse) — mỗi người dùng chỉ mua một phần nhỏ tổng số sản phẩm. Đây là lý do matrix factorization được ưa dùng hơn cosine similarity thuần túy trong production.

Python
 1import pandas as pd
 2import numpy as np
 3from sklearn.metrics.pairwise import cosine_similarity
 4
 5# Bước 1: Tạo user-item matrix
 6# Giá trị 0 = chưa mua, 1-5 = điểm đánh giá
 7data = {
 8    'Kem chống nắng': [5, 3, 0, 4, 2],
 9    'Serum vitamin C': [4, 0, 4, 1, 5],
10    'Tẩy trang':       [0, 2, 5, 3, 0],
11    'Kem dưỡng ẩm':    [3, 0, 0, 5, 4],
12    'Son dưỡng môi':   [2, 4, 3, 0, 5],
13}
14users = ['An', 'Bình', 'Châu', 'Dung', 'Emly']
15user_item = pd.DataFrame(data, index=users)
16
17# Bước 2: Tính cosine similarity giữa các người dùng
18sim_matrix = cosine_similarity(user_item.fillna(0))
19sim_df = pd.DataFrame(sim_matrix, index=users, columns=users)
20
21# Bước 3: Gợi ý cho 'An'
22# Tìm người tương tự nhất → lấy sản phẩm họ thích mà An chưa mua
23target = 'An'
24not_bought = user_item.loc[target][user_item.loc[target] == 0].index
25most_similar_user = sim_df[target].drop(target).idxmax()
26recs = user_item.loc[most_similar_user][not_bought].sort_values(ascending=False)
27
28print(f"Người dùng tương tự nhất với {target}: {most_similar_user}")
29print(f"Top 3 gợi ý cho {target}:")
30print(recs.head(3))

Yêu cầu dữ liệu theo quy mô

Để hệ thống hoạt động tốt trong thực tế, cần đủ dữ liệu theo từng mức độ:

  • < 1.000 users: Content-Based Filtering với TF-IDF trên mô tả sản phẩm ổn định hơn
  • 1.000–100.000 interactions: Cosine similarity hoặc ALS với thư viện implicit
  • 100.000–1.000.000 interactions: Matrix Factorization với Surprise hoặc LightFM
  • > 1.000.000 interactions: Faiss (Meta) cho ANN search, Two-Tower neural network

AI Agent là gì?

Mỗi người dùng cần tối thiểu 5 lượt tương tác để mô hình có đủ tín hiệu. Khi dữ liệu chưa đủ, ưu tiên Content-Based Filtering và dần chuyển sang Hybrid khi tích lũy được đủ implicit feedback.

Vector Database là gì?

RFM là gì?

Kết luận

Recommendation System không còn là công nghệ chỉ dành cho các ông lớn như Netflix hay Amazon. Ngày nay bất kỳ doanh nghiệp thương mại điện tử nào cũng có thể khai thác nguyên lý gợi ý ở mức độ phù hợp, từ market basket analysis đơn giản đến deep learning recommendation engine.

Tương lai của lĩnh vực này đang hướng đến ba hướng chính:

  • Real-time personalization: Cá nhân hóa theo từng click trong session, không chờ đến lần mở app tiếp theo — mỗi hành động ngay lập tức ảnh hưởng đến gợi ý tiếp theo.
  • Multimodal recommendations: Kết hợp tín hiệu từ text, hình ảnh và video để hiểu sản phẩm và người dùng ở chiều sâu hơn, vượt ra ngoài tag và metadata đơn giản.
  • LLM-powered explanations: Giải thích bằng ngôn ngữ tự nhiên tại sao hệ thống gợi ý một sản phẩm cụ thể — "Chúng tôi gợi ý vì bạn mua kem chống nắng tuần trước và 34% người mua cùng sản phẩm đó cũng thích serum này" — tăng độ tin tưởng và tỷ lệ chấp nhận.

Doanh nghiệp nào đầu tư vào việc hiểu và khai thác dữ liệu hành vi khách hàng ngay từ bây giờ sẽ có lợi thế cạnh tranh bền vững trong kỷ nguyên thương mại điện tử cá nhân hóa. Bắt đầu không cần phức tạp — chỉ cần đặt đúng câu hỏi: khách hàng này thường mua gì tiếp theo?

Câu hỏi thường gặp

Câu hỏi thường gặpQ&A
TikTok có thực sự 'đọc' hành vi người dùng không?
Có — TikTok theo dõi tỷ lệ xem (% thời lượng video được xem), tương tác (thích/chia sẻ/bình luận/không quan tâm), số lần xem lại và lượt truy cập profile sau khi xem video. Thuật toán không theo dõi giọng nói hay camera như nhiều tin đồn — nó hoàn toàn dựa trên tín hiệu hành vi, không phải giám sát. Đây là lý do For You Page của mỗi người có cá nhân hóa rất cao chỉ sau vài giờ sử dụng.
Collaborative Filtering khác Content-Based Filtering như thế nào?
Collaborative Filtering dựa trên hành vi của những người dùng tương tự ('những người giống bạn đã thích X'); Content-Based Filtering dựa trên thuộc tính của sản phẩm ('item này tương tự các item bạn từng xem'). Collaborative cần nhiều dữ liệu để khởi động nhưng phát hiện được sở thích ẩn; Content-Based hoạt động tốt hơn với người dùng mới (cold start) vì chỉ cần metadata của item. Hầu hết hệ thống sản xuất kết hợp cả hai thành Hybrid để tận dụng ưu điểm của mỗi loại.
Recommendation System cần bao nhiêu data để hoạt động tốt?
Collaborative Filtering cần tối thiểu 1.000 người dùng với mỗi người có ít nhất 10 lượt tương tác. Content-Based Filtering chủ yếu cần metadata của item nên hoạt động được với ít dữ liệu hơn. Matrix Factorization trong sản xuất cần khoảng 100.000 lượt tương tác trở lên. Các hệ thống deep learning như TikTok hay Shopee vận hành ở quy mô hàng triệu đến hàng tỷ interaction, với pipeline tái huấn luyện mô hình hàng giờ hoặc hàng ngày.
Filter Bubble là gì và có hại không?
Filter Bubble là hiện tượng người dùng chỉ nhận được gợi ý trong vùng sở thích quen thuộc, không được tiếp xúc với quan điểm hay sản phẩm mới. TikTok đã đưa khoảng 10–15% nội dung 'khám phá' vào feed để phá vỡ bong bóng này. Về mặt thương mại, filter bubble gây hại vì bỏ lỡ cơ hội cross-sell — khách hàng không bao giờ thấy sản phẩm bổ sung từ danh mục khác mà họ có thể quan tâm.
AlgoData dùng Recommendation System cho use case nào?
AlgoData phân tích dữ liệu giao dịch từ Shopee và TikTok Shop để gợi ý sản phẩm bổ sung dựa trên market basket analysis — ví dụ: khách mua kem chống nắng thường mua thêm serum vitamin C trong vòng 14 ngày. Ngoài ra, AlgoData xác định cơ hội cross-category và dự đoán thời điểm mua hàng tiếp theo để tối ưu timing cho chiến dịch quảng cáo.