Open Source recommendation algorithms twitter

Deepak Gupta
4 min readApr 4


Empowering Developers to Build the Next Generation of Social Media

Twitter is one of the world’s most popular social media platforms, with over 368 million monthly active users. The platform has been used to share news, information, and opinions on various topics. However, the inner workings of Twitter’s algorithm have been a mystery to many users.

Twitter has tried to be more transparent about its algorithm in recent years. In 2017, the company released a blog post outlining its algorithm’s basic principles. However, the details of the algorithm have remained largely unknown.

In 2023, Twitter announced that it would be making its algorithm open-source. This means anyone can now view the code that powers Twitter’s algorithm. This is a significant development, as it allows users to understand better how their content is ranked and displayed.

What is Twitter’s algorithm?

Twitter’s algorithm is a complex system that considers various factors when ranking and displaying content.

These factors include:

  • The user’s interests
  • The user’s past interactions with the content
  • The content’s popularity
  • The content’s relevance to the user

The algorithm is constantly being updated to improve the user experience. For example, in 2018, Twitter announced that it would give more weight to “quality” content. This means users are likelier to see high-quality, informative, and engaging content.

Why is Twitter’s algorithm important?

Twitter’s algorithm is crucial because it determines what content users see. The algorithm can be used to promote certain types of content over others. This can have a significant impact on the spread of information and ideas.

For example, if the algorithm is biased towards certain types of content, it can lead to a “filter bubble” where users only see content that confirms their existing beliefs. This can be dangerous, making people more polarized and less open to new ideas.

Open-source algorithms

The move was announced by Twitter’s CEO Elon Musk, who had previously polled his followers about whether they wanted to see the algorithm’s inner workings.

Twitter algorithm should be open source

- Elon Musk (@elonmusk) March 24, 2022

The decision to open-source the algorithm is expected to bring more transparency and accountability into Twitter’s functions and help researchers and developers understand how the platform curates and ranks content for its users. The recommendation algorithms code have released on GitHub.

According to Twitter’s blog post, the algorithm has three main stages: candidate sourcing, ranking, and filtering.

Candidate sourcing is the process of fetching the best tweets from different sources, such as accounts that a user follows (in-network) or accounts that a user does not follow (out-of-network). The algorithm uses various models to predict how likely users are to interact with a tweet or an account based on their previous engagements and interests. The goal is to make the “For You” timeline a mix of 50% in-network and 50% out-of-network tweets.

Ranking is the process of scoring each tweet using a machine learning model that considers thousands of features, such as the tweet’s content, popularity, recency, and relevance. The algorithm also labels each tweet with a category, such as news, entertainment, sports, etc. The ranking aims to optimize for positive engagement, such as likes, retweets, and replies.

Filtering applies heuristics and filters to remove tweets unsuitable for display on the timeline, such as tweets from blocked users, NSFW content, or duplicate tweets. The algorithm also tries to ensure diversity and balance on the timeline by limiting the number of tweets from the same account or category.

Implications of Twitter’s open-source algorithm

The release of Twitter’s open-source algorithm is a significant development. It allows users to understand better how their content is ranked and displayed. This can help users to improve the chances that a wider audience will see their content. The algorithm’s release does not mean that users can fully control what they see and do on Twitter.

Twitter’s open-source algorithm is a rare example of a significant tech company sharing its core technology with the public. It could potentially inspire other platforms to follow and offer more transparency and control to their users. It could also enable researchers and developers to study and improve the algorithm’s performance and impact on society.

Most of the recommendation algorithm will be made open source today. The rest will follow.

Acid test is that independent third parties should be able to determine, with reasonable accuracy, what will probably be shown to users.

No doubt, many embarrassing issues will be…

- Elon Musk (@elonmusk) March 31, 2023

Overall, the release of Twitter’s open-source algorithm is a positive development. It allows users to understand better how the platform works and to improve the chances that a wider audience will see its content. However, it is essential to note that the algorithm is still complex, and there is still much that we do not know about it.

Originally published at on April 4, 2023.



Deepak Gupta

Tech Entrepreneur, CyberSecurity innovator and author. Developer at heart. Co-founder/CTO of @LoginRadius, Upcoming stuff: