How Recommendation Algorithms Work: TikTok, YouTube, Netflix, X

How recommendation algorithms work, using only what TikTok, YouTube, Netflix and X published: the three-stage funnel, the signals, the myths and a build.

17 min read

How recommendation algorithms work is one of the most guessed-about questions online, yet it is better documented than the folklore suggests, provided you read the companies' own papers, help pages and code. TikTok, YouTube, Netflix and X have each published how their systems choose what you see next: a research paper in one case, help-center pages in another, and in X's case the source code itself. This guide puts those primary sources side by side, shows the architecture they share, checks popular myths against what the companies actually say, and ends with what creators can influence and how engineers build a simple recommender.

How recommendation algorithms work: a funnel that narrows a huge catalog to a short ranked feed, with the signals TikTok, YouTube, Netflix and X document

How recommendation algorithms work: one funnel, three stages

Every large feed faces the same arithmetic: millions of items, a person who will look at a handful, and a fraction of a second to respond. No single model can score everything carefully in that time, so the published systems use a funnel:

  1. Candidate generation (retrieval). Cheap methods pull a few hundred or thousand plausible items from the catalog: posts from accounts you follow, items similar to what you engaged with, recent popular items.
  2. Ranking. A heavier model predicts how likely you are to take specific actions on each candidate (watch to the end, like, share, skip, block) and combines those predictions into one score.
  3. Re-ranking, filters and diversity. Rules and smaller models remove what you have seen, what is ineligible and near-duplicates, spread out creators and topics, and slot in items such as ads.

YouTube's 2016 research paper describes a candidate generation network that "retrieves a small subset (hundreds) of videos from a large corpus" and a separate ranking network. TikTok's transparency page lists five steps: selecting videos, predicting, ranking, a similarity check and recommendation rules. Netflix documents its signals and row ordering, but not its stages.

Stage TikTok (Newsroom and transparency page) YouTube (2016 paper, 2021 blog) X (published code, 2026)
Candidate generation "Selecting videos": a large pool that passed initial moderation A network narrows millions of videos to hundreds Followed accounts (Thunder), embedding retrieval (Phoenix), SimClusters, popular posts
Ranking Predicts the likelihood of interactions and combines the scores A network trained to predict expected watch time A transformer predicts many actions; a weighted sum gives the score
Re-ranking and filters Similarity check, recommendation rules, eligibility Borderline content demoted (2021) Author diversity, out-of-network discount, new-author boost, diversity reranker, visibility filtering

The funnel and its trade-offs (recall against precision, latency budgets, why the re-ranker is where policy lives) are covered module by module in Recommender Systems with AI, from collaborative filtering to two-tower retrieval and online evaluation.

The recommendation pipeline: candidate generation narrows the catalog to hundreds of items, ranking predicts actions and combines them into a score, and re-ranking applies filters, diversity and eligibility before the feed is shown

Stage 1: candidate generation

Retrieval has to be fast, so it relies on representations computed in advance. The most common one is an embedding: a list of numbers for each user and each item, learned so that a user sits close to the items they are likely to engage with. X's README describes its Phoenix retrieval in exactly these terms: it "embeds the viewer and each post as vectors, and returns the posts nearest the viewer". Production systems rarely trust a single retriever: X pools four sources before ranking them together, and the YouTube paper notes that its design "enables blending candidates generated by other sources".

Stage 2: ranking

The documented rankers do not predict a vague "relevance"; they predict concrete actions. TikTok's transparency page says the system estimates the likelihood that you will like, share, comment on or skip a video and that "by combining prediction scores for each of these interactions, we can arrive at an overall score for each video". X's code makes the same idea explicit with a formula, Final Score = Σ (weight_i × P(action_i)), where positive actions carry positive weights and negative actions such as "block author" or "report" carry negative ones.

What you choose to predict shapes the whole platform. The YouTube paper trains its ranker on expected watch time rather than click probability, and gives the reason plainly: "Ranking by click-through rate often promotes deceptive videos that the user does not complete ('clickbait') whereas watch time better captures engagement."

Stage 3: re-ranking, filters and diversity

