GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Atanu484/the-twitter-algorithm: Source code for Twitter's Recommendation Algorithm

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
ann/src/main
ann/src/main
 
 
ci
ci
 
 
cr-mixer
cr-mixer
 
 
docs
docs
 
 
follow-recommendations-service
follow-recommendations-service
 
 
graph-feature-service
graph-feature-service
 
 
home-mixer
home-mixer
 
 
navi
navi
 
 
product-mixer
product-mixer
 
 
pushservice
pushservice
 
 
recos-injector
recos-injector
 
 
representation-manager
representation-manager
 
 
representation-scorer
representation-scorer
 
 
science/search/ingester/config
science/search/ingester/config
 
 
simclusters-ann
simclusters-ann
 
 
src
src
 
 
timelineranker
timelineranker
 
 
timelines/data_processing
timelines/data_processing
 
 
topic-social-proof
topic-social-proof
 
 
trust_and_safety_models
trust_and_safety_models
 
 
tweetypie
tweetypie
 
 
twml
twml
 
 
unified_user_actions
unified_user_actions
 
 
user-signal-service
user-signal-service
 
 
visibilitylib
visibilitylib
 
 
.gitignore
.gitignore
 
 
COPYING
COPYING
 
 
README.md
README.md
 
 
RETREIVAL_SIGNALS.md
RETREIVAL_SIGNALS.md
 
 

Repository files navigation

Twitter's Recommendation Algorithm

Twitter's Recommendation Algorithm is a set of services and jobs that are responsible for serving feeds of Tweets and other content across all Twitter product surfaces (e.g. For You Timeline, Search, Explore, Notifications). For an introduction to how the algorithm works, please refer to our engineering blog.

Architecture

Product surfaces at Twitter are built on a shared set of data, models, and software frameworks. The shared components included in this repository are listed below:

Type Component Description
Data tweetypie Core Tweet service that handles the reading and writing of Tweet data.
unified-user-actions Real-time stream of user actions on Twitter.
user-signal-service Centralized platform to retrieve explicit (e.g. likes, replies) and implicit (e.g. profile visits, tweet clicks) user signals.
Model SimClusters Community detection and sparse embeddings into those communities.
TwHIN Dense knowledge graph embeddings for Users and Tweets.
trust-and-safety-models Models for detecting NSFW or abusive content.
real-graph Model to predict the likelihood of a Twitter User interacting with another User.
tweepcred Page-Rank algorithm for calculating Twitter User reputation.
recos-injector Streaming event processor for building input streams for GraphJet based services.
graph-feature-service Serves graph features for a directed pair of Users (e.g. how many of User A's following liked Tweets from User B).
topic-social-proof Identifies topics related to individual Tweets.
representation-scorer Compute scores between pairs of entities (Users, Tweets, etc.) using embedding similarity.
Software framework navi High performance, machine learning model serving written in Rust.
product-mixer Software framework for building feeds of content.
timelines-aggregation-framework Framework for generating aggregate features in batch or real time.
representation-manager Service to retrieve embeddings (i.e. SimClusers and TwHIN).
twml Legacy machine learning framework built on TensorFlow v1.

The product surfaces currently included in this repository are the For You Timeline and Recommended Notifications.

For You Timeline

The diagram below illustrates how major services and jobs interconnect to construct a For You Timeline.

The core components of the For You Timeline included in this repository are listed below:

Type Component Description
Candidate Source search-index Find and rank In-Network Tweets. ~50% of Tweets come from this candidate source.
cr-mixer Coordination layer for fetching Out-of-Network tweet candidates from underlying compute services.
user-tweet-entity-graph (UTEG) Maintains an in memory User to Tweet interaction graph, and finds candidates based on traversals of this graph. This is built on the GraphJet framework. Several other GraphJet based features and candidate sources are located here.
follow-recommendation-service (FRS) Provides Users with recommendations for accounts to follow, and Tweets from those accounts.
Ranking light-ranker Light Ranker model used by search index (Earlybird) to rank Tweets.
heavy-ranker Neural network for ranking candidate tweets. One of the main signals used to select timeline Tweets post candidate sourcing.
Tweet mixing & filtering home-mixer Main service used to construct and serve the Home Timeline. Built on product-mixer.
visibility-filters Responsible for filtering Twitter 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.
timelineranker Legacy service which provides relevance-scored tweets from the Earlybird Search Index and UTEG service.

Recommended Notifications

The core components of Recommended Notifications included in this repository are listed below:

Type Component Description
Service pushservice Main recommendation service at Twitter used to surface recommendations to our users via notifications.
Ranking pushservice-light-ranker Light Ranker model used by pushservice to rank Tweets. Bridges candidate generation and heavy ranking by pre-selecting highly-relevant candidates from the initial huge candidate pool.
pushservice-heavy-ranker Multi-task learning model to predict the probabilities that the target users will open and engage with the sent notifications.

Build and test code

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

Contributing

We 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 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 Twitter.

Read our blog on the open source initiative here.

About

Source code for Twitter's Recommendation Algorithm

blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.