DEV Community

Cover image for A basic understanding of tiktok's recommendation system
JOOJO DONTOH
JOOJO DONTOH

Posted on • Updated on

A basic understanding of tiktok's recommendation system

I was initially reluctant to download tiktok because I thought all people did there was dance. After it became extremely popular and mainstream, I decided to see what the fuss was about.

I quickly graduated from using tiktok for 5 mins to spending hours on it due to the quality of its recommendation system on the for you page. I constantly feel like the application knows me because it is exquisite at suggesting content I want to interact with.

The recommendation system seems to balance most of my interests with efficient distribution while suggesting content to me. This sparked my wait for the tiktok team to release something or anything that describes how their recommendation algorithms work.

Thankfully the Bytdance team (Tiktok's parent company) have released a paper on how the things work in their recommendation system behind the scenes.

Though this article intends to summarize the paper and make the system easy to understand, this is a severely over simplified summary of their recommendation system. To understand it in detail, please read the paper

Problem

So it's very normal for humans to have fleeting interests for very short amounts of time. This volatility in interests may happen down to the minute and can be due to a variety of factors such as emotion, mental wellbeing, location, season, time of the day, etc. This phenomenon is known as Concept drift.

So now imagine you use an application while watching a world cup game and then you search for videos about a football player. This user action may be used to suggest videos of the player during the tournament, award shows involving the player, football skill-move videos of the player, so on and so forth. However after the game, you move on to clicking the Formula 1 account to view highlights of a race but this time the suggested videos on your timeline are still about the footballer you searched for earlier on. This behavior may irritate users or reduce their interest in the application. As simple as it sounds, the Tiktok recommendation system is carefully designed to mitigate the tendency of this behavior generally known as Concept drift as mentioned earlier. They call this system the Monolith

Basic design

So a basic machine learning (ML) model uses patterns from data to predict results. In a ML model, these patterns in data are extracted by training the model with some form of historical data. This may be done repeatedly to help the model grasp the patterns properly.

Image description

The problem with most models is that, the training process relies on an over-idealistic assumption that components in the training data appear frequently and are distributed evenly. This assumption is harmful to a model's quality because data is hardly ever uniform especially with respect to time. Also, prediction rates for these models deplete over time because training data isn't close enough to real-time user feedback. This phenomenon increases the failure rate of reflecting the latest interests of a user.

In light of these observations, the tiktok team designed the Monolith to

  1. Dynamically prepare data for training by intuitively adding and evicting components from training data.
  2. Synchronize training data with real-time user feedback by engineering a loop service which feeds and runs the model to predict recent user behaviour.

Dynamic data preparation.

frequency/occurrence filtering

The Monolith does dynamic data preparation by using a "less frequently used" policy. Components of data that are hardly used do not affect the quality of result in a ML model. Keeping such data increases the size of the training dataset which affects the speed of model preparation while consuming resources in vain. Obviously, removing such components increase model efficiency which is a good thing. An example of a direct rule or threshold in this policy is that, popular data components may appear a million times while unpopular ones may appear under 10 times. The Monolith goes the extra mile of using a probabilistic filter to compute the threshold for data component filtering. This enforces dynamism because the threshold of occurrence is not static.

Stale removals

The Monolith also does dynamic data preparation by removing distant historical data that will not contribute to model quality because it is hardly used. So for example, if actions from a followed user contributes as factor to content suggestion on your timeline, this component will be removed if the user ceases to be active. The monolith determines the lifespan of data by attaching expiries to them. The dynamism is in the computation of expiry times for data components based on sensitivity to historical information.

Synchronize training

Though the monolith does training in 2 ways (Batch training and Online training), it is built with the capability of
seamlessly switching between them.

Batch training

In the monolith, batch training is done only with historical data accumulated from user behaviour. This type of training is only deployed when fundamental changes are made to the ML model architecture to stabilize the model's baseline patterns.

Online training

Unlike other recommendation systems, the monolith does not stop training when it is deployed into real life production environments. Instead it siphons real-time data on-the-fly which is synchronized with already existing data to train the model. This enables the monolith to interactively adapt itself according to a user’s feedback in real-time.

Synchronized training creates an environment for automated model improvements with minimal supervision which is ideal from an engineering point of view.

Advice for influencers

For influencers, if you didn't already know, factors that may affect content success include

  1. How the video performed when first uploaded - engagement due to searches and tag priority
  2. For how much time the video is watched on average - this suggests that videos should be kept short and precise to hold user attention. For longer videos, content must be interesting and easy to follow. Avoid context switching.
  3. Number of likes, comments, downloads, and shares - For computer applications, numbers are usually a determining factor for segregation. The higher your numbers, the more your content will be pushed into the recommendation system.

These are very important as they tie into the core workings of the recommendation system. The target during content creation should be to get as much interaction on your video during its early stages. The algorithm seems to facilitate exponential engagement as users interact with it in the beginning.
According to the inner workings of the recommendation system, uploading content and somehow linking it to previous/old content on your page may revive engagement for older videos. This may work because the expiry time for adding features or tags related to your content may be increased to get your content in the recommendation system. A clever implementation of this may keep a set of videos in on your page in a high engagement loop. Good luck

Conclusion

Though there is nothing heavenly brilliant about the monolith, it takes the mitigation of concept drift very seriously thereby increasing its accuracy of prediction. Making an effort to continuously use feedback from users is a testament of how much Tiktok cares about user experience and user satisfaction. Big congratulations to the team at Bytedance and tiktok for both writing a clever system and sharing the overall architecture.

Thanks for reading, I'm going back to scroll through Tiktok. πŸ˜‚πŸ˜… See you in the next one.

Top comments (1)

Collapse
 
marcushawkin profile image
MarcusHawkin • Edited

Very informative, thank you! TikTok is very popular nowadays, and if you know how it works, you can use it for different things, even for business promotion! When I first downloaded it, I thought that it was just an app where teenagers dance or people post their random videos with cats, jokes, etc. But when I understood how it works and how the recommendations work, I started getting more quality content. And there are a lot of useful videos where the info helps me in everyday life. For example, I study French, and there are a lot of useful videos which help me to improve my skills. And yesterday, I also came across this article setapp.com/how-to/download-tiktok-... which is pretty useful, and now I know how not only to save those videos but how to transfer them from my phone to my Mac because I watch videos on my phone but use the laptop for studying and work. So it's better for me to have those videos there. Good article to read. And I want to say to all spectacle people that TikTok can be not only an entertaining app but a spiral of info if you know how to use it.