How Facebook’s Feed Algorithm Works: Ranking, Machine Learning, Signals, and Equations Explained

Introduction

When someone opens Facebook, they do not see every available post in pure chronological order. They also do not simply see the posts with the most likes. What appears in the Feed goes through a ranking system: a system that analyzes candidate posts, calculates probabilities, assigns scores, and decides which content should appear first.

This system is based on machine learning and works with thousands of signals related to the user, the content, the author of the post, and the context in which the person opens the app.

To understand it clearly, we need to explain it in a simple way, but with a technical layer: we will look at signals, predictions, scoring, embeddings, ranking stages, and how the Feed can be represented using equations.

The central idea is this:

The Feed does not simply show “the most recent content.”
The Feed tries to show “the most relevant content for a specific person at a specific moment.”

What Problem Does the Feed Algorithm Try to Solve?

Facebook has a massive problem: every user may have hundreds or thousands of potential posts to see. These posts can come from friends, pages, groups, videos, links, photos, active conversations, or content the user did not see in previous sessions.

If Facebook showed everything in chronological order, users could miss important content from close friends, see too many repetitive posts, or receive content that is not relevant to them.

That is why ranking exists.

Ranking tries to answer this question:

Which post has the highest probability of creating value for this user?

That value can come from different actions:

Like
Comment
Share
Video view
Meaningful conversation
Consumption time
Topic interest
Perceived quality
Relationship with the author

But there can also be negative signals:

Hiding the post
Reporting the content
Ignoring the post
Scrolling past quickly
Repetitive content
Low quality
Spam signals

This is why the algorithm cannot be reduced to “more likes = more reach.” The system tries to estimate a more complete expected value for each post.

Basic Concepts for Understanding Feed Ranking

Before moving into equations, we need to define a few concepts.

User

The person who opens Facebook.

In mathematical notation, we can represent the user as:

j = user

Candidate Post

Each post that could potentially appear in the user’s Feed.

i = candidate post

Time or Session Context

Ranking does not happen in a vacuum. Timing matters: when the user opens the app, what they just did, which posts are recent, and which content is currently active.

t = moment when the user opens Facebook

Signals or Features

Signals are data points the model uses to make predictions.

X_ijt = set of signals for post i, user j, at time t

Examples of signals include:

Post type
Post age
Relationship between user and author
Recent interactions
User consumption history
Probability of watching a video
Probability of commenting
Topics of interest
Content quality
Integrity signals

Prediction

The model attempts to predict whether the user will perform a certain action.

Y_ijt = predicted value or expected action

For example:

Y_like = probability that the user will like the post
Y_comment = probability that the user will comment
Y_share = probability that the user will share
Y_watch = probability that the user will watch the video
Y_hide = probability that the user will hide the content

Final Value or Score

After calculating several predictions, the system needs to combine them into a final score.

V_ijt = final value of post i for user j at time t

That final value helps determine the order of the Feed.

The First Formula: Representing a Post with Signals

A post is not evaluated only by its text, image, or number of likes. It is evaluated as a set of characteristics.

We can represent it like this:

X_ijt = [x_ijt1, x_ijt2, x_ijt3, ..., x_ijtC]

Where:

X_ijt = vector of signals
x_ijt1 = first signal
x_ijt2 = second signal
x_ijt3 = third signal
C = total number of available signals

Applied example:

x_ijt1 = content type: video
x_ijt2 = age: 2 hours
x_ijt3 = user-author relationship: high
x_ijt4 = recent comments: 37
x_ijt5 = user usually watches similar videos: yes
x_ijt6 = topic: regional music
x_ijt7 = estimated quality: high

In digital marketing, this matters because every post generates signals. You are not only competing with creativity; you are also competing with behavioral data.

Basic Prediction of an Action

The system can use signals to predict an action.

The general form would be:

Y_ijt = f(X_ijt)

This means:

Prediction Y depends on a function applied to signals X.

For example, to predict whether the user will like a post:

Y_like = P(like = 1 | X_ijt)

This reads as:

The probability that the user will like the post, given the set of signals for that post.

To predict a comment:

Y_comment = P(comment = 1 | X_ijt)

To predict a share:

Y_share = P(share = 1 | X_ijt)

To predict a view:

Y_watch = P(watch = 1 | X_ijt)

To predict rejection:

Y_hide = P(hide = 1 | X_ijt)

Here we begin to see something important: the algorithm does not think in terms of a single metric. It thinks in terms of many probabilities at the same time.

Example with Logistic Regression

A classic way to convert signals into probability is to use a sigmoid function, commonly used in classification models.

P(y = 1 | X) = 1 / (1 + e^-(w·X + b))

Where:

P(y = 1 | X) = probability that the action occurs
X = vector of signals
w = model weights
b = bias
e = mathematical constant
w·X = weighted combination of signals

