[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-424":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},424,"the-algorithm","twitter\u002Fthe-algorithm","twitter","Source code for the X Recommendation Algorithm","https:\u002F\u002Fblog.twitter.com\u002Fengineering\u002Fen_us\u002Ftopics\u002Fopen-source\u002F2023\u002Ftwitter-recommendation-algorithm",null,"Scala",73412,13280,409,318,0,7,41,294,35,45,"GNU Affero General Public License v3.0",false,"main",[],"2026-06-12 02:00:13","# X's Recommendation Algorithm\n\nX's Recommendation Algorithm is a set of services and jobs that are responsible for serving feeds of posts and other content across all X product surfaces (e.g. For You Timeline, Search, Explore, Notifications). For an introduction to how the algorithm works, please refer to our [engineering blog](https:\u002F\u002Fblog.x.com\u002Fengineering\u002Fen_us\u002Ftopics\u002Fopen-source\u002F2023\u002Ftwitter-recommendation-algorithm).\n\n## Architecture\n\nProduct surfaces at X are built on a shared set of data, models, and software frameworks. The shared components included in this repository are listed below:\n\n| Type | Component | Description |\n|------------|------------|------------|\n| Data | [tweetypie](tweetypie\u002Fserver\u002FREADME.md) | Core service that handles the reading and writing of post data. |\n|      | [unified-user-actions](unified_user_actions\u002FREADME.md) | Real-time stream of user actions on X. |\n|      | [user-signal-service](user-signal-service\u002FREADME.md) | Centralized platform to retrieve explicit (e.g. likes, replies) and implicit (e.g. profile visits, tweet clicks) user signals. |\n| Model | [SimClusters](src\u002Fscala\u002Fcom\u002Ftwitter\u002Fsimclusters_v2\u002FREADME.md) | Community detection and sparse embeddings into those communities. |\n|       | [TwHIN](https:\u002F\u002Fgithub.com\u002Ftwitter\u002Fthe-algorithm-ml\u002Fblob\u002Fmain\u002Fprojects\u002Ftwhin\u002FREADME.md) | Dense knowledge graph embeddings for Users and Posts. |\n|       | [trust-and-safety-models](trust_and_safety_models\u002FREADME.md) | Models for detecting NSFW or abusive content. |\n|       | [real-graph](src\u002Fscala\u002Fcom\u002Ftwitter\u002Finteraction_graph\u002FREADME.md) | Model to predict the likelihood of an X User interacting with another User. |\n|       | [tweepcred](src\u002Fscala\u002Fcom\u002Ftwitter\u002Fgraph\u002Fbatch\u002Fjob\u002Ftweepcred\u002FREADME) | Page-Rank algorithm for calculating X User reputation. |\n|       | [recos-injector](recos-injector\u002FREADME.md) | Streaming event processor for building input streams for [GraphJet](https:\u002F\u002Fgithub.com\u002Ftwitter\u002FGraphJet) based services. |\n|       | [graph-feature-service](graph-feature-service\u002FREADME.md) | Serves graph features for a directed pair of users (e.g. how many of User A's following liked posts from User B). |\n|       | [topic-social-proof](topic-social-proof\u002FREADME.md) | Identifies topics related to individual posts. |\n|       | [representation-scorer](representation-scorer\u002FREADME.md) | Compute scores between pairs of entities (Users, Posts, etc.) using embedding similarity. |\n| Software framework | [navi](navi\u002FREADME.md) | High performance, machine learning model serving written in Rust. |\n|                    | [product-mixer](product-mixer\u002FREADME.md) | Software framework for building feeds of content. |\n|                    | [timelines-aggregation-framework](timelines\u002Fdata_processing\u002Fml_util\u002Faggregation_framework\u002FREADME.md) | Framework for generating aggregate features in batch or real time. |\n|                    | [representation-manager](representation-manager\u002FREADME.md) | Service to retrieve embeddings (i.e. SimClusers and TwHIN). |\n|                    | [twml](twml\u002FREADME.md) | Legacy machine learning framework built on TensorFlow v1. |\n\nThe product surfaces currently included in this repository are the For You Timeline and Recommended Notifications.\n\n### For You Timeline\n\nThe diagram below illustrates how major services and jobs interconnect to construct a For You Timeline.\n\n![](docs\u002Fsystem-diagram.png)\n\nThe core components of the For You Timeline included in this repository are listed below:\n\n| Type | Component | Description |\n|------------|------------|------------|\n| Candidate Source | [search-index](src\u002Fjava\u002Fcom\u002Ftwitter\u002Fsearch\u002FREADME.md) | Find and rank In-Network posts. ~50% of posts come from this candidate source. |\n|                  | [tweet-mixer](tweet-mixer) | Coordination layer for fetching Out-of-Network tweet candidates from underlying compute services. |\n|                  | [user-tweet-entity-graph](src\u002Fscala\u002Fcom\u002Ftwitter\u002Frecos\u002Fuser_tweet_entity_graph\u002FREADME.md) (UTEG)| Maintains an in memory User to Post interaction graph, and finds candidates based on traversals of this graph. This is built on the [GraphJet](https:\u002F\u002Fgithub.com\u002Ftwitter\u002FGraphJet) framework. Several other GraphJet based features and candidate sources are located [here](src\u002Fscala\u002Fcom\u002Ftwitter\u002Frecos). |\n|                  | [follow-recommendation-service](follow-recommendations-service\u002FREADME.md) (FRS)| Provides Users with recommendations for accounts to follow, and posts from those accounts. |\n| Ranking | [light-ranker](src\u002Fpython\u002Ftwitter\u002Fdeepbird\u002Fprojects\u002Ftimelines\u002Fscripts\u002Fmodels\u002Fearlybird\u002FREADME.md) | Light Ranker model used by search index (Earlybird) to rank posts. |\n|         | [heavy-ranker](https:\u002F\u002Fgithub.com\u002Ftwitter\u002Fthe-algorithm-ml\u002Fblob\u002Fmain\u002Fprojects\u002Fhome\u002Frecap\u002FREADME.md) | Neural network for ranking candidate posts. One of the main signals used to select timeline posts post candidate sourcing. |\n| Post mixing & filtering | [home-mixer](home-mixer\u002FREADME.md) | Main service used to construct and serve the Home Timeline. Built on [product-mixer](product-mixer\u002FREADME.md). |\n|                          | [visibility-filters](visibilitylib\u002FREADME.md) | Responsible for filtering X content to support legal compliance, improve product quality, increase user trust, protect revenue through the use of hard-filtering, visible product treatments, and coarse-grained downranking. |\n|                          | [timelineranker](timelineranker\u002FREADME.md) | Legacy service which provides relevance-scored posts from the Earlybird Search Index and UTEG service. |\n\n### Recommended Notifications\n\nThe core components of Recommended Notifications included in this repository are listed below:\n\n| Type | Component | Description |\n|------------|------------|------------|\n| Service | [pushservice](pushservice\u002FREADME.md) | Main recommendation service at X used to surface recommendations to our users via notifications.\n| Ranking | [pushservice-light-ranker](pushservice\u002Fsrc\u002Fmain\u002Fpython\u002Fmodels\u002Flight_ranking\u002FREADME.md) | Light Ranker model used by pushservice to rank posts. Bridges candidate generation and heavy ranking by pre-selecting highly-relevant candidates from the initial huge candidate pool. |\n|         | [pushservice-heavy-ranker](pushservice\u002Fsrc\u002Fmain\u002Fpython\u002Fmodels\u002Fheavy_ranking\u002FREADME.md) | Multi-task learning model to predict the probabilities that the target users will open and engage with the sent notifications. |\n\n## Build and test code\n\nWe include Bazel BUILD files for most components, but not a top-level BUILD or WORKSPACE file. We plan to add a more complete build and test system in the future.\n\n## Contributing\n\nWe invite the community to submit GitHub issues and pull requests for suggestions on improving the recommendation algorithm. We are working on tools to manage these suggestions and sync changes to our internal repository. Any security concerns or issues should be routed to our official [bug bounty program](https:\u002F\u002Fhackerone.com\u002Fx) through HackerOne. We hope to benefit from the collective intelligence and expertise of the global community in helping us identify issues and suggest improvements, ultimately leading to a better X.\n\nRead our blog on the open source initiative [here](https:\u002F\u002Fblog.x.com\u002Fen_us\u002Ftopics\u002Fcompany\u002F2023\u002Fa-new-era-of-transparency-for-twitter).\n","该项目是X（原Twitter）推荐算法的源代码，负责在所有X产品界面上提供帖子和其他内容的信息流。其核心功能包括处理用户行为数据、生成用户和帖子的嵌入表示、预测用户间的互动可能性等，通过一系列服务和模型实现个性化推荐。技术特点上，采用了Scala语言编写，并集成了多种数据处理与机器学习框架，如Navi、Product Mixer等，以支持高效的数据分析和模型部署。适用于需要构建大规模社交网络推荐系统或类似场景的企业和技术团队。",2,"2026-06-11 02:35:37","top_all"]