ML Training Data in Recommender Systems
It’s easy to get caught up in all the reasons to write at Big Tech. Writing for strategy, writing for direction. But what I truly enjoy is just writing. Directionless writing. Writing about things that are more than technical details, writing about my thoughts and opinions. Most importantly, writing about things I learned about. Because only when you can easily teach something, do you fully understand it.
This endeavor will be just that. My intended audience will be for people who aren’t knee deep building LLMs but instead anyone who is interested in seeing how the wheels turn in ML. Starting with a very light introduction on how training data is generated in recommender systems such as TikTok.
If this sounds like your cup of tea, follow along :)
Intro
ML models need labeled data for supervised learning. This consists of (1) an example data point and (2) a ground truth label. Think of it as first showing a child a blue shirt and then telling it that this shirt is blue. ML models in Recommender Systems such as TikTok learn to show the top videos that are relevant to a user, in the right order, out of billions of short clips out there. Well, how does the model know to do this? It first shows a user a list of videos (1), users then explicitly tell the models which ones they like by liking it, rewatching it or even sharing it to their friends (2). These two events together create the set of training data to learn from.
Seems simple enough, but the process of doing this at the scale of billions of users and even more data points is a lot harder and requires complex systems working together in unison.
The additional technical complexity comes from the fact that these two events are separated in time. Since we first start by creating a list of videos we think the user may like, and only some time later does the user actually interact with these videos. They may even come back and interact differently with the same video; Perhaps unliking it or sharing it with a friend. So to create the final labeled data we need to join and aggregate these events for all of users at scale.
Data Generation
Let’s go through an example to make this more concrete.
#1
Starting with #1, we first will be shown a list of videos. Some recommender systems pre-compute these recommendations and store them. This is done at night or usually at times when there isn’t high demand for the system.
Another reason to do this is so that the retrieval is much faster for a user. Instead of making the round trip to the ML model, generating the results and returning back each time we open an app, a list of recommendations could already be generated and stored for quick retrieval.
#2
The next day, for example, we could open the app and the first thing we see is a bunch of cats being cute! Haha, my friend who loves cats will like this. So, I decide to share it to them. This action is then logged by the app. Additionally, we can collect other useful data for users such as whether they prefer adorable videos, their age, their country etc. This information is referred to as contextual information. The context of the user matters when you want to show them something that they’d enjoy.
Maybe they prefer adorable videos before bed? Perhaps mornings are more for music and the fact that they live in India means videos that reference Bollywood could be more relatable.
Join
Now finally, the recommendations computed for them yesterday as well as the actions done today along with all the other contextual information needs to be joined. This needs to be done for every user across every video millions of times over. Once this is done you will finally have a full-fledged information dense training data point for the ML model to learn from. Yes, this shirt is indeed Blue.


