Skip to main content
Open Source & Social Graph 8 min readPublished October 30, 2026By Shiva Vinodkumar

Decoding the X (Twitter) Algorithm: Heavy Ranker Mechanics, Open Source Code & Creator Ad Revenue Sharing

When X open-sourced its recommendation algorithm on GitHub, engineers gained an unprecedented view into how hundreds of millions of posts are filtered, ranked, and served every second. Here is the architectural breakdown and the math behind creator payouts.

Share:

1. The 1,500-Candidate Pipeline: How "For You" is Generated

Every time a user pulls to refresh their "For You" timeline on X, a distributed recommendation pipeline extracts 1,500 candidate tweets from a pool of hundreds of millions of active posts:

The 50/50 Pipeline Split

  • In-Network Candidates (~50%): Tweets authored by accounts the user already follows. These are fetched from an in-memory graph database named Search Index (Earlybird).
  • Out-of-Network Candidates (~50%): Tweets from authors the user does not follow. These are discovered via two algorithmic mechanisms: GraphJet (real-time bipartite graph of user-tweet engagements) and SimClusters (community matrix factorization).

2. SimClusters: Matrix Factorization & Communities

X groups users into approximately 145,000 distinct thematic clusters (e.g. "Rust Systems Programmers", "AI Researchers", "Indie Hackers") refreshed every two weeks using Matrix Factorization on the user-follow graph.

If three influential accounts in your cluster like or retweet a post, that post receives a massive out-of-network recommendation boost into your timeline, even if the author has only 200 followers.

3. The Heavy Ranker: The Scoring Multipliers

Once the 1,500 candidate tweets are assembled, they pass through the Heavy Ranker—a ~48-million parameter masked neural network that scores each candidate across discrete predicted user actions:

Predicted InteractionAlgorithmic WeightImpact on Reach
Reply + Author Reply Back+75.0xThe highest positive multiplier. A conversation where the creator responds back signals deep authentic community.
Standard Retweet+20.0xHigh viral broadcast signal.
Standard Reply+13.5xSpurs downstream engagement.
Standard Like+0.5x – +1.0xBaseline positive confirmation.
Mute, Block, or Report-369.0xDevastating negative signal. A single block or report cancels dozens of positive likes.
External Link Without EngagementDemoted (~50% decay)X demotes posts that seek to pull users off the platform unless compensated by high reply velocity.

4. The Creator Ad Revenue Sharing Program: Eligibility & Payouts

X shares ad revenue generated from advertisements shown in the replies to an author's posts. To qualify for payouts:

Qualification Requirements

  • ✓ Active subscription to X Premium or Verified Organizations.
  • ✓ At least 5 million organic impressions on posts cumulative over the preceding 3 months.
  • ✓ At least 500 verified followers.
  • ✓ A verified Stripe Connect account linked to your profile for direct bank wire deposits.

How Payouts are Calculated

Only impressions from verified X Premium users who view ads in your post reply thread count toward your ad revenue pool. Raw bot traffic or anonymous views generate $0. This ensures high payouts for creators with genuine professional audiences.

5. The 4 Golden Rules for Engineering Growth on X

1

Engage in Your Own Replies

Because an author replying back carries a +75x multiplier, spending 30 minutes responding thoughtfully to every comment on your post triggers a second wave of algorithmic distribution.

2

Never Put Raw Links in the Main Tweet

To avoid the external link penalty, place your primary thesis or summary in the main post, and add the outbound article link in the first reply or quote tweet.

3

Write Within a Tight SimCluster

Avoid tweeting about five unrelated topics in a single day. The more consistent your vocabulary and interactions are within your technical domain, the higher your topic authority score.

GraphJet In-Memory Graph Processing & SimClusters Community Detection

The X (formerly Twitter) "For You" recommendation feed relies on real-time graph exploration algorithms to surface engaging content from outside a user's explicit follow graph. At the core of candidate generation is GraphJet, a custom high-performance in-memory graph processing engine written in C++ and Java.

GraphJet maintains a rolling dynamic bipartite graph of user interactions (likes, retweets, replies) across the preceding 48 hours. By utilizing SimClusters—an unsupervised community detection algorithm based on matrix factorization—the platform partitions the global user graph into tens of thousands of dynamic topic communities.

When a tweet achieves breakout engagement within a specific community cluster, it is immediately nominated as a candidate for all users exhibiting strong semantic affinity to that community, driving viral organic discovery across the network.

The Heavy Ranker Neural Network & Multi-Action Loss Functions

Once thousands of candidate tweets are retrieved, they pass into the Heavy Ranker—a deep neural network with hundreds of millions of parameters. The Heavy Ranker predicts the probability of multiple distinct engagement actions simultaneously: P(Like), P(Retweet), P(Reply), P(Video Watch > 2 min), and P(Negative Feedback).

