# What Is the Out‑of‑Network Discount Factor for Unfollowed Accounts in X Algorithm

> Learn about the out-of-network discount factor in the X algorithm. Discover how a 0.5 multiplier impacts content relevance from unfollowed accounts.

- Repository: [SpaceXAI Org/x-algorithm](https://github.com/xai-org/x-algorithm)
- Tags: deep-dive
- Published: 2026-09-11

---

**The out‑of‑network discount factor for unfollowed accounts is a fixed multiplier of 0.5 that reduces the relevance score of any content originating from accounts a user does not follow.**

The X algorithm open‑sourced in the `xai-org/x-algorithm` repository uses this discount to demote out‑of‑network content in the home feed ranking pipeline. When processing candidate tweets, the system identifies whether the author exists in the viewer’s follow graph and applies this multiplicative penalty before final ranking calculations.

## Where the Discount Factor Is Defined

### The Core Implementation in ranking_scorer.rs

The discount logic resides in [`home-mixer/scorers/ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/home-mixer/scorers/ranking_scorer.rs), the primary Rust module responsible for scoring candidate documents in the home timeline. Within this file, the algorithm determines the source relationship between the viewer and the tweet author.

When the author is not present in the viewer’s follow graph, the scorer retrieves the **out‑of‑network discount factor** constant. The raw prediction score—typically a floating‑point value representing relevance—is multiplied by this factor before downstream blending and deduplication steps.

### The Constant Value

The specific value is hardcoded as **0.5**. This means a tweet from an unfollowed account receives exactly half the base score weight compared to an equivalent tweet from a followed account.

```rust
// In home-mixer/scorers/ranking_scorer.rs
let discount_factor = if is_out_of_network { 0.5 } else { 1.0 };
let final_score = raw_relevance_score * discount_factor;

```

## How the Discount Is Applied

### Conditional Application Logic

The scorer checks the `is_out_of_network` boolean flag for each candidate tweet. This flag is populated earlier in the pipeline by comparing the author ID against the viewer’s follow graph. When `true`, the 0.5 multiplier activates.

The implementation also respects feature flags. The discount only applies when the specific out‑of‑network discount feature flag is enabled in the deployment configuration, allowing the platform to A/B test or disable the behavior without code changes.

```rust
// Conceptual flow from ranking_scorer.rs
if feature_flags.apply_oon_discount && candidate.is_out_of_network {
    score *= 0.5;  // Apply out-of-network discount factor
}

```

### Scope of Application

The 0.5 factor applies uniformly across content types:

- **Original tweets** from unfollowed authors
- **Retweets** where the retweeter is not followed (inherited out‑of‑network status)
- **Replies** in conversations where the root author is outside the viewer’s graph

This ensures consistent down‑ranking of all content originating outside the user’s explicit social connections.

## Testing and Validation

### Unit Test Coverage

The [`ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/ranking_scorer.rs) module includes comprehensive tests verifying the discount behavior. The test function `applies_oon_discount_to_out_of_network` explicitly validates that candidates marked as out‑of‑network receive the 0.5 multiplier while in‑network candidates retain their full score.

```rust
#[tokio::test]
async fn applies_oon_discount_to_out_of_network() {
    let raw_score = 1.0;
    let candidate = create_candidate(out_of_network: true);
    let final_score = compute_score(candidate, raw_score);
    
    assert_eq!(final_score, 0.5);  // Verifies 50% discount
}

```

These tests prevent regressions that could inadvertently remove the discount or modify the factor value during refactors.

## Summary

- The **out‑of‑network discount factor** is **0.5**, halving the relevance score of content from unfollowed accounts.
- Implementation lives in **[`home-mixer/scorers/ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/home-mixer/scorers/ranking_scorer.rs)** within the `xai-org/x-algorithm` repository.
- The factor applies to original tweets, retweets, and replies from users outside the viewer’s follow graph.
- Feature flags control whether the discount is active, enabling safe operational toggles.
- Unit tests in [`ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/ranking_scorer.rs) enforce the correct 0.5 multiplier behavior.

## Frequently Asked Questions

### What is the exact value of the out‑of‑network discount factor?

The exact value is **0.5**. This constant multiplier reduces the base relevance score of any tweet from an unfollowed account by 50% before the ranking algorithm sorts content for the home timeline.

### Which source file contains the discount factor implementation?

The implementation resides in **[`home-mixer/scorers/ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/home-mixer/scorers/ranking_scorer.rs)** in the `xai-org/x-algorithm` repository. This Rust module handles the conditional logic that checks the `is_out_of_network` flag and applies the 0.5 multiplier accordingly.

### Does the discount apply to retweets and replies from unfollowed accounts?

Yes. The 0.5 discount factor applies consistently across content types, including retweets and replies, whenever the content originates from a user the viewer does not follow. This ensures uniform down‑ranking of all out‑of‑network social signals.

### Can the out‑of‑network discount be disabled or modified?

Yes. While the factor value is hardcoded as 0.5, the application of the discount is gated by feature flags. Operators can disable the discount entirely through configuration without deploying new code, though changing the 0.5 value itself requires a modification to [`ranking_scorer.rs`](https://github.com/xai-org/x-algorithm/blob/main/ranking_scorer.rs).