Twitter Open-Sources Its Recommendation Algorithm

To avoid any risk, the open-source code does not include Twitter’s ad recommendations or the social media’s training data.

As Elon Musk had promised earlier , Twitter has decided to make its algorithm code that it uses for selecting tweets to display on users’ timelines publicly available on GitHub and provided an explanation in a blog post . The post outlines the factors considered by the algorithm in selecting tweets for the “For You” timeline and how they are ranked and filtered.

Click here to check out the code.

Musk revealed much information about the release on a Twitter Spaces session earlier. He pointed out that the release might look quite embarrassing as there are a lot of mistakes in the code. Interestingly, to avoid any risk, the open-source code does not include Twitter’s ad recommendations or the social media’s training data.

AIM Daily XO

Join our editors every weekday evening as they steer you through the most significant news of the day, introduce you to fresh perspectives, and provide unexpected moments of joy
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

The algorithm consists of three stages, as per Twitter’s explanation. The algorithm collects the most noteworthy tweets from various sources, ranks them using a machine learning model, and then removes any tweets from blocked accounts, previously seen tweets, or NSFW content before displaying them on a user’s timeline.

Manu Joseph , creator of PyTorch Tabular, said in a post that It’s essential to note that these algorithm system are a complex collaboration, that require many different components. A basic ranking algorithm or collaborative filtering model isn’t adequate on its own.


Download our Mobile App



Interestingly, the blog shows that the pipeline above runs approximately 5 billion times per day and completes in under 1.5 seconds on average. Moreover, a single pipeline execution requires 220 seconds of CPU time, nearly 150x the latency you perceive on the app.

Twitter Strides

The release of the code of recommendation algorithm’s source code, comes after a series of controversies in recent months. Platformer reported that in February, Elon Musk requested that Twitter’s engineers modify the algorithm to increase the visibility of his tweets.

However, Twitter later reversed this alteration. In November, Twitter started displaying more tweets from non-followed accounts, a move that had been tested before Musk’s involvement but was ultimately scrapped after user pushback.

In the release Musk talks about a lot of privacy and security issues for not including a lot of code for the website. On the flip side, this comes in the backlight of Twitter recently firing its ethical AI and safety staff. But even then, Musk has ensured that the company has taken all the steps to ensure the reliability and security of the code.

Twitter is also facing competition in the open-source community. Mastodon , the decentralised social network platform has been gaining traction among several Twitter users. Jack Dorsey, Bluesky is also attracting a lot of users, which is also looking for open-source protocols.

Sign up for The AI Forum for India

Analytics India Magazine is excited to announce the launch of AI Forum for India – a community, created in association with NVIDIA, aimed at fostering collaboration and growth within the artificial intelligence (AI) industry in India.

Mohit Pandey
Mohit dives deep into the AI world to bring out information in simple, explainable, and sometimes funny words. He also holds a keen interest in photography, filmmaking, and the gaming industry.

Our Upcoming Events

Regular Passes expiring on Friday
27-28th Apr, 2023 I Bangalore
Data Engineering Summit (DES) 2023

23 Jun, 2023 | Bangalore
MachineCon India 2023

21 Jul, 2023 | New York
MachineCon USA 2023

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
MOST POPULAR

Council Post: Retail Business through Generative AI

Today, retail technology is developing at a fast pace – whether it is business transformation or even exploring emerging tech (AR/VR and metaverse etc.) to give customers a more experiential journey. Businesses are innovating not only to remain relevant, but also, ahead. Some are really shaping the future of omni-channel retail by predicting customer expectations and market trends.

Cerebras Wants What NVIDIA Has

While OpenAI apparently utilised 10,000 NVIDIA GPUs to train ChatGPT, Cerebras claims to have trained their models to the highest accuracy for a given compute budget.