These predicted probabilities are combined using a weighted utility equation. High positive weighting is assigned to meaningful interactions (such as quote tweets and bookmark saves), while negative interactions incur heavy multiplicative penalties, shaping global timeline visibility in real time.

GraphJet In-Memory Graph Processing & Real-Time Interaction Edges

At the heart of the X candidate retrieval architecture lies GraphJet, an ultra-high-throughput in-memory bipartite graph processing engine. GraphJet maintains a rolling dynamic memory buffer of real-time interactions—retweets, replies, favorites, and user clicks—spanning the entire active global user base over the most recent 48-hour window.

Unlike disk-bound graph databases, GraphJet is engineered to handle millions of graph edge mutations per second with single-digit millisecond query latencies. When a user opens their "For You" feed, the engine traverses the bipartite graph to identify candidate tweets that have received intense engagement from accounts within the user's immediate interest clusters. By computing interaction edge weights with exponential time-decay half-lives, GraphJet ensures that breaking news, viral technical insights, and emerging developer discussions surface in user timelines within seconds of publication.

Multi-Task Loss Formulations & Real-Time Bandit Exploration

Once hundreds of candidate tweets are retrieved from GraphJet and SimClusters embedding spaces, they pass into the Heavy Ranker—a deep neural network that evaluates candidate relevance across multiple simultaneous objectives. Rather than predicting a single generic engagement score, the Heavy Ranker employs a multi-task learning architecture with independent output heads predicting distinct user actions such as favorites, retweets, replies, video dwell time, and negative feedback.

These predicted probabilities are combined using a weighted linear combination where positive behaviors are rewarded and negative actions (such as "Show less often", block, or report) are penalized with severe negative multipliers. Furthermore, to prevent the feed from becoming a stale echo chamber and to allow new creators to break through, the ranking engine incorporates contextual multi-armed bandit exploration algorithms, allocating a controlled percentage of feed impressions to untested high-quality candidates to evaluate user response trajectories.

Media Encoding & Dwell-Time Optimization Signals

The ranking algorithm places substantial weight on video and image dwell time as an indicator of genuine content value. Posts containing native media are evaluated by dedicated computer vision and optical text models. Videos that maintain viewer retention past the 15-second mark receive significant scoring multipliers, signaling that the content successfully engaged user attention rather than merely prompting a fleeting scroll-by.

SimClusters Community Detection & Topic Affinity Graphs

SimClusters decomposes the global X interaction graph into thousands of interest-based community clusters using matrix factorization and overlapping community detection algorithms. Each user and tweet is projected into a sparse vector representing affinity scores across identified clusters (such as TypeScript Developers, AI Researchers, or Distributed Systems Engineers). Tweets that achieve breakout engagement within a specific cluster are rapidly promoted across other users sharing similar topological affinities.

When a creator establishes high authority within a specific SimCluster (for example, achieving high positive engagement from senior software engineers), their subsequent technical threads receive preferential nomination in candidate generation pipelines, ensuring that specialized, high-depth insights reliably reach relevant professional audiences without relying on generic clickbait tactics.

Additionally, thread formatting plays a critical algorithmic role: when an initial post generates multiple replies from the original author that spark substantive conversational comment branches, the algorithm boosts the root post's viral distribution, classifying it as a high-authority educational asset.

Authored by Shiva Vinodkumar, Founder of HelloAIHub. For in-depth software architectural tutorials, visit our Engineering Blog or study our Developer Guides.

SimClusters Community Graph Embeddings & Dynamic Feed Equilibrium

At the heart of the X (formerly Twitter) recommendation system is SimClusters, an unsupervised graph-based community detection algorithm that groups users into thousands of dense interest clusters. SimClusters applies Metropolis-Hastings sampling to analyze the bipartite graph of user follows and favorite interactions. Each user and each tweet is projected into a sparse vector space of community affiliations, allowing the recommendation engine to surface highly relevant tweets from outside a user's direct social graph with sub-millisecond retrieval latency.

During the final heavy ranking phase, candidate tweets undergo multi-objective scoring where predicted user actions (like, retweet, reply, bookmark, and dwell time) are weighted by custom engagement multipliers. To prevent viral echo chambers from monopolizing user feeds, the ranking pipeline injects diversity filters that penalize consecutive posts from identical authors or overlapping SimCluster topics. This ensures an optimal balance between viral engagement and long-term user retention.

Real-Time Interaction Graph Streaming via Apache Kafka and Heron

Generating the real-time 'For You' algorithmic timeline on X requires ingesting and indexing hundreds of thousands of interaction events per second across global user populations. When users scroll, favorite, repost, quote, or expand media attachments, these discrete behavioral signals are published directly to distributed Apache Kafka clusters partitioned by user identifier. Stream processing topologies powered by Apache Heron consume these continuous event streams, updating in-memory graph models with sub-second write latencies.

