Design a Social Feed Negative Feedback Prediction Model
Machine LearningModel answerLast updated
Architect an ML prediction pipeline to capture explicit and implicit user dissatisfaction on a social feed, handling extreme label skew, multi-task ranking, and real-time inference.
Design an end-to-end machine learning system that predicts negative user feedback (e.g., clicking "Hide post", "Show less", or reporting content) on a high-throughput personalized social media feed. The system must down-rank or filter unsatisfactory content without compromising overall long-term platform engagement.
Key Aspects to Address
- Label Strategy & Data Pipeline: How do you distinguish explicit negative events from implicit signals? Explain how training datasets are constructed, sampled, and recalibrated under severe class imbalance.
- Feature Taxonomy: What features differentiate personal user preference ("not interested") from broad safety issues ("offensive/policy violation")?
- Model Architecture & Serving: How do you structure the model to score candidates within a tight latency budget (e.g., 100ms total feed generation)?
- Integration Strategy: How are these predicted probabilities combined with positive engagement targets (likes, shares, comments, watch time) in the final ranking policy?
- Cold Start & Evaluation: How do you handle brand-new posts with zero impression history, and how do you validate model quality offline and online?
Scale Assumptions
- Scale: 500M Daily Active Users (DAU), 5B daily feed requests (~60k QPS average, 150k peak).
- Impressions: 50B viewable impressions per day.
- Base Rate: Negative interactions occur on < 0.1% of impressions.
- Latency Target: Heavy ranking pipeline budget is capped at 30–40ms.
Hints
Hint 1
Consider multi-task learning architectures (e.g., MMoE or PLE) to predict engagement and dissatisfaction simultaneously within the same forward pass.
Hint 2
When downsampling negative class examples in training, remember to apply mathematical recalibration to ensure correct output probabilities for the downstream value formula.
Hint 3
Distinguish between preference features (e.g., user-topic affinity) and quality/safety features (e.g., toxicity scores, global report rates) to avoid wrongly penalizing niche content.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Requirements & System Constraints
High-Level Objectives
- Primary Goal: Minimize severe user dissatisfaction (hides, explicit unfollows, content reports, rapid bounces) on personalized feed items.
- Secondary Goal: Maintain overall healthy user retention and positive interaction volume (comments, shares, meaningful discussions).
- Scale: 500M DAU $\times$ 10 requests/day = 5 Billion feed requests daily (~60,000 QPS average, 150,000 QPS peak).
- Candidate Pool: ~500 items evaluated in the heavy ranking stage per request ($30\text{M} - 75\text{M}$ item evaluations per second globally).
- Latency Allocation: The complete feed generation latency is capped at 100ms; the heavy multi-objective ranking stage gets 30–40ms max.
2. Label Strategy & Data Pipeline
Label Definition Matrix
Negative feedback is heterogeneous. We split signals across distinct target heads:
| Feedback Signal | Category | Implicity / Weight | Handling Window |
|---|---|---|---|
| Content Report | Policy violation / Safety | Explicit / Weight = $5.0$ | 24-hour attribution window |
| Hide Post / "See Fewer" | Direct Preference | Explicit / Weight = $1.0$ | Session attribution window |
| Quick Scroll-Past (< 300ms view) | Weak Preference | Implicit / Weight = $0.1$ | Immediate (In-feed viewable impression) |
Viewable Impression Denominator
To avoid training on unperceived content:
- Impression Criterion: An impression is valid only if $\ge 50%$ of the item's screen bounding box was visible for $\ge 250\text{ms}$.
- Unseen items down-ranked by retrieval are completely excluded from both positive and negative label definitions.
Handling Extreme Class Imbalance
With a base rate of $< 0.1%$ explicit hides/reports, naive training is inefficient and computationally wasteful.
- Negative Downsampling: Retain $100%$ of positive negative-feedback actions. Randomly sample un-acted viewable impressions at rate $r = 0.02$ (a 50:1 reduction).
- Probability Recalibration: Since downstream value models rely on true calibrated probabilities, correct the model output probability $p'$ during serving back to un-sampled real-world scale $p$: $$p = \frac{r \cdot p'}{1 - p' + r \cdot p'}$$
- Loss Function: Train using Binary Cross-Entropy with Focal Loss on the downsampled dataset to keep optimization focused on hard-to-predict boundaries rather than easy non-events.
3. Feature Taxonomy
We split features to separate Personal Taste Mismatch from Global Content Quality Issues:
+-------------------------------------------------------------------------+
| FEATURE TAXONOMY |
+------------------------------------+------------------------------------+
| Personal Preference Features | Global Quality & Safety Features |
| (Explains "Not for me") | (Explains "Bad for the platform") |
+------------------------------------+------------------------------------+
| * User-Topic / User-Author | * Machine Learning Safety Scores |
| historical interaction rates | (Toxicity, Nudity, Clickbait) |
| * Author unfollow rate per topic | * Global report/hide rate across |
| * Author repetition count | all viewers (smoothed) |
| (impressions in last 24h) | * Creator policy strike history |
| * Visual / Textual Embedding | * Aggregated negative comment |
| similarity (User profile vs item)| sentiment ratio |
+------------------------------------+------------------------------------+
4. Model Architecture & Serving Pipeline
To keep serving latency under 40ms, the negative feedback prediction must not run as an independent, standalone neural network. Instead, it is integrated directly into the core Multi-Task Learning (MTL) architecture using Progressive Layered Extraction (PLE) or Multi-gate Mixture-of-Experts (MMoE).
+-----------------------------------+
| Final Feed Ranker |
+-----------------------------------+
^
+--------------------+-------+-------+--------------------+
| | | |
+--------------+ +---------------+---------------+ +---------------+
| Task Tower 1 | | Task Tower 2 | Task Tower 3 | | Task Tower 4 |
| P(Click) | | P(Long View) | P(Hide) | | P(Report) |
+--------------+ +---------------+---------------+ +---------------+
^ ^ ^ ^
+--------------------+-------+-------+--------------------+
|
+-------------------------------+
| Shared & Task-Specific Experts|
| (PLE / MMoE) |
+-------------------------------+
^
+-------------------------------+
| Dense & Sparse Embeddings |
+-------------------------------+
Shared Multi-Task Architecture Benefits
- Zero Extra Inference Latency: Compute for dense embeddings and bottom-layer feature representations is shared across all task heads ($P(\text{like}), P(\text{comment}), P(\text{hide}), P(\text{report})$). The extra overhead is restricted to running tiny 2-layer MLP task towers.
- Cross-Task Representation Transfer: Sparsely observed negative tasks borrow low-level feature representations from dense engagement signals (e.g., watch time).
Inference Pipeline Sequence
- Retrieval (Thousands $\rightarrow$ 500): Sub-second vector search & heuristic rules.
- Heavy Multi-Task Ranker (~500 items): Shared GPU batch forward pass computes calibrated estimates: $\hat{p}{\text{like}}, \hat{p}{\text{comment}}, \hat{p}{\text{hide}}, \hat{p}{\text{report}}$.
- Safety Hard-Constraint Filter: Filter out any item where $P(\text{report}) > \tau_{\text{report}}$ or the safety classifier flag is active.
- Value Optimization Scoring: Combine probabilities into a scalar utility score for final sorting.
5. Integration into Feed Ranking Policy
The candidate item list is ordered by an explicit Expected Value Function:
$$\text{Value} = w_{\text{like}} \cdot P(\text{like}) + w_{\text{comment}} \cdot P(\text{comment}) + w_{\text{dwell}} \cdot \mathbb{E}[\text{dwell}] - w_{\text{hide}} \cdot P(\text{hide}) - w_{\text{report}} \cdot P(\text{report})$$
Policy Optimization Parameters
- Weights ($w_{\text{hide}}, w_{\text{report}}$): Derived via grid search or constrained Bayesian Optimization on offline historical playback logs, balancing engagement against negative action rates.
- Hard Threshold Safeguard: If $P(\text{report}) > 0.15$, the item score is forced to $-\infty$, preventing high-engagement clickbait/ragebait from bypassing soft penalties.
6. Cold Start Strategy for New Posts
New items have zero impression counters. We resolve this via:
- Content-Based Pre-Computation: Run multimodal encoders (text BERT/RoBERTa + Vision Transformer) at ingestion time to generate initial safety and affinity scores.
- Creator Priors: Initialize the post's prior baseline hide rate using the author's historical $90$-day smoothed hide rate: $$\text{Prior}_{\text{post}} = \frac{\text{Author Hides} + \alpha \cdot \bar{H}}{\text{Author Impressions} + \alpha}$$
- Streaming Counter Updating: Real-time stream processing (e.g., Apache Flink) collects hide events within 10–30 seconds, dynamically updating post features in a low-latency key-value store (e.g., Redis/Memcached).
7. Evaluation & Validation
Offline Metrics
- PR-AUC (Precision-Recall Area Under Curve): Critical metric for highly imbalanced labels; ROC-AUC gives a misleadingly optimistic view due to huge true negative counts.
- Expected Calibration Error (ECE): Evaluates if the predicted probability $P(\text{hide})$ matches the true empirical rate, which is mandatory for valid score blending in the value formula.
- Counterfactual Replay / Off-Policy Policy Evaluation (OPE): Re-rank historical impression logs using Inverse Propensity Scoring (IPS) to estimate expected reduction in user hides.
Online A/B Testing Metrics
- Primary Guardrail Metrics: Absolute volume of explicit hides per user per day; explicit report rate per 1,000 impressions.
- Primary Engagement Metrics: 7-day and 28-day user retention (DAU/MAU ratio), total session duration.
- Trade-off Frontier Analysis: Plot Pareto curves of Retention vs. Total Actions across varying values of $w_{\text{hide}}$ to pick optimal deployment operating points.