In simple terms:

The model takes many signals, assigns weights to them, combines them, and transforms the result into a probability between 0 and 1.

Example:

P(comment = 1 | X) = 0.68

This means:

The model estimates a 68% probability that this user will comment on this post.

It does not mean the user will definitely comment. It means that, based on historical and contextual signals, the estimated probability is high.

The Feed Uses Multiple Objectives

A common mistake is thinking that Facebook only tries to maximize likes.

In reality, the system can consider multiple objectives:

Y_like
Y_comment
Y_share
Y_watch
Y_meaningful
Y_hide
Y_report
Y_skip

Each objective represents a different prediction.

For example:

Y_like = 0.40
Y_comment = 0.15
Y_share = 0.08
Y_watch = 0.75
Y_hide = 0.04

This post may not have a very high probability of generating comments, but it has a high probability of being watched. Therefore, it may be relevant for a user who consumes a lot of video content.

Another post may have fewer likes but a higher probability of generating meaningful conversation. For certain users, that post may have more value than a visually attractive but superficial post.

Content Value Function

After calculating several predictions, the system needs to convert them into a single score.

A simplified way to represent this is:

V_ijt = w1Y_like + w2Y_comment + w3Y_share + w4Y_watch - w5Y_hide

Where:

V_ijt = final value of the post
w1, w2, w3, w4, w5 = weights assigned to each prediction
Y_like = probability of a like
Y_comment = probability of a comment
Y_share = probability of a share
Y_watch = probability of watching the content
Y_hide = probability of hiding it

A more general version would be:

V_ijt = Σ w_ijtk · Y_ijtk

This reads as:

The final value of a post is the weighted sum of multiple predictions.

Where:

k = each possible action type
w_ijtk = weight assigned to that action
Y_ijtk = estimated probability of that action

This formula is key to understanding ranking: it is not about one isolated metric, but about a combination of probabilities.

Numerical Example

Suppose Facebook evaluates a post for a specific user.

Predictions:

P(like) = 0.40
P(comment) = 0.20
P(share) = 0.10
P(watch) = 0.75
P(hide) = 0.05

Hypothetical weights:

w_like = 1
w_comment = 3
w_share = 4
w_watch = 2
w_hide = 5

Calculation:

V = (1)(0.40) + (3)(0.20) + (4)(0.10) + (2)(0.75) - (5)(0.05)

Result:

V = 0.40 + 0.60 + 0.40 + 1.50 - 0.25
V = 2.65

That 2.65 would be an estimated value score for that post.

If there are several candidate posts, each one receives its own score.

Post A: V = 2.65
Post B: V = 1.40
Post C: V = 3.10
Post D: V = 0.80
Post E: V = 2.20

Initial ranking:

1. Post C
2. Post A
3. Post E
4. Post B
5. Post D

However, this is not always the final result. Additional rules for diversity, integrity, freshness, and context may be applied afterward.

Inventory: The First Step of Ranking

Before calculating scores, the system needs to gather candidate posts.

This is called inventory.

The inventory may include:

New posts from friends
Group posts
Posts from followed pages
Unseen posts from previous sessions
Older posts with recent conversation
Content that becomes relevant again because of new comments

In pseudocode:

def get_inventory(user):
posts = []

posts += get_friend_posts(user)
posts += get_group_posts(user)
posts += get_page_posts(user)
posts += get_unseen_posts(user)
posts += get_posts_with_recent_conversation(user)

return posts

The idea is simple:

First, gather the possible content.
Then, calculate how valuable it may be for the user.
Finally, rank it.

Scoring: Calculating the Score of Each Post

Once the inventory is collected, the system calculates signals and predictions.

Simplified pseudocode:

def extract_features(post, user, context):
features = {
"post_type": post.type,
"post_age": calculate_age(post.date),
"author_relationship": measure_relationship(user, post.author),
"recent_interactions": count_interactions(post),
"topic_affinity": measure_affinity(user, post.topic),
"format_history": measure_format_consumption(user, post.type),
"quality": estimate_quality(post),
}

return features

Then predictions are calculated:

def predict_actions(features):
y_like = like_model.predict(features)
y_comment = comment_model.predict(features)
y_share = share_model.predict(features)
y_watch = watch_model.predict(features)
y_hide = hide_model.predict(features)

return {
"like": y_like,
"comment": y_comment,
"share": y_share,
"watch": y_watch,
"hide": y_hide,
}

Then the score is calculated:

def calculate_score(predictions):
score = (
1.0 * predictions["like"] +
3.0 * predictions["comment"] +
4.0 * predictions["share"] +
2.0 * predictions["watch"] -
5.0 * predictions["hide"]
)

return score

Complete Feed Algorithm

A didactic version of the Feed ranking process would be:

Algorithm: Feed Ranking

