“X killed every hand-crafted rule in its feed algorithm. Now it's 100% transformer.”
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.
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.
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.
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.
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 sourceThis 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.
Read the full digest for deep-dive insight, Easy Mode, Pro Mode, and practical playbooks you can actually use.
Install Snaplyze