How do ads get blended into the For You feed?
After your organic posts are ranked, a separate blender inserts ads into "safe gaps" between them — never adjacent to certain content, never closer together than a minimum spacing, and not at all until the feed has a minimum number of posts. Ads don't compete with your post for a ranking slot; they're placed into the gaps around already-ranked organic content. This is why ad load feels spaced rather than stacked, and why it matters that organic ranking happens first, independently.
A reasonable worry: do ads steal ranking slots from organic posts? The released code says no — not directly. Organic posts are ranked first, then a dedicated blender places ads into the spaces between them, under spacing rules.
Ads fill gaps, they don't compete for rank
The blender takes already-scored organic posts and a set of ads, finds the safe gaps, and assigns ads into them with computed spacing:
25let safe_gaps = find_safe_gaps(&scored_posts); 26let spacing = compute_spacing(&ads); 27let first_ideal = ads[0].insert_position.max(0) as usize; 28let placements = assign_ads_to_gaps(&safe_gaps, ads.len(), &spacing, first_ideal);
Ads are blended into already-scored organic posts by a SafeGapAdsBlender: it finds 'safe gaps' between ranked posts, computes spacing, and assigns ads into those gaps — organic ranking happens first, then ads are placed into the spaces.
The key word is gaps. Your post earned its rank among organic candidates before any ad entered the picture; the ad is then slotted into a gap near a target position. Organic ranking and ad placement are two separate steps, in that order.
The spacing rules
Ad insertion is governed by constraints visible in the code: a minimum number of posts before
ads appear at all (MIN_POSTS_FOR_ADS), a computed minimum spacing between ads, and
"safe gap" logic that avoids placing an ad in an unsuitable spot. The blender searches for the
best gap at or after each ideal position rather than forcing ads in at fixed intervals.
Ad insertion is constrained by a minimum number of posts before ads appear (MIN_POSTS_FOR_ADS), a computed minimum spacing between ads, and safe-gap selection that searches for the best eligible gap at or after each ideal position rather than forcing fixed intervals.
Signal by signal
| in the code | in plain english |
|---|---|
| organic ranked first, then blended | Ads don't take a ranking slot from your post. Your rank is decided among organic posts before ads enter. |
| MIN_POSTS_FOR_ADS | No ads until the feed has enough organic posts — a sparse feed isn't front-loaded with ads. |
| safe gaps + spacing | Ads are spaced out and kept out of unsuitable positions, not stacked. |
What the code doesn't say
The actual values: how many posts before the first ad, how wide the minimum spacing, what
makes a gap "unsafe." These constants and the brand-safety rules behind them are not fully in the
release. The architecture — rank organic, then blend ads into safe gaps — is code-current; the
exact ad load is not.
The numeric values of the current weights are not included in the open-source release: weighted_scorer.rs references a params module (e.g. p::FAVORITE_WEIGHT, p::REPLY_WEIGHT) whose values are not present anywhere in the published repository.
What to do with this
Mostly, take reassurance from the architecture: ads are not why a given post underperformed — your post's rank was settled among organic candidates before ad placement. If reach is down, the answer is in the organic ranking and filter stages, not ad competition. That keeps the diagnosis where xDoctor's tools actually look.