Input:
User j
Time t
Set of candidate posts I

Step 1:
Collect eligible posts for the user.

Step 2:
For each post i in I:
Extract signals X_ijt.

Step 3:
For each post i:
Predict multiple actions:
Y_like
Y_comment
Y_share
Y_watch
Y_hide
Y_meaningful

Step 4:
Calculate final value:
V_ijt = Σ w_ijtk · Y_ijtk

Step 5:
Sort posts by V_ijt from highest to lowest.

Step 6:
Apply integrity, diversity, freshness, and context rules.

Step 7:
Show the final Feed to the user.

In simplified Python:

def rank_feed(user, context):
inventory = get_inventory(user)
results = []

for post in inventory:
features = extract_features(post, user, context)
predictions = predict_actions(features)
score = calculate_score(predictions)

results.append({
"post": post,
"score": score,
"predictions": predictions
})

initial_ranking = sorted(
results,
key=lambda item: item["score"],
reverse=True
)

final_feed = apply_contextual_rules(initial_ranking, user, context)

return final_feed

This code is not Facebook’s real system, but it represents the conceptual logic of ranking: inventory, signals, predictions, score, sorting, and final adjustments.

Ranking in Stages: Why Everything Is Not Calculated at Once

At massive scale, it is not efficient to apply heavy models to every possible post from the beginning.

That is why recommendation systems usually work in stages.

A simplified structure would be:

Total inventory
Light filtering
Main ranking
Contextual re-ranking
Final Feed

It can also be represented like this:

I_total → I_500 → Score(V_ijt) → Diversity/Integrity → Ordered Feed

Where:

I_total = initial set of candidate posts
I_500 = reduced subset of promising posts
V_ijt = estimated value score
Ordered Feed = final result seen by the user

This makes the system more efficient. First, it reduces the universe of posts. Then, it applies more complex models to a smaller group of candidates.

Multitask Learning: Several Objectives at the Same Time

The Feed does not need to predict only one action. It needs to predict many.

In machine learning, when a model learns several related objectives at the same time, this is called multitask learning.

In this context, the model may try to predict:

P(like | X)
P(comment | X)
P(share | X)
P(watch | X)
P(hide | X)
P(report | X)
P(meaningful | X)

A way to represent this would be:

Model(X) → [Y_like, Y_comment, Y_share, Y_watch, Y_hide]

Instead of having only one output, the model can generate multiple outputs.

This is useful because actions are related. A post that generates comments may also generate shares. A video that achieves high retention may have a higher probability of later interaction. A post that looks like spam may increase the probability of being hidden or reported.

Embeddings: Turning Users and Content into Numbers

One of the most interesting concepts in modern ranking is embeddings.

An embedding is a numerical representation of something complex.

For example, the system can create numerical representations for:

Users
Posts
Topics
Pages
Groups
Authors
Content formats
Interests

Instead of saying:

This user likes regional music, live videos, local events, and entertainment content.

The system can represent that as a vector:

user_j = [0.12, 0.87, 0.34, 0.91, 0.05, ...]

A post can also be represented as a vector:

post_i = [0.10, 0.82, 0.40, 0.88, 0.08, ...]

Then the system can compare how similar they are:

similarity(user_j, post_i) = user_j · post_i

The dot product helps estimate the closeness between the user’s interests and the characteristics of the content.

In organic marketing, this has a strong implication: thematic consistency helps a platform understand who your content may be relevant to.

If a page publishes random content without a clear editorial line, it may generate confusing signals. If it publishes consistent, useful, and recognizable content, the system can better associate it with specific audiences.

Feed Diversity

Even if a post has a strong score, the final Feed is not necessarily ordered only by raw score.

Diversity rules may also be applied.

For example:

Avoid showing too many videos in a row.
Avoid showing too many posts from the same author.
Avoid repetitive content.
Mix formats.
Mix sources.
Consider freshness and context.

A simplified re-ranking function could look like this:

FinalScore = V_ijt + DiversityBonus - RepetitionPenalty - IntegrityPenalty

Where:

V_ijt = main content value
DiversityBonus = positive adjustment for diversity
RepetitionPenalty = penalty for repetition
IntegrityPenalty = penalty for problematic signals

Example:

Post A:
V_ijt = 2.80
DiversityBonus = 0.20
RepetitionPenalty = 0.00
IntegrityPenalty = 0.10

FinalScore = 2.80 + 0.20 - 0.00 - 0.10
FinalScore = 2.90

This helps prevent the Feed from becoming a mechanical list and creates a more balanced user experience.

Positive and Negative Signals for Organic Marketing

For a page, creator, or brand, understanding these signals is essential.

Positive signals:

High P(comment)
High P(share)
High P(watch_time)
High P(completion_rate)
High P(meaningful_interaction)
High P(return_visit)
Strong relationship with the audience
Original content
Clear topic
Good visual experience

