As promised earlier, Elon Musk-led Twitter has published the source code of the algorithm today – that’s used to determine how the platform shows tweets in For You feed.

As per it, the company considers certain aspects like the people you follow (and some from their network), ranking, and filtering – before showing up their tweets in your timeline. While this code is officially out, Twitter held back the ad recommendations code and a few other parts to maintain user and advertiser safety.

Opening the Source Code

Ever since Elon Musk took over Twitter, he’s been trying to increase transparency for the good. In this pursuit, we’ve seen Musk himself answering and admitting some of the key questions posted by the community, while also vouching to open source the platform code soon.

And he stood by his word – by publishing (1,2) Twitter’s ‘For You’ recommendation algorithm’s source code to everyone! This is as per a poll he made last week, and now implementing it. Doing so, the Twitter engineering team said the tweets on your For You tab are chosen by a service called the Home Mixer, which follows the below rules:

  1. Fetch the best Tweets from different recommendation sources in a process called candidate sourcing.
  2. Rank each Tweet using a machine learning model.
  3. Apply heuristics and filters, such as filtering out Tweets from users you’ve blocked, NSFW content, and Tweets you’ve already seen.

The final goal of the above process is to show 59% of relevant and recent tweets from their followers, and the rest from people whom they don’t follow, but may find interesting.

While it’s good that we’re seeing this algorithm going public, Twitter held back the code of advertising recommendations, or other parts that endanger users’ safety or may dent the platform’s security.

“We also took additional steps to ensure that user safety and privacy would be protected, including our decision not to release training data or model weights associated with the Twitter algorithm at this point.”


Please enter your comment!
Please enter your name here