Artificial Intelligence 9 min read

Overview of Twitter's Open‑Source Recommendation Algorithm Architecture

Twitter has open‑sourced its recommendation algorithm, detailing a complex pipeline of candidate sources, graph‑based models, embedding techniques, and ranking services that together generate personalized home‑timeline tweets for users.

Top Architect
Top Architect
Top Architect
Overview of Twitter's Open‑Source Recommendation Algorithm Architecture

Twitter has open‑sourced part of its recommendation algorithm, the code is available at https://github.com/twitter/the-algorithm and has attracted over 24k stars.

The system consists of multiple services and models that generate and rank tweets for a user’s home timeline. Key components include SimClusters, TwHIN, trust‑and‑safety models, real‑graph, tweepcred, recos‑injector, graph‑feature‑service, search‑index, cr‑mixer, user‑tweet‑entity‑graph, follow‑recommendation‑service, light‑ranker, heavy‑ranker, home‑mixer, visibility‑filters, timelineranker, and the Rust‑based navi framework.

Candidate sources are divided into in‑network (tweets from accounts a user follows) and out‑network (tweets from other users). In‑network ranking relies heavily on the Real Graph model, which predicts interaction likelihood between a user and a tweet author.

Out‑network retrieval uses two approaches: a social‑graph traversal (implemented by GraphJet) that explores recent interactions of followed users and similar users, and an embedding‑space method that computes similarity between users and tweets. The SimClusters embedding groups users and tweets into 145 000 communities, updated every three weeks.

After candidates are collected, they pass through a series of rankers (light‑ranker, heavy‑ranker) and mixers (home‑mixer, product‑mixer) before being filtered by visibility‑filters and served to the timeline.

For further details, see Twitter’s technical blog at https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm and the related ML model repository https://github.com/twitter/the-algorithm-ml .

machine learningRecommendation AlgorithmOpen-sourceTwittersocial media
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login 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.