Ranking at Facebook scale
Facebook’s News Feed must decide, for each of more than two billion users, which of the often more than 1,000 new posts available per day deserves the most prominent position. Ranking exists because an unranked feed would bury the content users care about under frequent or promotional posts. Machine learning models predict which content will create value for each individual, so the feed can be ordered accordingly.
The ranking problem is an optimization problem: define what “value” means for a user, then maximize it. Take a hypothetical user, Juan. A friend Wei has posted a photo, another friend Saanvi has shared a running video, a favored Page has shared an article, and a cooking Group has posted new recipes. Each of these items has attributes, such as post type, author–viewer relationship, and recency. For a given post i shown to viewer j at time t, the system predicts an outcome Yijt — for example, the probability that Juan will like the post. These predictions feed a ranking score Vijt.
Liking is only one signal of value. Juan may share articles, comment on friends’ posts, or watch videos from game streamers. The system therefore predicts multiple outcomes per post, not just one, and must combine them into a single score. Facebook surveys people about how meaningful an interaction was to calibrate which outcomes matter most across the ecosystem.
Architecture of the ranking system
Implementing this optimization in production requires scoring in real time. The system comprises a Web/PHP layer that queries a feed aggregator. The aggregator gathers candidate posts, extracts features, runs prediction models, and computes the final ranking score for every post. A second component handles the heavy computation by running models over candidate stories in parallel across many machines called predictors.

From candidates to a ranked feed
The aggregator’s job can be broken down as follows:
- Inventory collection — All non-deleted posts shared with Juan by friends, Groups, or Pages since his last login are eligible. Unread-bumping logic also re-ranks posts from earlier sessions that Juan never saw. If an already-seen post sparks an ongoing conversation among Juan’s friends, it can be re-introduced via comment-bumping logic.
- Per-post prediction — Each candidate is scored using multitask neural networks. Features include post type, embeddings, and the viewer’s interaction history. These models run in parallel across predictors to handle the volume of candidates and users.
- Scoring and final ranking — Every post receives a final score Vijt that combines the individual action predictions. The computation happens in passes to stay efficient and to inject contextual rules.
Before ranking, integrity processes run on every application. They determine which content-quality checks, if any, apply to the stories under consideration. During pass 0, a lightweight model selects approximately 500 most relevant posts, preserving good recall while limiting expensive deep-learning inference to a workable subset. Pass 1 is the main scoring run: each remaining story is scored independently and ordered. Pass 2 applies contextual adjustments such as diversity rules, preventing the feed from showing multiple videos in a row.
The personalization within pass 1 is mostly about how to combine the multiple outcome predictions into one scalar. The system weights the various predictions linearly:
Vijt = wijt1Yijt1 + wijt2Yijt2 + … + wijtkYijtk.
This formulation has an intrinsic advantage: outcomes a user almost never performs (like predictions close to zero) automatically contribute little to the final ranking, regardless of their assigned weight. Work on personalizing these weights based on observational data is ongoing, requiring careful control for confounding variables before correlational relationships are used to adjust scoring.



