AVWBeta
ajad van wyk
About
Portfolio
Tech Stack
Blog
Gallery
Stimming
Resources
AVW
AVW
Get in touch

Let'sbuildsomethingremarkabletogether.

Start with the background, selected work, or the profile brief for a sharper read on the practice and the work behind it.

Get in TouchProfile Brief

Explore

About
Portfolio
Blog

Expertise

Finance & Investment
Legal Framework
AI & Innovation
Research & Writing

Resources

Browse Study Notes
Download LLM Profile
Tech Stack
Gallery

Trust

Email
Download Profile Brief
About AVW
Selected Work

Latest Notes

Archive

Phoenix

X Algorithm

Thunder

X Algorithm

X Algorithm — For You Feed

X Algorithm

AVWCape Town, South Africa

© 2026 Ajad Van Wyk. All rights reserved.

Back to Resources
X Algorithm

XAlgorithm—ForYouFeed

15 Apr 2026
3 min read
recommendation-systemmachine-learningx-twitterstudy-guidealgorithms
In this note
  1. 01Pipeline overview
  2. 02Components
  3. 03Key design decisions
  4. 04Scoring formula
  5. 05Related notes

X Algorithm — For You Feed

"Recommendation system powering the For You feed on X. Open-sourced by xAI under Apache 2.0. Written primarily in Rust (62.9%) and Python (37.1%)."
01

Pipeline overview

The feed is assembled in 7 sequential stages on every request:

Feed request
     │
     ▼
1. Query hydration          ← fetch user context first
     │
     ├──────────────────────────────────┐
     ▼                                  ▼
2a. Thunder                      2b. Phoenix retrieval
    (in-network)                     (out-of-network)
     │                                  │
     └──────────────┬───────────────────┘
                    ▼
            3. Candidate hydration
                    │
                    ▼
            4. Pre-scoring filters  (10 boolean filters)
                    │
                    ▼
            5. Phoenix scorer       (Grok transformer)
               Weighted scorer      Score = Σ(w × P(action))
               Author diversity scorer
                    │
                    ▼
            6. Selection — top K
                    │
                    ▼
            7. Post-selection filter (spam / violence / deleted)
                    │
                    ▼
            Ranked feed response
02

Components

ComponentLanguageRole
Home MixerRustOrchestration layer
ThunderRustIn-network retrieval
PhoenixPython/RustOut-of-network retrieval + ranking
Candidate PipelineRustReusable pipeline framework
03

Key design decisions

1. No hand-engineered features

The Grok-based transformer learns all relevance signals directly from raw engagement sequences. No manual feature pipelines for things like "user follows author" or "post contains keyword." This simplifies the data infrastructure and moves all complexity into the model.

2. Candidate isolation in ranking

During transformer inference, candidates cannot attend to each other — each post only attends to the user context. Scores are therefore independent of batch composition, making them consistent and cacheable.

3. Multi-action prediction

Rather than predicting a single "relevance" score, the model predicts ~15 distinct action probabilities. This allows negative signals (block, mute, report) to actively suppress unwanted content.

4. Hash-based embeddings

Both retrieval and ranking use multiple hash functions for embedding lookup instead of a fixed vocabulary table. This handles an unbounded feature space without a rigid vocab.

5. Composable pipeline architecture

The candidate-pipeline crate separates business logic from execution and monitoring. Stages run in parallel where possible with graceful error handling.

04

Scoring formula

$$\text{Score} = \sum_{i} w_i \cdot P(\text{action}_i)$$

Where:

  • - Positive actions (like, reply, repost, share, follow) get positive weights
  • - Negative actions (block, mute, report, not interested) get negative weights
05

Related notes

  • - Thunder — in-memory in-network post store
  • - Phoenix — two-tower retrieval + Grok transformer ranker
  • - X Algorithm — Pre-Scoring Filters — full filter stack
  • - X Algorithm — Scoring Pipeline — scorer details
  • - X Algorithm — Key Concepts — concept glossary
Previous

Thunder

Next

X Algorithm — Key Concepts

More from this module

Phoenix

recommendation-systemx-twitterout-of-network-retrievaltransformer

Thunder

recommendation-systemx-twitterin-network-retrievalrust

X Algorithm — Key Concepts

recommendation-systemx-twitterconceptsglossary

X Algorithm — Pre-Scoring Filters

recommendation-systemx-twitterfilterspipeline
Keep exploring

More notes and resources

Browse the full resource vault, or reach out to discuss any of these topics.

All resources
Get in touch