Negative signals:

High P(hide)
High P(report)
High P(skip)
Repetitive content
Clickbait
Engagement bait
Low visual quality
Overly promotional posts
Content with low relevance for the audience

This means publishing more is not enough. A brand must produce content that generates real value signals.

The strategic question should not be:

How many posts are we going to publish this week?

It should be:

Which post has the highest probability of generating attention, conversation, retention, or usefulness for our audience?

Why Organic Reach Is Not the Same for Everyone

Two people can follow the same page and still see different posts.

This happens because each user has a different history:

They interact with different people.
They consume different formats.
They have different interests.
They open Facebook at different times.
They watch videos for different lengths of time.
They comment on certain topics and avoid others.
They have different relationships with pages, groups, and friends.

That is why organic reach is personalized.

A post does not have one universal value. It has a different value for each user.

Mathematically:

V_i is not the same for everyone.
V_ijt changes depending on user j and time t.

In other words:

The same post can have high value for one user and low value for another.

Practical Application: Creating Content with Ranking in Mind

If we apply this logic to digital marketing, we can build a more intelligent methodology.

1. Design Content for a Specific Action

Before publishing, define which signal you want to strengthen.

Examples:

Educational post → comments and saves
Short video → retention and complete views
Success case → shares and trust
Well-designed question → meaningful conversation
Emotional content → reactions and comments
Useful content → shares and returning audience

Every content piece should have an algorithmic intention.

2. Improve the Relationship with the Audience

The algorithm considers the historical relationship between the user and the source.

That is why it is useful to build interaction habits:

Reply to comments
Publish recognizable content
Maintain thematic consistency
Use formats the audience already consumes
Create content series
Generate real conversation

3. Avoid Low-Quality Signals

Content that looks like spam, clickbait, or excessive promotion can lose distribution.

Avoid:

Misleading headlines
Repeated posts
Content without context
Low-quality images
Generic text
Excessive promotions
Engagement bait

Example of engagement bait:

Comment “yes” if you agree.
Like this if you want more.
Share this so it does not happen to you.

This may generate superficial activity, but not necessarily real value.

4. Measure Beyond Likes

Likes are only one part of the system.

More useful metrics for understanding organic distribution include:

Comments per reach
Shares per reach
Video retention
Average watch time
Complete views
Clicks
Messages received
Saves
Engagement rate
Interaction frequency per user
Growth of recurring audience

A post with fewer likes but more shares and higher-quality comments can have more strategic value than a post with many superficial likes.

Conceptual Model for Marketers

We can summarize organic ranking with a didactic formula:

OrganicFeedScore =
P(engagement)
+ P(long_view)
+ P(meaningful_interaction)
+ relationship_score
+ topic_match
+ quality_score
+ freshness_score
- P(hide)
- P(report)
- repetition_penalty
- low_quality_penalty

In plain language:

The organic score depends on the probability of interaction, consumption, relevance, relationship, and quality, minus rejection or low-quality signals.

For a brand, the mission is to increase positive variables and reduce negative ones.

Example Applied to a Music Page

Suppose a regional music band publishes three pieces of content:

Post A: Event flyer
Post B: 20-second live video
Post C: Generic promotional image

Hypothetical predictions:

Post A:
P(comment) = 0.08
P(share) = 0.12
P(watch) = 0.00
P(hide) = 0.04

Post B:
P(comment) = 0.18
P(share) = 0.20
P(watch) = 0.78
P(hide) = 0.02

Post C:
P(comment) = 0.04
P(share) = 0.03
P(watch) = 0.00
P(hide) = 0.08

Post B is likely to receive better distribution because it generates stronger consumption and interaction signals.

This explains why live videos, authentic moments, emotional clips, and content with strong retention often perform better than generic images.

Conclusion

Facebook’s Feed algorithm is not a simple formula or a static rule. It is a machine learning ranking system that tries to order posts according to the expected value for each user.

To do this, the system collects inventory, extracts signals, predicts multiple actions, calculates a final score, ranks posts, and applies additional rules related to diversity, integrity, and context.

The core idea can be summarized like this:

V_ijt = Σ w_ijtk · Y_ijtk

Meaning:

The value of a post for a user at a specific moment depends on the weighted sum of several predictions.

For organic marketing, this changes the way we work. It is not only about publishing more. It is about creating content that increases the probability of real interaction, retention, conversation, usefulness, and relationship with the audience.

The content that wins distribution is not necessarily the newest or the most promotional. It is the content the system estimates to be more valuable for a specific person in a specific context.

That is why a professional organic strategy should think like a ranking system:

Right audience
Relevant content
Appropriate format
Positive signals
Consistent quality
Deep measurement
Continuous optimization

Understanding the algorithm does not mean looking for tricks. It means designing content with intention, data, and real value.