Artificial intelligence

How TikTok predicts what you want to watch

Mathematics, networks and machine learning behind a recommendation system.

3 min readMar 2025Archive note
English edition on the blog ↗
TikTok rendering in the center as a neural network

TikTok rendering in the center as a neural network

Introduction

Recommendation algorithms are a clear example of the transformative power of mathematics, with a significant impact on society, economics, and politics. These systems are present across multiple digital platforms, shaping the way we consume content and make decisions.

In my classes on Big Data and Graph Theory, I always seek to connect these key concepts with practical examples close to students. One of the most popular and relevant examples is TikTok's recommendation algorithm.

While TikTok's exact algorithm is a trade secret, academic research has looked at similar models based on Graph Neural Networks (GNN). These advanced neural networks allow highly personalized recommendations, explaining the effectiveness of TikTok's system.

What is TikTok and why is it relevant?

TikTok is a social media platform that allows users to create, share, and discover short videos. Since its launch in 2016, the platform has experienced exponential growth, surpassing one billion monthly active users worldwide, becoming a significant force culturally, economically, and politically.

How does TikTok's recommendation algorithm technically work?

TikTok's algorithm is essentially applied mathematics through advanced Machine Learning techniques and massive Big Data analysis. If multiple users positively interact with similar types of videos (e.g., Dance, Comedy, Tutorials), the algorithm automatically recommends related content (such as Lip Sync, Sports, or Jokes). This approach is called collaborative filtering, enabling large-scale, real-time personalized recommendations.

Graph Neural Networks (GNN): Technical Explanation

Graph Neural Networks are neural networks specialized in handling structured data in the form of graphs. Here, nodes represent entities (users and videos), while edges capture their relationships or interactions. GNNs learn representations (embeddings) by iteratively aggregating information from neighboring nodes, enabling highly personalized recommendations.

Recommendation Model Math Formula

The final recommendation score integrates three key elements:

R=w1⋅I+w2⋅C+w3⋅VR = w_1 \cdot I + w_2 \cdot C + w_3 \cdot V

  • I measures historical interaction through embeddings.
  • C evaluates content properties (type, duration).
  • V measures viral potential based on interactions (likes, comments, shares).
  • w1, w2, w3 are trainable weights that adjust the relative importance of each factor.

Graphical interpretation of the model applied to User A

Explanatory graph of the model for User A

Contribution of each term of the formula to the recommendation (Image A)

Source: Own elaboration

Conclusion

TikTok's algorithm demonstrates how advanced mathematics, Machine Learning, and Big Data can profoundly shape our digital experience, often without us even noticing. TikTok's success lies in its remarkable ability to grasp individual user interests, keeping them engaged via highly personalized recommendations.

Understanding these mechanisms is essential for those studying Artificial Intelligence and Data Science, as well as for anyone interested in the substantial impact of these algorithms.

References

Watch Video (Shou Chew's Explanation)

Your reading notebook

The note is saved only in this browser.

This archive note retains its original publication context.

View original archive file ↗