X open-sourced its new feed algorithm — 0 hand-crafted rules, 100% Grok transformer
Snaplyze Digest
R&D intermediate 2 min read Mar 19, 2026 Updated Apr 1, 2026

X open-sourced its new feed algorithm — 0 hand-crafted rules, 100% Grok transformer

“X killed every hand-crafted rule in its feed algorithm. Now it's 100% transformer.”

In Short

X just replaced its entire recommendation system with a Grok-based transformer that learns everything from user engagement sequences. No hand-engineered features. The old Scala codebase (72.9k stars) is now superseded by a Rust implementation (16.1k stars) that uses a two-tower model for retrieval and a transformer for ranking. The key insight: candidates can't attend to each other during scoring, making scores consistent and cacheable at X's scale.

machine-learningrecommendation-systemsrusttransformersopen-source
Why It Matters
The practical pain point this digest is really about.

You know that feeling when you open a social app and the feed feels random or stale? Traditional recommendation systems rely on hand-crafted rules: boost posts with hashtags, penalize long posts, favor recent content, weight by follower count. Engineers tune these weights manually. The problem: rules break, edge cases multiply, and the system becomes unmaintainable. X's old codebase had hundreds of heuristics baked into the ranking pipeline.

How It Works
The mechanism, architecture, or workflow behind it.

Think of it as a two-stage funnel. Stage 1 (Retrieval): A two-tower model encodes you and every post into mathematical vectors. Finding relevant posts becomes a similarity search — your vector dot-producted against all post vectors. Stage 2 (Ranking): A Grok-based transformer predicts 18 different actions you might take (like, reply, block, report). Each action gets a weight, positive for good actions, negative for bad ones. Final score = weighted sum. The clever bit: during ranking, posts can't 'see' each other — they only attend to your context. This makes scores deterministic and cacheable.

Key Takeaways
7 fast bullets that make the core value obvious.
  • Two-tower retrieval — why YOU care: Finds relevant posts from accounts you don't follow by computing similarity between your engagement history and all posts. No more echo chamber of just people you follow.
  • Grok-based transformer ranking — why YOU care: Predicts 18 engagement types (like, reply, repost, block, report) instead of a single 'relevance' score. Content you'd hate gets pushed down because 'block' and 'report' ca...
  • Candidate isolation — why YOU care: Posts can't attend to each other during scoring. A post's score doesn't change based on what else is in the batch. This makes the system deterministic and enables aggressive caching a...
  • Zero hand-engineered features — why YOU care: No manual tuning of 'hashtag weight' or 'post length penalty.' The model learns what matters from data. Simpler codebase, fewer bugs, faster iteration.
  • In-memory Thunder store — why YOU care: Posts from accounts you follow are served from memory in sub-millisecond time. No database hits for the hot path. Your feed loads instantly.
  • Composable pipeline architecture — why YOU care: The Rust codebase uses traits for each pipeline stage (source, hydrator, filter, scorer, selector). Add a new data source or swap a model without rewriting the pipeline.
  • Multi-action prediction with weighted scoring — why YOU care: The model predicts probabilities for 18 actions, each with a weight. Positive actions (like, share) boost the score. Negative actions (block, report) tank it...
Should You Care?
Audience fit, decision signal, and the original source in one place.

Who It Is For

If you're building a recommendation system, feed ranking, or any ML-powered personalization — this is production-grade reference code. The architecture patterns (two-tower retrieval, candidate isolation, composable pipelines) apply beyond social media. Not useful if you need a quick tutorial — this is a full production codebase with real infrastructure dependencies.

Worth Exploring?

Yes — this is rare. A production-scale recommendation system, fully open-sourced, with the actual ML architecture documented. The Rust codebase is clean and the README explains the design decisions. Even if you never run it, the patterns are worth studying. The main gotcha: this is infrastructure, not a library. You can't 'npm install' a feed algorithm. Expect to adapt the architecture, not copy-paste code.

View original source
What the full digest unlocks

There is more here than the public preview.

This page gives you the hook. The full Snaplyze digest goes deeper so you can move from curiosity to decision with less noise.

Open the full digest to read the deeper breakdown, compare viewpoints, and get the practical next-step playbooks.

Open the full digest

Snaplyze

Go beyond the preview

Read the full digest for deep-dive insight, Easy Mode, Pro Mode, and practical playbooks you can actually use.

Install Snaplyze