How Twitter's Algorithm Really Works
We read X's open-source algorithm. Here's what the code actually says.
What We Found
In March 2023, X (then Twitter) open-sourced their recommendation algorithm. We analyzed the implementation—reading thousands of lines of Scala, examining ML model weights, and tracing data flows through the pipeline. Every claim below is backed by specific code references you can verify yourself.
Our approach: No speculation. No reverse engineering. Just reading the actual implementation and documenting what it does.
Top 5 Most Interesting Findings
🤯 The Favorites Paradox
The Finding: Favorites (likes) have the lowest positive weight despite being the most visible metric.
Favorite (like): 0.5 weight
Reply: 13.5 weight (27x more valuable)
Reply with Author Engagement: 75.0 weight (150x more valuable!)
Why It Matters: The most tracked engagement type has the least algorithmic value. Tweets that drive conversation (replies) vastly outrank tweets that drive agreement (likes). This means controversial content systematically outranks agreeable content.
Consequence: One reply with author engagement = 150 likes in algorithmic value.
⚠️ Weight Values: The open-source code defines weights as configurable parameters (FSBoundedParam with default = 0.0). The actual production weight values shown here come from X's ML training repository and represent their documented configuration.
Parameter definitions: HomeGlobalParams.scala:786-930
Production weight values: the-algorithm-ml/projects/home/recap
Explore: Engagement Calculator →
🔥 Conflict is Emergent, Not Intentional
The Finding: The algorithm cannot distinguish between:
- Agreement reply vs disagreement reply
- Supportive engagement vs hostile engagement
- Productive conversation vs rage bait
All replies get the same weight (13.5) regardless of sentiment or tone.
Why It Matters: Conflict gets amplified not because X wants it, but because the algorithm is blind to it. This is a design limitation, not malicious intent. The code has no sentiment analysis, no toxicity detection in the scoring model—just raw engagement counts.
Consequence: Controversial takes (50 angry replies) score higher than helpful explanations (50 supportive replies) despite identical engagement volume.
Code: No sentiment analysis anywhere in ML scoring pipeline (NaviModelScorer.scala, HomeGlobalParams.scala)
Explore: Engagement Calculator →
📊 Multiplicative Scoring = Mathematical Echo Chambers
The Finding: Tweet scores use multiplication, not addition:
score = baseScore × clusterInterest
This single design choice means any imbalance compounds over time.
Why It Matters: Echo chambers aren't a bug—they're mathematical inevitability. If you're 60% interested in AI and 40% in cooking, multiplicative scoring gives AI tweets a permanent 50% scoring advantage. This advantage means you see more AI → engage more with AI → interest increases → advantage grows.
Example:
AI tweet (quality 0.9): 0.9 × 0.60 = 0.54
Cooking tweet (quality 0.9): 0.9 × 0.40 = 0.36
Same quality, 50% score difference!
Consequence: The algorithm concentrates your interests over time through reinforcement loops. Balanced interests are unstable—any imbalance (even 51/49) drifts toward concentration.
Code: ApproximateCosineSimilarity.scala:94 → score * sourceClusterScore
Explore: Invisible Filter → | Reinforcement Loop →
👑 Verified Accounts Get 100x Multiplier
The Finding: Verified status = 100x reputation boost in the TweepcredGraph system.
if (isVerified) 100
else { /* calculate based on followers, PageRank, etc. */ }
Why It Matters: This isn't just a badge—it's a massive algorithmic advantage. Combined with other structural benefits (follower count, PageRank, follow ratio scoring), large verified accounts have a 348:1 reach advantage over small accounts posting identical content.
Consequence: The platform has algorithmic aristocracy built into its architecture. Not all accounts are treated equally—some start with order-of-magnitude advantages.
Code: UserMass.scala:40-41
Explore: Algorithmic Aristocracy →
☢️ "Not Interested" is Nuclear
The Finding: A single "not interested" click triggers:
- 0.2x multiplier (80% penalty immediately)
- 140-day linear recovery (penalty slowly fades over 5 months)
- Author-level effect (affects ALL tweets from that author)
Day 0: 0.2x multiplier (nearly invisible)
Day 70: 0.6x multiplier (still suppressed)
Day 140: 1.0x multiplier (penalty expires)
Why It Matters: This is your most powerful tool as a user. One click removes an author from your feed for 5 months. This is personal to you and doesn't aggregate globally.
Note: Content that the ML model predicts will receive negative feedback (based on historical patterns) gets penalized globally with -74.0 weight. Reports have an even more severe predicted penalty (-369.0 weight).
Code: FeedbackFatigueScorer.scala:38 → val DurationForDiscounting = 140.days
Explore: Engagement Calculator →
Other Notable Code-Backed Findings
⏰ Weekly Batch Updates
Your InterestedIn profile (which clusters you belong to) updates every 7 days via batch job, not real-time. Your feed is stuck with a week-old view of your interests.
Code: InterestedInFromKnownFor.scala:59 → Days(7)
🚧 Out-of-Network Penalty
Tweets from people you don't follow get a 0.75x multiplier (25% score reduction). Breaking out of your network requires 33% more engagement to compete.
Code: RescoringFactorProvider.scala:45-57
📝 Author Diversity Decay
Multiple tweets from same author get exponential penalty: 1st tweet (100%), 2nd tweet (62.5%), 3rd tweet (43.75%). Posting more = severe diminishing returns.
Code: AuthorBasedListwiseRescoringProvider.scala:54
🥶 TwHIN Cold Start Problem
Tweets need ≥16 engagements to get TwHIN embeddings (used for recommendations). Below threshold = zero-out. Small accounts locked out of this candidate source.
Code: TwhinEmbeddingsStore.scala:48
🗺️ Sparse Cluster Assignment
~145,000 total clusters exist, but you're only assigned to 10-20 of them (default). Highly sparse representation of your interests.
Code: InterestedInFromKnownFor.scala:148 → maxClustersPerUser = 20
Interactive Explorations
Experience how the algorithm works through interactive demos. Each one lets you experiment with the actual mechanics found in the code.
Understanding The Pipeline
🔍 Pipeline Explorer
Follow a tweet through all 5 algorithmic stages from posting to your timeline. See exactly what happens at each stage with real score calculations, filters, and penalties.
🧮 Engagement Calculator
Calculate tweet scores yourself. Adjust engagement probabilities and see how replies (13.5 weight) vastly outweigh likes (0.5 weight).
Understanding Your Algorithmic Identity
🗺️ Cluster Explorer
Discover which of ~145,000 algorithmic communities you belong to based on your follows and engagement. See how X groups users into interest clusters.
🎭 Algorithmic Identity Builder
Understand your dual algorithmic profiles: InterestedIn (consumer) vs Producer Embeddings (creator). See how clusters + engagement create your personalized identity (updates weekly!).
Understanding Filter Bubbles & Echo Chambers
🚀 Journey Simulator
Model how your interests might drift over time based on multiplicative scoring mechanics. See the reinforcement loop in action.
👥 Invisible Filter Demo
See how you and a friend see completely different rankings for the same tweets. Multiplicative scoring creates personalized realities.
🔁 Reinforcement Loop Visualizer
Step through the feedback loop week by week. Watch how seeing more AI content → engaging more → seeing even more creates drift through multiplicative mechanics.
Understanding Structural Advantages
👑 Algorithmic Aristocracy
Explore how follower count creates different algorithmic rules. Verified accounts get 100x multipliers, small accounts hit hard barriers. See the four mechanisms that multiply together for 348:1 advantage.
Understanding Next-Generation Systems
🔮 Phoenix: Behavioral Prediction (Likely Active)
X's next-generation transformer-based system models your last 522 actions (hours to days of behavior) to predict what you'll do next. Evidence suggests active A/B testing: 9-cluster deployment with parallel evaluation, progressive rollout infrastructure, and hybrid mode for incremental migration. This represents a paradigm shift from static features to behavioral sequences.
Our Approach
Objective Evidence: Every claim backed by:
- File path - Exact location in codebase
- Line numbers - Specific implementation
- Code snippets - What it actually does
- Explanation - How the mechanism works
- Consequences - What it means for users and creators
Verifiable: The algorithm is open source. You can check our work.
Interactive: We built simulators and calculators so you can experience the mechanics hands-on, not just read about them.
Who This Is For
- Users wondering why their feed looks the way it does
- Creators optimizing for reach and engagement
- Researchers studying recommendation algorithms and their societal effects
- Policy makers understanding algorithmic amplification
- Anyone curious about how algorithmic systems shape online discourse
About This Investigation
This analysis was conducted by reading X's open-source algorithm code (released March 2023). All findings are based on the actual implementation, not speculation or reverse engineering.
Repository: github.com/twitter/the-algorithm
Methodology: We read thousands of lines of Scala, traced data flows through pipelines, examined ML model configurations, and documented every mechanism with file paths and line numbers. Our research notes contain detailed analysis with step-by-step code walkthroughs.
Last Updated: November 2025
Key Insight: The algorithm is not neutral. It is designed for engagement, not for truth, diversity, or societal health. Understanding how it works is the first step to using it consciously rather than being shaped by it.