the-algorithm-ml README

The project's README from github.com/twitter/the-algorithm-ml. As one markdown file: README.md.

This project open sources some of the ML models used at Twitter.

Currently these are:

  1. The "For You" Heavy Ranker (projects/home/recap).

  2. TwHIN embeddings (projects/twhin) https://arxiv.org/abs/2202.05387

This project can be run inside a python virtualenv. We have only tried this on Linux machines and because we use torchrec it works best with an Nvidia GPU. To setup run

./images/init_venv.sh (Linux only).

The READMEs of each project contain instructions about how to run each project.

the-algorithm-ml (twitter/the-algorithm-ml)

Searching Database…

What is this?This is the source code for part of Twitter's (X's) recommendation algorithm, specifically the machine learning models used to rank and embed content for the 'For You' timeline.
Is this a full app or just the ML model code?It's just the ML model code, not a runnable app or service — two separate projects (the Heavy Ranker and TwHIN embeddings), each with its own README and run instructions.
How do I get it running?Set up a Python virtualenv and run the init script at ./images/initvenv.sh, then follow the README inside each project folder for how to run that specific model.
Do I need a specific OS or hardware to run this?It's only been tested on Linux, and since it relies on torchrec, it's best run with an Nvidia GPU.
Will this run well without a GPU or on Windows/macOS?Not officially — the setup script is Linux-only and the torchrec dependency makes an Nvidia GPU strongly preferred, so non-Linux or GPU-less setups aren't the supported path.
Who is this useful for?Researchers and ML engineers who want to study or reproduce the actual ranking/embedding models behind Twitter's recommendation feed.
Do I need an Nvidia GPU specifically?Yes, it works best with one because of the torchrec library used for the models.
What is the 'Heavy Ranker'?It's the model used to rank content for the 'For You' timeline, located in the projects/home/recap folder.
What are TwHIN embeddings for?TwHIN (Twitter Heterogeneous Information Network) embeddings are representations of entities like users and tweets, found in the projects/twhin folder, used as inputs to recommendation models.
Is this the whole Twitter recommendation system?No, this repo only open sources some of the ML models used at Twitter, not the full end-to-end recommendation pipeline.
Creator
twitter
Size
0.1 MB
Stars
10.6K
Updated
CommitApr 06
Age
3y
Commits · 90 Days