# x-algorithm

> The open-source code powering the For You recommendation feed on X.

This repository contains the recommendation architecture, filtering pipelines, and transformer ranking models used to generate X's For You feed. It exposes how in-network and out-of-network posts are retrieved, evaluated, safety-filtered, and scored based on predicted user engagement probabilities. Developers and researchers can study the codebase or run proof-of-concept ranker models using provided training and synthetic data scripts.

Website: https://github.com/xai-org/x-algorithm

## What it is for

- Inspect the exact scoring, ranking, and filtering logic behind X's For You feed
- Train a local proof-of-concept ranking model on custom post and interaction data
- Analyze algorithmic weights and safety filters to understand content distribution dynamics

## Features

- Phoenix transformer-based ranking model architecture and training code
- Candidate generation pipelines for both in-network and out-of-network content via SimClusters and Thunder
- Safety, spam, and visibility filtering rules including botmaker and scarecrow services
- Scoring formulas that scale predicted probabilities for actions like likes, replies, and dwell time
- Synthetic data generation utilities to run proof-of-concept model training locally

## Pricing

Open source. Free and open source under the Apache-2.0 license

## Details

- Type: GitHub repo
- Category: [Development](https://xiry.app/topics/development.md)
- Open source: yes
- Platforms: Linux, Self-hosted
- For: Machine learning engineers, data scientists, and creators analyzing recommendation systems.
- Tags: recommendation algorithm, machine learning, transformers, open source, ranking system, x platform

## Why it was saved

- [@retardmode, 20 January 2026](https://x.com/retardmode/status/2013481448838164799): The primary source for the ranking rules summarized in the tweet.
- [@ruslanjabari, 20 January 2026](https://x.com/ruslanjabari/status/2013527259450147133): Lets you inspect or train on the actual feed ranking model; author notes a toy ranker on your own data gives a decent pre-post performance prediction, better with larger training sets.
- [@weswinder, 20 January 2026](https://x.com/weswinder/status/2013492281433542918): The source material the posting strategy was derived from; readable reference for the actual ranking code.
- [@aidenybai, 20 January 2026](https://x.com/aidenybai/status/2013656265273287156): Announcement of the repo of the algorithm powering the For You feed on X — the repo the demo queries.

## Related

- [Bytez](https://xiry.app/resources/bytez): Unified serverless API to discover and run open and closed AI models (Web app, Freemium)
- [awesome-llm-apps](https://xiry.app/resources/awesome-llm-apps): Open-source collection of runnable AI agent, skill, and RAG templates (GitHub repo, Open source)
- [Any Distance Goes Open Source](https://xiry.app/resources/any-distance-goes-open-source): Deep-dive writeup and open-source release of the Apple Design Award–winning fitness tracker. (Article or course, Free)
- [coss ui](https://xiry.app/resources/coss-ui): Modern UI component library built on top of Base UI (Web app, Free)
- [Hyperbrowser App Examples](https://xiry.app/resources/hyperbrowser-app-examples): Open-source web apps and AI browser tools built with Hyperbrowser (GitHub repo, Open source)
- [Mole](https://xiry.app/resources/mole): Open-source macOS command-line toolkit for disk cleanup, uninstallation, and system monitoring (Web app, Open source)

Updated 10 October 2026. Page: https://xiry.app/resources/x-algorithm

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