A ranker scores items one by one, so left alone it can put three near-identical items at the top. The last stage looks at the list as a whole. TikTok's 2020 explainer says the feed "generally won't show two videos in a row made with the same sound or by the same creator", and that it does not recommend duplicated content, content you have already seen or content considered spam. X's code applies a decaying multiplier to each additional post from the same author, then a reranker that gives up "a little score for less similarity between neighbours". Its README also stresses a design rule worth copying: ranking decides the order, while a separate visibility-filtering service decides whether a post can be shown at all.

How does the TikTok algorithm work? What TikTok has published

TikTok's main public explanations are a Newsroom post from 18 June 2020 and a transparency page titled "Introduction to the TikTok recommendation system".

The 2020 post groups the inputs into three families: user interactions (videos you like or share, accounts you follow, comments you post, content you create), video information ("captions, sounds, and hashtags") and device and account settings (language preference, country setting, device type). The last group receives lower weight than the other data points TikTok measures. A strong indicator of interest, such as "whether a user finishes watching a longer video from beginning to end", receives greater weight than weak ones. The post states that "neither follower count nor whether the account has had previous high-performing videos are direct factors", while conceding that a video is likely to get more views when posted by an account with more followers.

The transparency page adds structure. It lists the five steps (selecting videos that passed initial moderation, predicting, ranking, a similarity check and recommendation rules), and its appendix names example signals: videos you recently "watched, finished, liked, or skipped", your follow relationships, region, device language and operating system, and, for each video, its posting time and region, the author's language setting, the soundtrack, the length and "the hashtags associated with the video". It sets eligibility limits too: content created by an account aged under 16 is not eligible for the For You feed, and content "not suitable for a broad audience" is made ineligible for recommendation. For viewers it documents three controls: "Not interested", keyword filters that work on "both words or hashtags", and a refresh that lets you explore new sides of the app.

Not documented publicly: the weights, the model architecture, and how many viewers a new post is first shown to, whatever popular "test batch" claims say.

The YouTube recommendation algorithm: from the 2016 paper to today

The most detailed public description of YouTube's system is still "Deep Neural Networks for YouTube Recommendations" (Covington, Adams and Sargin, RecSys 2016). Its main points:

  • Two neural networks, one for candidate generation and one for ranking, so the system can recommend from "a very large corpus (millions)" while keeping the few videos on screen personalized.
  • The models learn "approximately one billion parameters and are trained on hundreds of billions of examples".
  • Training uses implicit feedback: "a user completing a video is a positive example". Explicit feedback such as thumbs up or down exists, but it is "extremely sparse" in the long tail.
  • The ranker uses "hundreds of features" and predicts expected watch time per impression, using weighted logistic regression. In candidate generation, an "example age" feature removes an "inherent bias towards the past", helping fresh uploads.
  • Offline metrics (precision, recall, ranking loss) guide development, but decisions rest on live A/B tests because "live A/B results are not always correlated with offline experiments".

The paper describes the system as it was in 2016. YouTube's later official explanation is a September 2021 blog post by Cristos Goodrow, its VP of Engineering. It lists the signals as "clicks, watchtime, survey responses, sharing, likes, and dislikes", explains that YouTube added watch time in 2012 after learning that a click does not mean someone watched, and reports "an immediate 20% drop in views" when it did. It describes "valued watchtime", measured with viewer surveys where "only videos that you rate highly with four or five stars are counted", and states that "any video classified borderline is demoted in recommendations". It says recommendations drive "a significant amount of the overall viewership on YouTube", more than subscriptions or search, without giving a percentage.

YouTube's creator help page adds two lines worth memorizing: the system "doesn't promote videos to your audience but rather finds videos for your audience", and "relative watch time is more important for short videos and absolute watch time is more important for longer videos".

The Netflix recommendation system

Netflix's Help Center lists what its system uses: your interactions (viewing history and how you rated other titles), "other members with similar tastes and preferences", information about titles (genre, categories, actors, release year), the time of day you watch, the languages you prefer, your devices and how long you watched a title. It states that the system "does not include demographic information (such as age or gender)". Personalization covers which rows you see, which titles they contain and their order. New profiles may pick a few titles they like; later viewing supersedes those choices.

