Inside Twitter’s Open‑Source Recommendation Algorithm: How Likes, Retweets, and Follows Are Weighted

Elon Musk opened Twitter's recommendation algorithm on GitHub, sparking massive interest as the community dissected its weighting rules, revealing that likes, retweets, and follows receive dramatically higher influence than other signals.

21CTO
21CTO
21CTO
Inside Twitter’s Open‑Source Recommendation Algorithm: How Likes, Retweets, and Follows Are Weighted

Elon Musk fulfilled his promise by open‑sourcing Twitter’s recommendation algorithm on GitHub, quickly gathering nearly 30,000 stars.

Before the release, the tech community was buzzing, and Sourcegraph even hosted a live stream.

Below is a quick walkthrough of the core ranking weight rules extracted from the source file

https://github.com/twitter/the-algorithm/blob/main/cr-mixer/server/src/main/scala/com/twitter/cr_mixer/similarity_engine/EarlybirdTensorflowBasedSimilarityEngine.scala#L142

:

retweetCountParams – retweets count 20× weight.

replyCountParams – replies count 1× weight (20 replies ≈ 1 retweet).

reputationParams – reputation 0.2× weight.

luceneScoreParams – Lucene scoring 2× weight (content relevance).

textScoreParams – pure text 0.18× weight.

urlParams – URLs 2× weight.

isReplyParams – replies to others 1× weight.

favCountParams – likes 30× weight.

langEnglishUIBoost – English UI 0.5× weight.

langEnglishTweetBoost – English tweets 0.2× weight.

langDefaultBoost – default language 0.02× weight.

unknownLanguageBoost – unknown language 0.05× weight.

offensiveBoost – offensive content 0.1× weight (penalized).

inTrustedCircleBoost – trusted‑circle content 2× weight.

multipleHashtagsOrTrendsBoost – multiple tags 0.6× weight.

inDirectFollowBoost – indirect follow (author follows after seeing tweet) 4× weight.

tweetHasTrendBoost – trending topics 1.1× weight.

selfTweetBoost – self‑retweet 2× weight.

tweetHasImageUrlBoost – image URL 2× weight.

tweetHasVideoUrlBoost – video URL 2× weight.

In short, Twitter’s “one‑click three‑likes” are likes (30×), retweets (20×), and follows (4×).

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

machine learningRecommendation Algorithmopen sourceTwitter
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.