The core engine maintaining this live interaction state is GraphJet -- a specialized multi-threaded in-memory bipartite graph processing framework. GraphJet maintains real-time edges connecting users to tweets, calculating dynamic engagement weights and co-interaction frequencies on the fly. Because user interest affinities shift dramatically during breaking news events, GraphJet applies exponential decay functions that prioritize recent engagements over historical preferences, ensuring that timelines reflect immediate conversational context.

To prevent streaming ingress queues from overflowing during monumental global events, stream processing nodes implement dynamic backpressure handling and priority-weighted event shedding. Low-signal background telemetries are sampled aggressively, guaranteeing that mission-critical engagement signals traverse ingestion pipelines without introducing lag into candidate generation stages.

Loss Function Dynamics and Engagement Value Weighting in the Heavy Ranker

Once candidate retrieval filters the global catalog down to approximately 1,500 candidate tweets, the Heavy Ranker neural network scores each candidate using multi-task prediction heads. Rather than predicting a single scalar probability, the Heavy Ranker calculates independent probabilities across diverse user behaviors: P(Favorite), P(Retweet), P(Reply), P(Video Watch > 50%), and crucially, P(Negative Report or Mute). The final ranking score is derived from a weighted linear combination of these predicted probabilities.

The mathematical coefficients assigned to specific actions reveal the underlying optimization philosophy of the platform. Positive conversational interactions -- such as replying to an author and receiving a follow-up response from that author -- are assigned massive positive weights (often 50x to 75x higher than a passive click or favorite). This structural incentive favors conversational depth and authentic community dialogue over superficial clickbait.

Conversely, negative feedback signals carry severe mathematical penalties. A single 'Report Tweet' or 'Block Author' probability carries a crushing negative weight capable of completely zeroing out accumulated positive engagement points. By applying non-linear penalty curves to abusive or deceptive content, the Heavy Ranker maintains feed quality while simultaneously rewarding high-value authoritative technical discourse.

Matrix Factorization on Follow-Engage Graphs: Uncovering Latent Interests

Beyond real-time event streaming, the X recommendation architecture relies on SimClusters -- an offline matrix factorization system that uncovers latent community interests across hundreds of millions of users. The algorithm constructs a massive sparse bipartite graph linking users to the accounts they follow and interact with regularly. Truncated singular value decomposition (SVD) and cosine similarity metrics factorize this graph into approximately 145,000 discrete community clusters.

Each user and tweet is assigned a sparse vector indicating membership across these community clusters. When an author publishes a tweet that receives high engagement from members of the 'Distributed Systems Engineering' SimCluster, the tweet's community affinity vector updates dynamically. The candidate generation pipeline then surfaces this content in the feeds of other users possessing strong affinities for that cluster, regardless of whether they follow the author directly.

Real-Time Feed Diversity Constraints and Anti-Echo Chamber Reranking

A naive ranking algorithm optimizing purely for predicted engagement probabilities inevitably produces repetitive feeds: if a user clicks on three consecutive posts regarding an emerging AI benchmark, the entire timeline collapses into redundant coverage of that single topic. To prevent user cognitive fatigue and mitigate ideological echo chambers, the post-ranking pipeline enforces strict diversity constraints.

The reranking engine utilizes Maximal Marginal Relevance (MMR) algorithms to penalize candidate tweets that exhibit high semantic similarity to items already positioned earlier in the candidate ranking list. Furthermore, author diversity rules guarantee that no individual creator occupies multiple consecutive slots in the primary feed. This balance between topical relevance and serendipitous discovery maintains long-term viewer engagement across the platform.

Neural Network Sparsity and Feature Embedding Quantization

Scoring thousands of candidate tweets for millions of concurrently active users within a sub-50ms latency SLA requires aggressive optimization of the Heavy Ranker neural network architecture. In its production configuration, the model evaluates hundreds of dense and sparse features: author historical engagement velocity, recipient topical affinity vectors, media format indicators, and contextual interaction graphs.

To prevent memory bandwidth saturation across GPU serving nodes, feature embeddings are quantized from standard 32-bit floating-point numbers into 8-bit integers (INT8) or sparse block-compressed representations. Dynamic pruning algorithms eliminate dormant weights with near-zero gradients, reducing memory consumption by over 60% without compromising ranking accuracy. High-throughput CUDA inference kernels execute tensor operations in parallel, allowing each inference server instance to score over 40,000 tweet-user pairs per second.

Furthermore, continuous feature caching stores precomputed author authority scores and static tweet metadata in distributed Redis caches, eliminating redundant calculation passes during high-concurrency request fan-outs.

Creator Ad Revenue Sharing Mechanics: Impression Filtering and Organic Reach