On the research side, the Netflix Tech Blog has described a foundation model for personalization: one large model trained on member interaction histories with a next-token prediction objective, whose user and title embeddings feed the more specialized models behind the homepage.

The most useful recent Netflix post for anyone who quotes recommendation statistics is "Measuring the Impact of Personalized Recommendations", which summarizes an article in the International Journal of Industrial Organization, also presented at the ACM Conference on Economics and Computation (EC '26). Netflix argues that the obvious metric, the share of viewing that comes from recommended titles, "fails to answer the causal question", because titles are recommended to the members most likely to watch them anyway. Using a choice model validated against randomized experiments, the team estimates that, relative to the current system, random recommendations would reduce engagement by 16%, popularity-based ones by 12% and basic matrix factorization by 4%, while the current system keeps viewing spread across a broad set of titles.

The Twitter algorithm, open source: what X's code shows

X is the only one of the four that has published production recommendation code. Twitter's March 2023 repository, twitter/the-algorithm, described in-network and out-of-network candidate sources, a light and a heavy ranker, and visibility filters. In January 2026 a new repository, xai-org/x-algorithm, followed under the Apache 2.0 license, updated through autumn 2026. Its README is the most concrete public description of a major feed available today:

  • Candidates: Thunder keeps recent posts from accounts the viewer follows in memory; Phoenix retrieval, SimClusters and a popular-posts list supply posts from accounts the viewer does not follow.
  • Filters before scoring: duplicates, posts older than 48 hours, blocked and muted accounts, muted keywords, and posts already seen.
  • Scoring: the Phoenix transformer predicts a probability for each action: engagement (favorite, reply, repost, quote, share), clicks, attention (dwell time, video continuation), "follow author", and negatives ("not interested", "mute author", "block author", "report"). The weighted sum is then adjusted by an author-diversity decay, a discount for out-of-network posts and a boost for authors with few impressions.
  • Visibility filtering: separate from ranking, it answers ALLOW, NOTICE, INTERSTITIAL or DROP for each post and viewer, based on labels from classifiers and rules.
  • Recent changes: in October 2026 the README notes that retrieval is also trained to surface posts people read all the way through, and that the ranker estimates time spent more accurately.

The README is candid about the limits: some rule files and classifier prompts are withheld "to reduce the risk of gaming", tunable values live in a configuration system with production defaults synced into the code, and X pairs the code with "Under the Hood", a pilot tool that shows people aggregate statistics about the visibility-affecting labels on their account and posts.

Signals compared: what each platform says it uses

Signal family TikTok YouTube Netflix X
Completion and time spent Finishing a longer video is a strong indicator; watched and finished Watch time since 2012; ranking on expected watch time (2016) How long you watched a title Dwell time, video continuation, read-through (2026)
Explicit actions Likes, shares, comments, follows Likes, sharing, survey responses How you rated titles Favorite, reply, repost, quote, share, follow
Negative actions Skips, "Not interested" Dislikes Not documented separately Not interested, mute, block, report
Content information Captions, sounds, hashtags, length Video IDs and other features (2016) Genre, categories, actors, release year Post text and media, language
Stated as not used or not direct Follower count, previous hits Not documented Age, gender Not documented

Myths vs what the companies actually say

Myth What the official sources say Verdict
"Shadowbans" are a myth, or a secret weapon TikTok makes some content ineligible for the For You feed; YouTube demotes borderline content; X's visibility filtering can drop posts from recommendations Reduced distribution is documented under other names; the full criteria are not public
There is a best hour to post YouTube: "Publish time is not known to impact a video's long-term performance"; TikTok lists posting time as a signal; X's For You drops posts older than 48 hours Freshness matters on some feeds; a universal best hour is not documented publicly
Hashtags do all the work TikTok counts hashtags as one item of video information; YouTube calls tags "Not important"; X's README does not single them out Myth
Follower count decides reach TikTok: not a direct factor; YouTube "finds videos for your audience"; X uses follows as a candidate source and boosts new authors Followers help indirectly; documented as not a direct factor on TikTok
One flop hurts the whole channel YouTube: "What matters is how viewers reply to each video when it's recommended to them" Myth on YouTube
You must upload every day YouTube: growth in views "is not correlated with time between uploads"; breaks showed no correlation with view changes Myth on YouTube
On X, one report cancels 468 likes X's README says this reading is "incorrect": weights multiply your own predicted probability of each action, not raw counts Myth
"X% of viewing comes from recommendations" YouTube gives no percentage; Netflix says share of viewing is not a causal measure Treat circulating percentages with caution

On shadowbans. None of the four companies uses the word in these sources, yet each documents a way for content to stay up while receiving less recommendation. X's code even has rules that "can only drop" posts recommended to people who do not follow the author, while leaving them visible to followers, and its "Under the Hood" tool shows account holders aggregate statistics about the labels involved. Any list of hidden penalties beyond these published mechanisms is not documented publicly.

For creators and marketers: the signals you actually control

Every documented system ranks by predicted viewer behavior, so the practical work is to earn the behaviors they predict and avoid the ones they penalize:

  • Earn completion and time, honestly. Watch time, completion and dwell time appear in every source above. A thumbnail or first line that overpromises raises clicks but lowers completion, the pattern YouTube's ranker was designed to stop rewarding.
  • Avoid negative signals. "Not interested", mutes, blocks, reports and quick skips carry negative weight on X and are documented signals on TikTok. Off-topic posts that chase a trend can cost you with your core audience.
  • Describe content clearly. Captions, on-screen text, sounds and a few accurate hashtags tell the system who the content is for.
  • Judge each piece on its own. YouTube evaluates "how viewers reply to each video", so one weak post is information, not a penalty.
  • Stay eligible. Read each platform's eligibility and borderline rules before a campaign.
  • Do not buy engagement or recycle posts. TikTok does not recommend duplicated content or spam, and X's code includes models that look for inauthentic behavior.

AI answer engines pick sources with different rules, covered in Generative Engine Optimization (GEO): How to Get Cited by AI. The wider workflow around personalization, analytics and content is in AI for Digital Marketing.

For engineers: build a simple recommender in four steps

You can reproduce the published funnel at small scale.

1. Log the right data. Record impressions (what was shown, where, in what position) and their outcome: completed, skipped, hidden. Without impressions you cannot build negatives or measure exposure. Event schemas, feature pipelines and embedding storage are covered in Data Engineering for AI.

2. Retrieve with a two-tower model. One tower encodes the user, the other the item, and training pulls engaged pairs together:

import torch
import torch.nn as nn
import torch.nn.functional as F

class Tower(nn.Module):
    def __init__(self, n_ids: int, n_feats: int, dim: int = 64):
        super().__init__()
        self.id_emb = nn.Embedding(n_ids, dim)
        self.mlp = nn.Sequential(
            nn.Linear(dim + n_feats, 128), nn.ReLU(), nn.Linear(128, dim)
        )

    def forward(self, ids: torch.Tensor, feats: torch.Tensor) -> torch.Tensor:
        x = torch.cat([self.id_emb(ids), feats], dim=-1)
        return F.normalize(self.mlp(x), dim=-1)

def in_batch_loss(u: torch.Tensor, v: torch.Tensor, temperature: float = 0.05) -> torch.Tensor:
    # u, v: [batch, dim]; row i of v is the item that user i engaged with.
    # Every other item in the batch acts as a negative example.
    logits = u @ v.T / temperature
    labels = torch.arange(u.size(0), device=u.device)
    return F.cross_entropy(logits, labels)

At serving time, precompute item vectors in an approximate nearest neighbor index, compute the user vector per request and fetch the nearest few hundred items. Two cautions: popular items appear as in-batch negatives more often, which biases the model unless corrected, and new items have no learned ID embedding, so content features must carry them.

3. Rank with several predicted actions. Train a model (gradient-boosted trees are a solid start) to predict outcomes per impression, such as click, completion and hide, then combine them as X's code does: a weighted sum with negative weights on bad outcomes, kept in configuration.

4. Re-rank the list. Remove items already seen, cap items per creator, add a diversity pass such as maximal marginal relevance, and apply eligibility rules, separately from learned scoring, so policy changes need no retraining.

Offline vs online metrics. Measure retrieval with recall@k (did the item the user later engaged with make it into the candidates?) and ranking with NDCG@k, plus catalog coverage. Then test online, because A/B results "are not always correlated with offline experiments", as the YouTube paper puts it. Track retention and hides, not only click-through. For product recommendations in a shop, see AI for E-commerce: Use Cases That Move Revenue, and the Rules.

In the EU, the Digital Services Act requires online platforms to set out the main parameters of their recommender systems in their terms and conditions (Article 27), and very large platforms to offer at least one option not based on profiling (Article 38).

Frequently Asked Questions (FAQ)

How does the TikTok algorithm work, in short? According to TikTok, the For You feed selects videos that passed moderation, predicts how likely you are to like, share, comment on or skip each one, combines those predictions into a score, ranks, then applies a similarity check and recommendation rules. Finishing a longer video counts for more than device settings, and follower count is not a direct factor.

Is the YouTube recommendation algorithm still the one in the 2016 paper? The 2016 paper is the most detailed public description, but it describes the system as it was then. YouTube's 2021 blog post confirms the later direction: watch time, survey-based "valued watchtime", likes, dislikes and sharing as signals, and the demotion of borderline content. The current architecture is not documented publicly at the paper's level of detail.

Is the Twitter (X) algorithm really open source? Large parts of it are. Twitter published twitter/the-algorithm in March 2023, and xai-org/x-algorithm followed in January 2026 with the feed pipeline, candidate sources and a demonstration version of the scoring model; an August 2026 update added the ranking weights, the code used to train the production models and the visibility-filtering systems. Some rule files and classifier prompts are withheld to reduce gaming.

Does Netflix use my age or gender to recommend titles? No, according to Netflix's Help Center, which states that the recommendation system does not include demographic information such as age or gender. It relies on your viewing and ratings, members with similar tastes, title information, time of day, language, device and how long you watch.

Conclusion

The recommendation systems behind TikTok, YouTube, Netflix and X share one shape: retrieve candidates cheaply, rank them by predicted behavior, then filter and diversify the list. Follower counts, hashtags and posting hours matter less than whether people finish, value and do not reject what they are shown, and reduced distribution exists under names like eligibility, demotion and visibility filtering. Whatever a company has not published remains, honestly, not documented publicly.

Sources

Checked on 5 November 2026. Quotes and figures come only from the companies' own publications listed here.

Author

The Cursuri AI editorial team

We write about applied AI for professionals. Every article shows when it was published and, if it has been revised, the date of the last revision.

The course that continues this article

Recommender Systems with AI: From Collaborative Filtering to Deep Learning

  • 30 lessons
  • ~25h of content
  • IT

You have read the theory. In the course you put it into practice: written lessons structured in modules, with examples and exercises, quizzes, the AI Professor in every lesson and progress saved automatically. Once you complete the lessons and reach the minimum quiz score, you get the Certificate of Completion, a private attestation.

From the course syllabus

  1. Foundations: Why Recommendation Matters in 2026
  2. Content-Based Filtering
  3. Collaborative Filtering
  4. Matrix Factorization

+ 7 more modules in the full syllabus

€99 per month for this course, VAT included · or pick it in a subscription of 3, 5 or 10 courses, from €199 per month, together with other IT courses; you can change them at every renewal (see what you learn across the whole track).

Monthly subscription with automatic renewal · stop the renewal anytime from your account · digital content with immediate access, see the withdrawal conditions. The certificate confirms that you completed the course and is private: it is not a diploma or a state-recognised qualification.

Did you enjoy the article? Leave a like or save it for later.
Newsletter

The latest AI articles, in your inbox

You get the three most recent articles right away, with the related course when there is one, then at most three more emails over the next two weeks. Unsubscribe anytime.

Community

Questions & suggestions

What readers asked about this article — and the answers from the Cursuri AI team.

Messages are reviewed by a moderator before publishing.

Be the first to leave a question or suggestion on this article.

The full catalog

50 AI courses in English, with exercises, quizzes and the AI Professor

A subscription by number of courses: 1, 3, 5, 10, 15 or 25 courses a month, or the full catalog. You pick them and can change them at every renewal. One course: €99 per month · 10 courses: €319 per month · Full catalog: €499 per month. All with VAT included; stop the renewal anytime from your account.