Sub topic 4
The Signals a Ranker Looks at
This chapter assumes you have read the earlier chapters on ranked feeds and candidate generation. You should be comfortable with probabilities as numbers between 0 and 1 and with short Python programs. By the end you should be able to name the inputs a ranking model receives, turn raw events into usable numbers, and spot the usual ways those inputs go wrong.
What a signal is
A signal is any piece of information the ranker can measure and use when scoring a post for a viewer. A feature is a signal after it has been turned into a number (or a category) that a model can consume. People often use the two words interchangeably. This chapter uses "signal" for the raw fact and "feature" for the model-ready value.
The ranker does not know what a post means or what you want. It sees a bundle of numbers for each viewer-post pair and predicts reactions from them. The later chapters on engagement prediction and score combination cover that step. The quality of those predictions is limited by the quality of the signals.
Four families of signals
Most feed systems group signals by what they describe: the viewer, the author, the post, or the situation.
| Family | Describes | Example signals |
|---|---|---|
| User (viewer) | The person who will see the feed | Topics they engage with, how often they open the app, average session length, language, device |
| Author | The account that wrote the post | Follower count, posting frequency, account age, historical engagement rate, past policy violations |
| Post | The content itself | Media type, text length, detected topics, language, age, early engagement counts, links |
| Context | The moment of the request | Time of day, day of week, network speed, whether the app is in the foreground, position in the feed |
No single family decides a ranking. A post with strong engagement counts (post signal) from an author the viewer has never seen (relationship signal) at 3 a.m. (context signal) may be scored very differently from the same post at noon.
Relationship signals: the most useful family
A fifth group sits between the families: pair signals, also called relationship features. They describe a specific viewer and a specific author together. Examples:
- How many of this author's posts the viewer liked in the last 30 days.
- Whether the viewer follows the author, and for how long.
- Whether the two accounts message each other or are tagged in the same photos.
- Whether the viewer has muted or hidden this author before.
- How many mutual connections they share.
Pair signals tend to predict reactions better than general ones, because they say something about this particular viewer. A post by a close friend with few likes often beats a popular post from a stranger. The cost is storage and freshness. A table of viewer-author pairs is much larger than a table of viewers or authors, and it must be updated whenever the viewer interacts.
Explicit and implicit signals
Signals also differ by how the platform learns them.
- Explicit signals are things a user does on purpose to tell the system something: following an account, tapping "show less like this," hiding a post, answering a survey ("Was this post worth your time?").
- Implicit signals are inferred from behavior: dwell time (how long a post stayed on screen), whether you expanded a caption, replayed a video, or scrolled past quickly.
Explicit signals are clearer but rare. Most users never tap "hide." Implicit signals are plentiful but ambiguous. A long dwell time might mean interest, or it might mean the user was interrupted. Ranking systems usually lean on implicit signals for volume and use explicit ones as a corrective, which is why a hide is given a large negative weight in the scoring chapter.
From events to features
Raw events are not directly usable. A model needs consistent numbers, so engineers transform them. Three transformations come up constantly.
Counts become rates. A post with 500 likes is not necessarily better than one with 50 likes. The first may have been shown to a million people and the second to 100. Divide by exposure to get a rate such as likes per view.
Rates get smoothed. A post shown to 5 people who liked it 3 times has a raw rate of 0.6, but that is weak evidence. Smoothing pulls small samples toward a prior (a typical rate) and trusts large samples more.
Skewed values get compressed. Follower counts range from 10 to 100 million. A logarithm turns that range into something a model can compare.
import math
def smoothed_rate(events: int, views: int, prior_rate: float = 0.05, prior_strength: int = 20) -> float:
"""Blend an observed rate with a prior, as if we had seen prior_strength extra views."""
return (events + prior_rate * prior_strength) / (views + prior_strength)
def build_features(viewer: dict, author: dict, post: dict, context: dict) -> dict:
pair_key = (viewer["id"], author["id"])
pair_likes = viewer["likes_by_author"].get(pair_key[1], 0)
return {
# author family
"author_log_followers": math.log10(author["followers"] + 1),
# post family
"post_age_hours": post["age_hours"],
"post_like_rate": smoothed_rate(post["likes"], post["views"]),
"post_is_video": 1.0 if post["media"] == "video" else 0.0,
# pair family
"viewer_follows_author": 1.0 if author["id"] in viewer["following"] else 0.0,
"viewer_likes_of_author_30d": float(pair_likes),
# context family
"hour_of_day": context["hour"],
"on_slow_network": 1.0 if context["mbps"] < 2 else 0.0,
}
viewer = {"id": "v1", "following": {"ana"}, "likes_by_author": {"ana": 7}}
author = {"id": "ana", "followers": 1200}
post = {"age_hours": 3, "likes": 3, "views": 5, "media": "video"}
context = {"hour": 21, "mbps": 1.5}
for name, value in build_features(viewer, author, post, context).items():
print(f"{name}: {value:.3f}")Run it and look at post_like_rate. The raw rate would be 0.6, but the smoothed value is (3 + 1) / (5 + 20) = 0.16. With 300 likes on 500 views, the same formula gives about 0.579, so the observed rate takes over once there is enough evidence. The prior_strength parameter controls how many views it takes to trust the data over the prior.
How signals reach the ranker
Signals have different freshness needs, so they arrive by different paths.
A viewer's long-term topic interests change slowly, so a daily batch job is fine. A post's like count in its first ten minutes changes fast and matters a lot, so it needs a streaming counter. Context signals exist only at request time and cannot be precomputed.
Common errors and gotchas
Training-serving skew. The model is trained on features computed one way (say, a batch job) and served features computed another way (say, a live counter with different rounding). The model then sees inputs it never learned from. The fix is to compute features with shared code or to log the exact features used at serving time and train on those.
Label leakage. If a feature includes information from after the moment of the decision, the model looks brilliant in testing and fails in production. For example, using a post's final like count to predict whether it would get likes teaches the model nothing useful. Features must be computed "as of" the time the post was shown.
Position bias. Posts near the top of a feed get more reactions simply because more people see them. If the model learns that "posts that were shown first get more likes," it will keep putting those posts first. Systems record the position at which each post was shown and either include it as a training feature (and set it to a constant at serving time) or correct for it in the training data.
Popularity bias. Raw engagement counts favor posts that were already popular. Smoothing and normalizing by exposure reduce this effect, but do not remove it. The chapter on feedback loops returns to this.
Missing values. New users have no history and new authors have no engagement rate. Filling gaps with zero says "this person never engages," which is a strong and often false claim. Better practice is to pass a separate "missing" flag, or to fall back to a population average. The cold start chapter covers this in more detail.
Stale features. A viewer who muted an author five minutes ago may still be shown that author's posts if the mute has not reached the feature store. Safety-related and explicit-control signals are usually checked in a fast path, not left to the batch pipeline.
Signals the ranker may not use
Not every available signal is allowed. Platforms restrict some inputs because of law, policy, or user trust. Sensitive attributes such as health conditions, or data from users who have opted out of tracking, may be excluded. Some platforms let users turn off personalization, in which case the ranker falls back to coarser signals such as time and followed accounts. When you reason about why a post appeared, remember that the visible signals are a subset of what exists, and the usable signals are a subset of that.
Putting it together
For any post in a feed, you can ask four questions in order. What do I know about the viewer? What do I know about the author? What do I know about the post right now? What is happening at this moment? Then ask the pair question: how do this viewer and this author relate? The answers form the feature vector that the next stage turns into predicted probabilities.
Exercise
A post has 40 likes on 50 views. Another has 400 likes on 1,000 views. Using smoothedrate with the default priorrate of 0.05 and prior_strength of 20, compute both smoothed rates, say which post scores higher, and explain why the smoothing changes the gap compared with the raw rates.
Show answer
First post: (40 + 1) / (50 + 20) = 41 / 70, about 0.586. Second post: (400 + 1) / (1000 + 20) = 401 / 1020, about 0.393. The first post still scores higher. The raw rates are 0.80 and 0.40, so the raw gap is 0.40 and the smoothed gap is about 0.19. Smoothing pulls the first post's rate toward the prior because 50 views is a small sample, while the second post's 1,000 views make its rate hold close to the observed value. The first post's smoothed rate drops more because it has less evidence behind it.
Exercise
A team trains a model with a feature "total likes the post ever received" and sees excellent offline accuracy, but the live feed performs poorly. Name the problem and give one fix.
Show answer
This is label leakage. The total includes likes that arrived after the post was shown, so the model learned from information it will not have at decision time. The fix is to compute the feature as of the moment the post was shown, for example the like count in the first 10 minutes, or to log the features at serving time and train on those logs.