The Engineering behind Instagram's Recommendation Algorithm
Retrieval
Ranking all of the billions of pieces of content uploaded to Instagram for every single user is obviously not feasible.
Therefore, the candidate generation stage uses a set of heuristics and ML models to narrow down the potential items to thousands of photos/videos.
In terms of heuristics, Instagram uses things like
Ranking all of the billions of pieces of content uploaded to Instagram for every single user is obviously not feasible.
Therefore, the candidate generation stage uses a set of heuristics and ML models to narrow down the potential items to thousands of photos/videos.
In terms of heuristics, Instagram uses things like
- Accounts you follow
The Engineering behind Instagram's Recommendation Algorithm
All the recommendation systems you see at Twitter, Facebook, TikTok, YouTube, etc. have a similar high-level architecture.
They have a layered architecture that looks something like the following
They have a layered architecture that looks something like the following
- Retrieval - Narrow down the candidates of what to show a user to thousands of potential items
- First Stage Ranking - Apply a low-level ranking system to
The Engineering behind Instagram's Recommendation Algorithm
Second Stage
Here, Instagram uses a Multi-Task Multi Label (MTML) neural network model. As the name suggests, this is an ML model that is designed to handle multiple tasks (objectives) and predict multiple labels (outcomes) simultaneously.
For recommendation systems, this means predicting different types of user engagement with a piece of content (... See more
Here, Instagram uses a Multi-Task Multi Label (MTML) neural network model. As the name suggests, this is an ML model that is designed to handle multiple tasks (objectives) and predict multiple labels (outcomes) simultaneously.
For recommendation systems, this means predicting different types of user engagement with a piece of content (... See more
The Engineering behind Instagram's Recommendation Algorithm
First Stage Ranking
After candidates are retrieved, the system needs to rank them by value to the user. This “value” is determined by how likely a user is to engage with the photo/video. Engagement is measured by whether the user likes/comments on it, shares it, watches it fully, etc.
The first stage ranker takes in thousands of candidates from the... See more
After candidates are retrieved, the system needs to rank them by value to the user. This “value” is determined by how likely a user is to engage with the photo/video. Engagement is measured by whether the user likes/comments on it, shares it, watches it fully, etc.
The first stage ranker takes in thousands of candidates from the... See more
The Engineering behind Instagram's Recommendation Algorithm
With a Two Tower Model, you generate embedding vectors for the user and for all the content you need to retrieve/rank. An embedding vector is just a compact representation that captures the attributes and relationships of an item in a machine-learning-friendly vector.
Once you have these embedding vectors, you can look at the similarity between a u... See more
Once you have these embedding vectors, you can look at the similarity between a u... See more