How would you design a recommendation system for Reddit?
Written by the mlprep team · Updated
Design the recommendation system that powers Reddit's home feed. A logged-in user lands on their feed — how do you decide which posts to show them, in what order? Walk me through candidate generation, ranking, cold start, and how you'd measure success.
How to drive the interview#
Do not start by listing models. Start by clarifying the product contract:
- Is this only the logged-in home feed, or also recommendations inside subreddits?
- Are we optimizing for clicks, comments, saves, session time, long-term retention, or community health?
- Are posts from unsubscribed subreddits allowed? If yes, how much exploration is acceptable?
- What latency budget do we have for feed generation?
- Are there hard policy filters before ranking?
A strong system design answer should then move in layers: candidate sources → filtering → ranking → diversification → serving architecture → evaluation → failure modes.
Reddit's feed recommendation is a two-level problem: first, which subreddits and content pools to pull from; second, which specific posts to rank. The naive approach — score every post on Reddit for every user — breaks immediately. A Reddit-scale system needs to narrow from millions of posts down to hundreds before running any expensive model.
- Candidate pools (in parallel) subscribed subreddits (last 24–48h, quality-filtered) · two-tower collaborative filtering via ANN · trending detector
- Merge and deduplicate ~500–1,000 candidates, keeping source diversity
- Multi-task ranker GBDT or neural ranker over user, post, cross, and context features; predicts upvote, comment, save, and hide
- Weighted score → feed saves and comments weighted up, hides weighted down to avoid clickbait
Candidate Generation#
For a subscribed user, the obvious candidates are recent posts from their subscribed subreddits — but that alone is limiting. You want a few candidate pools:
- Subscribed subreddits: recent posts (last 24-48 hours), filtered for minimum quality (upvote ratio > 0.6, score > threshold)
- Collaborative filtering: users with similar subscription graphs tend to like similar posts. Train user and post embeddings via a two-tower model on interaction data (upvotes, saves, comments, hides). Use ANN (FAISS or ScaNN) to retrieve top-K posts that users like you engaged with, even from subreddits you don't follow.
- Trending posts: globally rising posts in communities adjacent to the user's interests — caught early by a separate trending detector
Run these in parallel, merge and deduplicate, target ~500-1000 candidates. Diversity matters: if everything comes from collaborative filtering you'll miss serendipitous discovery.
Ranking#
Score the ~500 candidates with a gradient-boosted tree or neural ranker using:
- User features: subscription list, karma breakdown by subreddit, posting vs. lurking behavior, activity time of day, account age
- Post features: upvote velocity (rate of upvotes in first hour), upvote ratio, comment-to-upvote ratio (high = controversy or discussion), post age, media type (image/video/text), subreddit size
- Cross features: user's historical engagement with this subreddit, user's historical engagement with this author, how similar this post's embedding is to posts the user has upvoted
- Context: time of day, platform (mobile vs. desktop), session recency
The ranking objective should be multi-task: predict upvote probability, comment probability, save probability, and hide probability simultaneously. A weighted combination prevents optimizing for clickbait (high CTR, high hide rate). Reddit specifically should weight saves and comments heavily — they indicate genuine engagement, not just a scroll-past.
Time Decay and the Hot Algorithm#
Reddit's original "hot" score is log(score) + age_penalty — a simple heuristic. Your learned ranker should bake in time decay naturally through post age as a feature, but you can also apply a hard freshness filter: posts older than 48 hours rarely belong in the home feed unless they're in slow-moving communities.
Cold Start#
New users: you know their signup context (referral source, onboarding subreddit choices if any, device). Show them the top posts from their chosen subreddits, blended with globally popular posts. Dedicate 20% of positions to diverse discovery. As they upvote and join communities in the first session, update their profile in near-real-time.
New posts: start with no collaborative signal. Use post embeddings (from title + flair + subreddit) to place them near similar posts the user has engaged with. Rely on upvote velocity in the first 30 minutes to decide whether to boost wider distribution.
Feature Store#
Serving requires features in milliseconds. User features (subscription list, recent interactions, embedding) live in an online store (Redis). Post features are partially precomputed (upvote velocity updated every few minutes, embeddings computed at post time) and fetched at ranking time. The key freshness tradeoff: upvote velocity needs near-real-time updates, but user embeddings can be recomputed every few hours.
Evaluation#
Offline: Recall@K on held-out interactions. NDCG on re-ranked held-out sessions. But offline metrics overfit to historical behavior.
Online (A/B tests): upvote rate per session, comments initiated, saves, return visit rate within 24 hours, "hides" and "not interested" clicks (negative signal). Crucially, measure long-term retention — some ranking changes improve day-1 CTR while burning users out over weeks.
Interview red flags#
- Designing a single model that scores every post instead of a candidate-generation → ranking funnel sized for latency.
- Optimizing raw click-through rate without hide, report, or long-term retention signals, which rewards clickbait and outrage.
- Comparing raw engagement across communities of very different sizes without normalizing per subreddit.
- Forgetting cold start for new users and new posts, or never mentioning exploration and diversity.
You mentioned using upvote ratio as a feature — but Reddit's community has very different upvote norms across subreddits. A 90% upvote ratio in r/worldnews means something different than in r/mildlyinteresting. How do you handle this, and what about explicitly controversial posts that generate huge engagement but also huge division?
Subreddit-normalized signals#
Raw upvote ratio is not comparable across communities. A 0.85 ratio in r/politics is contested; a 0.85 ratio in r/aww is a disaster. Fix this with z-score normalization per subreddit: compute the mean and standard deviation of upvote ratios for posts in that subreddit over the past 30 days, and express each post's ratio as standard deviations from the subreddit mean.
normalized_ratio = (post_ratio - subreddit_mean) / subreddit_std
This makes "unusually well-received for this community" a meaningful feature that compares across subreddits. Apply the same normalization to comment-to-upvote ratio, score velocity, and save rate.
You also want subreddit-level features as context: average post score, posting frequency, subscriber count — these tell the ranker what kind of community it's operating in, and it can learn different quality thresholds per community type.
Controversial content#
Reddit's controversy score is min(upvotes, downvotes) / max(upvotes, downvotes) — posts with near-equal upvotes and downvotes score high. This captures exactly what you're worried about.
The question is: what does Reddit want? Two different answers:
Engagement-maximizing: controversial posts drive massive comment threads and return visits. Amplify them. This is how social media ended up with outrage loops.
Retention-maximizing: users who regularly see polarizing content in their feed have higher long-term churn. The post is engaging in the moment but degrades the experience. Deprioritize controversy in the home feed, especially for users who've historically hidden or downvoted controversial posts.
In practice, Reddit's policy layer handles this partly through explicit rules (hate speech filters, community bans), but the ranking model also needs a controversy penalty term. You'd add a prediction head for "user will hide this within 5 minutes" and weight it negatively in the objective. Users who've engaged positively with controversial content in the past can be treated differently — personalize the controversy tolerance rather than applying a global penalty.
The honest answer: you encode your company's values in the objective function weights. There's no purely technical answer to how much controversy to surface.
Now go one layer deeper on serving. The user opens the app and we have 200ms to return the first page. What does the online architecture look like?
Online serving path#
The request path should be split into fast parallel services:
- Fetch user state: subscriptions, recent interactions, muted communities, safety settings, locale, and user embedding from an online store.
- Run candidate generators in parallel: subscribed subreddit pool, ANN retrieval, trending/community-adjacent pool, fresh posts from followed communities, and exploration candidates.
- Merge, dedupe, and apply hard filters: blocked authors, muted subreddits, already-seen posts, NSFW policy, deleted content, and community-level restrictions.
- Fetch candidate features in batch: post features, subreddit priors, author reputation, freshness, and real-time engagement velocity.
- Score with a lightweight ranker over maybe 500-1000 candidates.
- Apply business and product constraints: diversity, freshness, community caps, exploration slots, and safety demotion.
- Return top N and log the full candidate set, scores, features, and final positions for training and debugging.
Precompute aggressively#
User embeddings can be updated every few hours plus near-real-time session deltas. Post embeddings can be computed at creation time. Subreddit priors and trending scores can be refreshed every few minutes. The online request should not run heavy embedding generation for every candidate.
Fallbacks#
If ANN retrieval is down, use subscribed + trending pools. If real-time features are stale, fall back to last materialized values and lower confidence. If the ranker fails, use a deterministic hot/freshness heuristic. A staff-level design includes degraded modes because feed systems cannot simply fail closed for every transient dependency.
Latency budget#
Example budget:
- user/context fetch: 10-20ms
- candidate retrieval fanout: 40-60ms
- feature batch fetch: 30-50ms
- ranking: 20-40ms
- diversification and response assembly: 10-20ms
The main engineering risk is tail latency from fanout. Use timeouts per candidate source and return partial candidates rather than waiting for every retriever.
How do you prevent the feed from becoming a filter bubble while still personalizing strongly?
The product failure#
Pure engagement ranking can narrow the feed. If a user clicks a few posts about one topic, the ranker may over-serve that topic, creating short-term engagement but long-term fatigue.
Design controls#
- Source quotas: reserve slots for subscribed communities, adjacent communities, fresh posts, and exploration.
- Topic diversity: cap semantically similar posts in a page.
- Community diversity: avoid filling the whole feed from one subreddit unless the user explicitly wants that.
- Negative feedback: hides, mutes, downvotes, and fast scroll-away should strongly affect future ranking.
- Exploration policy: use contextual bandits or constrained randomization for a small fraction of slots.
Metrics#
Measure both short-term and long-term:
- engagement per session
- return rate after 1, 7, and 28 days
- number of distinct communities engaged with
- hides and mutes
- repeated-topic concentration
- creator/community coverage
Senior/staff framing#
This is not just model tuning. It is an objective design problem. You need explicit guardrails because the easiest metric to optimize may be the one that damages the ecosystem. In a real interview, saying "I would add a diversity penalty" is not enough; explain how it is enforced, measured, and A/B tested.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
Reddit feed design should be a multi-turn system design: clarify goals, generate candidates from subscribed/trending/embedding/exploration sources, filter unsafe or ineligible content, rank with multi-task objectives, diversify the page, serve under tight latency, and evaluate both short-term engagement and long-term retention/community health. Normalize engagement per subreddit and explicitly control controversy, filter bubbles, and fallback behavior.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- How would you detect and mitigate filter bubbles on Reddit — where a user's feed gradually narrows to only one type of content?
- Walk me through the trade-offs between a two-tower model and a cross-attention model for ranking. When does each win?
- How would you implement real-time session context — the last 3 things a user upvoted in this session — into your ranker at low latency?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions
How would you design Amazon's product search ranking system?
How would you design a RAG system that answers questions over a company's internal documents?
How would you design the click-through rate prediction system for an ads platform?
Walk me through two-tower models for retrieval — architecture, tradeoffs, and limits