# X Recommendation Algorithm

Source code for the X Recommendation Algorithm

Repository: https://github.com/twitter/the-algorithm
Canonical: https://ross.abutalabs.com/products/x-recommendation-algorithm
Homepage: https://blog.twitter.com/engineering/en_us/topics/open-source/2023/twitter-recommendation-algorithm
Language: Scala
License: AGPL-3.0
License Family: copyleft
Last push: 2025-09-08T18:40:54+00:00

## Health v2 (maintenance only)
Score: 48/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 41, release rhythm 35, longevity 89
- inputs: {"age_days": 1255, "days_push": 359, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 73868, forks 13286 (observed 2026-08-28T04:12:21.363440+00:00)

## What it is
The open-source source code for X's (formerly Twitter) recommendation algorithm, a set of services and jobs that serve personalized feeds of posts across X product surfaces like the For You timeline, search, and notifications. It includes data pipelines, embedding models (SimClusters, TwHIN), trust-and-safety models, and serving frameworks such as product-mixer and navi.

## Use cases
- understand how the X For You feed ranking works
- study large-scale recommendation systems in production
- learn how social media feeds are personalized
- research community detection and graph embeddings at scale
- build a recommendation service for a social feed
- study ML model serving architecture in Scala and Rust

## When to choose
- you want to inspect or research a real production-scale recommendation algorithm
- you need reference implementations of candidate sourcing, ranking, and feed mixing
- you are studying social graph embeddings or user interaction prediction

## When to avoid
- you want a plug-and-play recommendation library for your own app
- you need a small, self-contained project that runs without X's infrastructure
- you require a permissive license since it is AGPL-3.0

## Facets
- artifact type: service
- maturity: active
- function: machine-learning, search-engine, streaming, data-science
- domain: machine-learning, social-media, analytics, large-language-models
- platform: jvm, rust, cloud
- tags: recommendation-system, feed-ranking, scala, social-graph, embeddings, content-ranking, docker

## Member repositories
- twitter/the-algorithm (main) score 48
- twitter/the-algorithm-ml (backend) score 30

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:12:21.363440+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:14:59.634828+00:00, confidence not recorded.
  - readme: https://github.com/twitter/the-algorithm (fetched 2026-08-28T04:12:21.363440+00:00, sha 5f356e92d928)
- Data as of 2026-08-30T08:39:29.467469+00:00.
