X's Recommendation Algorithm (GitHub Repository: twitter/the-algorithm) This public repository hosts the source code for X's (formerly Twitter) Recommendation Algorithm, responsible for generating feeds of posts and content across various product surfaces such as the For You Timeline, Search, Explore, and Notifications. Overview Repository: twitter/the-algorithm Stars: 64.2k Forks: 12.2k Watchers: 351 License: AGPL-3.0 License Main Branch: main Contributors: 3 Link to engineering blog: X's Engineering Blog Description X's Recommendation Algorithm encompasses a distributed set of services and jobs designed to serve personalized content feeds. Architecture Product surfaces at X are built on a shared set of data, models, and software frameworks, many of which reside in this repository: Key Components | Type | Component | Description | |--------------------|-------------------------------------------|-----------------------------------------------------------------------------------------------------------| | Data | tweetypie | Core service for reading and writing post data. | | | unified-user-actions | Real-time stream of user actions on X. | | | user-signal-service | Centralized platform to retrieve explicit (likes, replies) and implicit (profile visits, clicks) user signals. | | Model | SimClusters | Community detection and sparse embeddings into communities. | | | TwHIN | Dense knowledge graph embeddings for Users and Posts. | | | trust-and-safety-models | Models for detecting NSFW or abusive content. | | | real-graph | Predicts likelihood of User-user interactions. | | | tweepcred | PageRank algorithm to calculate User reputation. | | | recos-injector | Streaming event processor to build input streams for GraphJet-based services. | | | graph-feature-service | Serves graph features for directed user pairs (e.g., User A's following activity related to User B). | | | topic-social-proof | Identifies topics related to individual posts. | | | representation-scorer | Computes scores between entity pairs using embedding similarity. | | Software framework | navi | High performance ML model serving framework (Rust).