Prompt
I’m building a home feed ranking system with recommendations
Latest observation
Great — a home feed ranking system is usually built as a multi-stage recommendation/ranking pipeline. Here’s a practical blueprint you can adapt.
1) Define the goal
First, be explicit about the objective:
- Primary metric: clicks, watch time, dwell time, likes, follows, conversions, etc.
- User value: freshness, relevance, diversity, novelty, safety
- Business value: retention, revenue, creator exposure, exploration
A good home feed usually optimizes a blended objective, not just CTR.
2) Typical architecture
Stage A: Candidate generation
Generate a few hundred to a few thousand items from a very large corpus.
Common sources:
- Collaborative filtering / embeddings
- Content-based retrieval
- Follow graph / social graph
- Popular/trending items
- Recently interacted creators/topics
- Fresh/new content exploration
Goal: high recall, low latency.
Stage B: Filtering / eligibility
Remove items that should not be shown:
- Already seen
- Blocked/muted content or creators
- Policy/safety violations
- Out-of-date content
- Geo/language mismatch
- Frequency cap violations
Stage C: Ranking
Score each candidate with a model that predicts utility:
- P(click | user, item, context)
- P(long dwell)
- P(like/follow/share)
- Expected watch time
- Composite reward
Common models:
- Logistic regression for simple baseline
- GBDT / XGBoost for strong tabular baseline
- Neural ranking model with user/item/context embeddings
- Two-tower retrieval + ranking MLP
- Sequence models for session-aware ranking
Stage D: Re-ranking / post-processing
After model ranking, apply business rules and diversity constraints:
- Diversify creators/topics
- Penalize duplicates
- Mix exploration and exploitation
- Ensure freshness and quality balance
- Calibrate across segments
This is where you avoid a feed that is “accurate but boring.”
3) Features to use
User features
- Historical clicks, likes, skips, dwell time
- Topic/category affinity
- Creator affinity
- Recency of activity
- Session intent
- Language, region, device
Item features
- Content type
- Topic/category
- Creator stats
- Age of content
- Engagement rate
- Text/image/video embeddings
- Quality/safety signals
Context features
- Time of day
- Day of week
- Network/device conditions
- Entry source
- Session depth
- Current feed position
Cross features
- User-item similarity
- User-topic affinity
- User-creator affinity
- Freshness vs user novelty preference
4) Training data
Usually constructed from logged impressions.
For each impression:
- user, item, context
- label: click / watch / like / etc.
- exposure position
- dwell time
- negative sampling / non-clicks
Important:
- Use impression-based data, not just clicks
- Correct for position bias
- Consider selection bias since only shown items are logged
Common approaches:
- Weighted loss by inverse propensity
- Counterfactual learning
- Debiasing with randomized exploration traffic
5) Ranking objective
You can model a single target or a weighted combination.
Example composite score: [ score = 0.4 \cdot P(click) + 0.3 \cdot P(long_dwell) + 0.2 \cdot P(like) + 0.1 \cdot freshness ]
Or expected utility: [ EU(item) = \sum_k w_k \cdot P(outcome_k) ]
If you care about long-term retention, consider:
- session-level reward
- delayed feedback
- reinforcement learning or bandit-style optimization
6) Evaluation
Offline metrics
- AUC / log loss for prediction
- NDCG@K
- MAP@K
- Recall@K
- Calibration
- Diversity / coverage / novelty
- Creator/topic exposure distribution
Online metrics
- CTR
- dwell time
- session length
- retention (D1/D7/D30)
- hides/reports
- creator ecosystem health
- revenue if applicable
Offline and online often diverge, so A/B tests matter a lot.
7) Common pitfalls
- Optimizing only CTR leads to clickbait
- Not correcting position bias
- Over-personalization reduces discovery
- Feedback loops amplify popular content
- No exploration hurts new items/creators
- Stale features degrade ranking quality
- Misaligned labels: clicks may not mean satisfaction
8) A strong practical starting design
If you want a production-friendly first version:
Retrieval
- Two-tower embedding model
- Popular/trending fallback
- Creator-follow and topic-based recall
Ranker
- GBDT or MLP on impression logs
- Predict click + dwell time
Re-ranker
- Penalize repeated creators
- Enforce topic diversity
- Blend in some fresh/exploratory items
Training
- Impression-level supervised learning
- Position-bias correction
- Daily retraining, or more frequent if traffic is high
9) Simple end-to-end flow
- User opens feed
- Retrieve 1k candidates from multiple sources
- Filter out ineligible items
- Score each with ranking model
- Re-rank for diversity/freshness/business constraints
- Serve top N
- Log impressions, clicks, dwell, skips
- Train on logs and iterate
10) If you want, I can help you design one of these in more detail:
- a system architecture
- feature schema
- model choice
- loss function
- offline/online evaluation plan
- A/B test setup
- cold start strategy
- feed re-ranking logic
If you want, I can also sketch a concrete design for a YouTube/TikTok-style home feed or a news/feed product.