TEKVA
CoursesBlogConsultancy
Learn More
← Back to Blog

How TikTok uses "AI" to keep you hooked?

12/7/2025

Short-form content has taken over—TikTok, Instagram Reels, YouTube Shorts. Last week, I was on the train, on my way back home from my work office, and I stuck my head up from scrolling YouTube Shorts. I looked around the train, and I'd say almost every phone screen I could see showed someone scrolling through one of the apps mentioned above. I cannot say I was surprised at all. These apps are just so good at knowing what you want to watch next, and it led me down a rabbit hole of finding out how exactly they work—particularly for the app that started it all: TikTok.

After an extensive weekend of research, I can conclude it boils down to Machine Learning and Mathematics, but as usual, my goal here is to give you a high-level, easy-to-understand overview of how it all works.

How the FYP algorithm works?

The goal

Okay, the best place to start is by defining what the goal of the FYP algorithm is. The algorithm is essentially trying to answer the question: "Out of all the videos we have, which of these videos is the user likely to engage with most?"

What do I mean when I say "engage"? It usually means something like: if the user watches the video to completion, if the user likes the video, if the user comments on the video, or if they share the video.

So how does it achieve this goal?


Step 1 - Collecting data


The first step is collecting as much data about your behaviour as possible. Every action you make while scrolling the video is tracked:

  • How long you watched the video
  • Whether you commented
  • Did you share it?

This information is then placed in a table, like the one below:

User ID Video ID Watch Time (seconds) Liked? Shared? Commented? Timestamp
u123 v9001 12.4 Yes No No 2025-01-01 12:34:56
u123 v9102 0.7 No No No 2025-01-01 12:35:20
u456 v9001 8.2 No No Yes 2025-01-01 13:02:11

Great, now we have a table logged with how you interacted with certain videos.


Step 2 - Connect the Data

Not only does TikTok have data about the way you've interacted with videos, it also has tables for users (and all their information) as well as the videos (and all the information about the video) as shown below:

User ID Account Created Country Language Age Device Type Preferred Categories
u123 2024-08-12 UK English 22 iPhone 14 Fitness, Motivation
u456 2023-11-04 USA English 19 Samsung Galaxy S22 Comedy, Gaming
u789 2025-01-18 Canada English 30 iPad Pro Cooking, Travel
Video ID Creator ID Video Length (seconds) Captions / Tags Upload Time Total Likes Total Shares Total Comments Category (e.g., Gym, Comedy)
v9001 c101 15 #gym #motivation 2025-03-10 09:12:45 145,230 3,220 18,441 Fitness
v9102 c404 7 #funny #cat 2025-03-12 20:34:11 52,890 890 6,102 Comedy

Okay, let's take the machine out for a second and focus on just the learning part. Imagine I asked you to look through these tables and find me a group of similar users. What would you do?

My guess is you would start by looking at the user table and finding users of maybe similar age, or maybe similar location.

Okay, well, what if I asked you to find videos that might be similar? Again, you would look at the videos table and maybe pick out videos that have the same category.

Now, what if I asked you to find users that watch similar videos? Well, then you would go to the first table with the data about how the user interacts with different videos and find users who have interacted with the same video.

This is fine to do with our small little example, but TikTok has millions and millions of users AND videos. Our best bet to get this information is through a machine.

Step 3 - Creating Towers

Okay, the name of this step might sound a bit weird, but this is actually the most crucial step. This step is where the machine learning comes in. If you are to take away anything from what I'm about to explain, let it be this: using the data they have tracked about videos, users, and user interaction with videos, TikTok tries to create “towers” (called embeddings) for each user and video.

Okay, chances are that made no sense. Let's break it down. TikTok has these things called Neural Networks. I won't go into detail about what these are here, but let's just pretend it's an app. This magical app will let you post data about a user, and it will output a long list of numbers, as shown below:

User Embedding Example
Dimension Value
1 0.12
2 -0.48
3 0.91
4 0.03
5 -0.67


This is called an Embedding. For this example, let's call it the "User Tower". It's a way to represent a user.

The magical app will also accept data about a video, and it will again output a long list of numbers:

Video Embedding Example
Dimension Value
1 -0.33
2 0.77
3 0.14
4 -0.52
5 0.09

This is the "Video Tower".

Now each row in this list could represent any sort of feature, but for this example, let's pretend, the first row represents the percentage of humour. The next row is the pace of the content. The third row is the percentage of how Fitness-related it is.

In reality, they aren't percentages, they are weights and they don't represent what I said above, they could represent anything, but again, I'm here to give you an intuitive sense of what's going on.

So now we have towers representing users and towers representing videos. If we think of them as actual towers, each floor of the tower is a row in the list. So imagine we have a User Tower, and we want to place it in a place where it will fit, what do we do?

Well we find either a bunch of similar User Towers or Video Towers and we can find these very easily by just comparing the numbers in the rows of the list. By doing so, we've essentially found a bunch of videos that align with the users preferences!


Step 4 - Not the end

This will gather a selection of videos that a user might like, but it's not the end of the story. More magical apps (Neural Networks) and other forms of magic apps (Decision Trees) are used to determine the order of which the videos found in the previous step are pushed. Other factors such as trends, release time, hashtags also come into play that I didn't mention but that's where it gets a bit more advanced.

Conclusion

Hopefully this gave you a basic insight into how TikTok keeps you hooked and maybe it will make you a bit more self-aware while you doom scroll? You can even try it out yourself, watch TikToks of squirrels for example to completion and watch that become your entire feed. And then tell your friend about it and explain to them it's because TikTok made a digital tower that represents your account.