The Creator Ad Revenue Sharing program on X fundamentally altered creator monetization dynamics by distributing ad revenue generated from commercial impressions served within post reply threads. However, qualification and payout algorithms enforce rigorous fraud filtering to prevent programmatic manipulation.

Impressions are verified through cryptographic telemetry: an impression qualifies for revenue attribution only if the viewing account is an active X Premium subscriber, originates from an uncompromised IP address, and exhibits authentic dwell time above established reading velocity thresholds. Raw impression spikes generated by automated bots, engagement pods, or coordinated click farms are filtered out before auction proceeds are distributed.

Creators who foster genuine, long-tail technical conversations within their reply threads generate substantially higher qualified impression volumes than those who post sensational standalone content. By rewarding conversational depth and subscriber engagement density, the algorithmic monetization model incentivizes substantive intellectual exchange over superficial viral vanity.

Feedback Loop Stabilization and Mitigating Catastrophic Model Drift

A continuous real-time machine learning system operating at social media scale is perpetually vulnerable to catastrophic feedback loops: the model recommends content that users click on, which generates more training data favoring that content, causing the model to narrow its recommendations until feed diversity collapses. Left unchecked, this algorithmic feedback loop degrades long-term user satisfaction and increases platform churn.

X prevents algorithmic drift by introducing randomized epsilon-exploration policies into production ranking passes. A controlled percentage of candidate slots (typically 2% to 5%) are reserved for exploratory content that deviates intentionally from predicted user preference vectors. This exploratory traffic tests user receptivity to novel topics and authors, generating unbiased counterfactual training data that prevents the neural network from falling into local optimization traps.

Automated anomaly detection monitors feature drift and loss divergence continuously. If an algorithmic update inadvertently triggers severe engagement drop-offs or anomalous sentiment spikes, automated canary deployment systems rollback serving weights to stable baseline checkpoints within seconds, preserving feed stability across global user populations.

Real-Time Topic Affinity Vectors and Multi-Modal Embedding Alignment

As users navigate through their algorithmic feeds, the system maintains dynamic, streaming topic affinity vectors that evolve on a sub-minute cadence. When a user spends dwell time inspecting an embedded architectural schematic, opens an image attachment, or reads a technical code discussion, continuous vector projection algorithms adjust their affinity scores across hundreds of fine-grained technological concepts.

Multi-modal embedding models project both textual prose and visual artifacts into a unified mathematical space, allowing the Heavy Ranker to recognize substantive technical documentation even when the accompanying tweet text is concise. Tweets featuring high-signal visual diagrams paired with precise technical commentary receive elevated relevance multipliers across specialized engineering communities, maximizing distribution to targeted professional audiences.

Algorithmic Growth Playbook for Engineering Leaders on X

Engineering leaders seeking to build authoritative professional distribution on X must align their publishing strategies with the algorithmic preferences of the Heavy Ranker. Because the scoring model assigns monumental positive weight to authentic author-reader conversational interactions, creators must actively participate in their own reply sections, answering technical questions, debating architectural trade-offs, and expanding on subtle operational edge cases.

Publishing long-form technical posts with embedded high-resolution architectural schematics captures prolonged visual dwell time, sending unmistakable quality signals to the ranking engine. Avoiding sensational engagement bait prevents triggering negative report penalties, establishing a sustainable, compounding engine for professional reach and thought leadership.

Consistent, high-cadence publication schedules establish strong author reputation priors within the candidate generation pipeline, ensuring that new technical analyses receive immediate exploratory distribution across relevant subscriber graphs.

By combining rigorous technical substance, active conversational engagement, and high-quality visual scaffolding, engineering creators transform their presence on X into a durable engine for professional authority and industry influence.

Monitoring subscriber analytics and conversation graph depth provides actionable telemetry on which architectural topics resonate most deeply with industry practitioners, informing ongoing editorial planning and thought leadership initiatives.

In a crowded digital arena, unwavering commitment to technical accuracy and constructive dialogue remains the most dependable path to building authentic professional prestige.

Cross-pollinating technical insights across long-form blog publications, open-source repositories, and interactive X discussions creates a self-reinforcing knowledge ecosystem that expands engineering impact worldwide.

Through persistent craftsmanship and transparent peer debate, technical creators on X actively shape the future trajectory of global software engineering.

Structured code review breakdowns and failure post-mortem threads generate exceptional discussion velocity, turning complex technical lessons into viral masterclasses that elevate engineering standards across the industry.

By consistently delivering high-density, actionable architectural analysis, creators establish lasting professional credibility that compounds over years of continuous publishing.

Participating thoughtfully in community spaces and technical discussions cements an author's standing as a generous mentor and respected domain expert.

Share:
Up Next: Recommended Deep Dives

Continue Exploring Architecture Masterclasses