Design a Multi-Objective Ranking Model for Sponsored Products
Machine LearningModel answerLast updated
Build a ranking system for e-commerce ads that optimizes user engagement, advertiser outcomes, and platform revenue while handling cold-start and fairness.
You're building a ranking model for sponsored product listings on an e-commerce platform. These paid listings appear alongside organic product recommendations in a discovery feed. Your task is to design a system that ranks these sponsored items to maximize overall platform value.
Your Design Should Address
Utility Function
Define how you'll score each ad, balancing:
- User satisfaction (relevance, engagement signals)
- Advertiser goals (purchases, add-to-cart events)
- Platform monetization
Signal Design
Identify the features and signals you'll use to capture:
- User purchase intent and browsing patterns
- Ad quality and relevance to the user
- Temporal patterns across multiple sessions
Fairness and Bootstrapping
Explain how you'll handle:
- New advertisers with no historical performance data
- Smaller brands competing against established players with strong historical metrics
Mitigating Bias
Describe your approach to prevent:
- Rich-get-richer dynamics where popular items dominate
- Feedback loops that suppress promising new inventory
Additional Considerations
- How would you validate your model before launching (offline metrics, experiment design)?
- What loss functions would you use if you need to predict multiple outcomes simultaneously (clicks, conversions, negative actions)?
- How do you think about the tension between immediate revenue and sustainable user experience?
Hints
Hint 1
Consider how different billing models (cost-per-click vs. cost-per-action) change what you optimize for
Hint 2
Multi-task learning frameworks can help when conversion labels are sparse but click data is abundant
Hint 3
Exploration strategies borrowed from bandits can address cold-start without sacrificing too much performance
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Multi-Objective Ad Ranking Design
1. Scoping and Assumptions
Before diving into the model, clarify the product context and scale:
Product context:
- Sponsored items appear in a scrollable feed, either in dedicated slots or blended with organic content
- Advertisers bid on clicks or conversions; the platform charges based on the billing model
- Conversion signals come from checkout events or tracking pixels
Assumed scale:
- 50M daily active users viewing the Shop surface
- 15–20 ad opportunities per user per session → ~1B daily impressions
- 5M active product ads from 500K advertisers
- Ranking service handles ~30K queries per second at peak
Performance targets:
- End-to-end latency budget of 120ms for the ad stack
- Click-through rate around 1.5%; post-click conversion rate around 3–4%
2. Defining the Value Function
The core ranking score combines multiple objectives into a single value estimate per candidate ad:
Score = bid × P(click) × P(conversion|click) # expected revenue
+ w₁ × P(add_to_cart) × estimated_cart_value # mid-funnel signal
+ w₂ × relevance_score(user, ad) # user satisfaction
- w₃ × P(negative_action) # penalize poor UX
Revenue component: The effective bid depends on the pricing model. For CPC campaigns, use bid × P(click). For conversion-optimized bids, use bid × P(click) × P(conversion|click). Accurate probability calibration is critical since these estimates multiply real currency values.
Satisfaction component: An orthogonal quality signal captures organic relevance—predicted dwell time, saves, or a learned engagement score. This allows a highly relevant ad with a slightly lower bid to win.
Dynamic weighting: The coefficients w₁, w₂, w₃ should adapt based on:
- User ad tolerance (how many ads seen this session)
- Placement context (top-of-feed vs. mid-scroll)
- Time sensitivity (promotional periods may tolerate higher ad density)
Tune these weights through constrained optimization: maximize revenue subject to maintaining engagement and retention metrics above baseline thresholds. Never set them manually.
3. System Architecture
Incoming request
↓
Retrieval layer: filter by targeting criteria + ANN semantic matching → ~2000 candidates
↓
Pre-ranker: lightweight model (shallow network or learned dot-product) → ~200 candidates
↓
Main ranker: multi-task deep model producing P(click), P(cvr|click), P(atc), P(negative)
↓
Calibration: per-task isotonic regression or Platt scaling by user/ad segments
↓
Auction logic: compute value score, apply budget pacing, frequency caps
↓
Diversity reranker: enforce category/advertiser variety, fairness constraints
↓
Ad-organic blending: insert ads only when value exceeds displaced organic item
↓
Final ranked feed
Data logged at serving time:
- Request context, user features, ad features, position, score components
- Propensity scores if using exploration
- Delayed join with clicks and conversions (attribution window: 7–14 days)
4. Feature Engineering
| Category | Examples |
|---|---|
| Real-time intent | Recently viewed products/categories, active search queries, cart contents, time since last action |
| User history | Embedding of purchase categories, typical price range, brand preferences, historical response rates to ads |
| Ad attributes | Product image/text embeddings (from multimodal encoder), price and discount percentage, seller rating, estimated delivery time, historical CVR for this advertiser |
| Interaction signals | Cosine similarity between user and ad embeddings, price alignment with user's spending profile, retargeting flag (previously viewed this item), frequency (times shown to this user) |
| Sequential context | Transformer encoding of last 200–300 user events across sessions, capturing long-term patterns |
| Contextual | Time of day, device type, position in feed (for training only—see debiasing below) |
Store user features in a low-latency feature store with batch-computed aggregates refreshed hourly and real-time signals from a stream processor.
5. Multi-Task Learning with ESMM
The challenge with conversion modeling: Training a CVR model only on clicked examples introduces selection bias—serving happens over all impressions, but your training distribution is conditioned on clicks. This skews predictions.
Entire Space Multi-Task Model (ESMM) approach:
Model the full funnel over the impression space:
- Let
P(click)andP(click ∧ conversion)both be predicted from all impressions - Derive
P(conversion|click) = P(click ∧ conversion) / P(click)implicitly
The loss function becomes:
L = Σ BCE(clicked, P(click))
+ Σ BCE(clicked ∧ converted, P(click ∧ conversion))
+ λ Σ BCE(added_to_cart, P(atc))
+ μ Σ BCE(negative_action, P(negative))
Architectural choices:
- Share embedding layers across tasks so sparse conversion signals benefit from dense click data
- Use Multi-gate Mixture-of-Experts (MMoE) or Progressive Layered Extraction (PLE) if tasks conflict
- Balance task weights using uncertainty weighting or validation-based tuning
Handling delayed conversions:
- Use an attribution window (e.g., 7 days) and treat unresolved events as negative, then apply importance weighting based on a learned delay distribution
- Alternatively, retrain periodically on matured data
6. Cold Start and Fair Competition
For new advertisers/products:
- Rely on content features (product images, descriptions, category, price) so predictions generalize from similar items
- Initialize embeddings using advertiser-level or category-level priors
- Apply embedding dropout during training so the model functions without ID features
- Allocate 2–5% of traffic to exploration with an uncertainty bonus (Thompson sampling or UCB on the CTR prediction confidence interval)
- Decay the exploration bonus as data accumulates
Ensuring smaller brands compete:
- Impose minimum exposure constraints in the reranker (e.g., each advertiser size tier gets a guaranteed impression share)
- Cap any single advertiser's share within a user session
- Implement budget pacing to prevent large spenders from exhausting inventory during peak hours
- Monitor exposure concentration metrics (Gini coefficient) and new advertiser retention as health indicators
7. Breaking Feedback Loops
Position bias: High-position items get more clicks regardless of quality, creating training bias. Solutions:
- Train with a position feature, then fix it to a neutral value at serving (PAL method)
- Use inverse propensity weighting from randomized position experiments
- Run a small randomized traffic slice to generate unbiased labels
Exploration: Reserve 1–3% of requests for contextual bandit exploration, logging propensity scores for off-policy evaluation.
Popularity bias: Popular items accumulate clicks faster, suppressing new inventory. Mitigations:
- Apply logQ debiasing in retrieval (downsample by log(popularity))
- Regularize item embeddings to prevent memorization
- Use diversity-aware reranking (MMR or determinantal point processes) to spread exposure across categories and advertisers
8. Evaluation Strategy
Offline metrics:
- Per-task AUC and log-loss on a held-out test set
- Calibration: plot predicted vs. observed rates by decile; compute expected calibration error
- Replay metrics: use logged propensities to estimate counterfactual CTR/CVR under the new policy
Online evaluation:
- A/B test with 5% treatment group for 2 weeks
- Primary metric: revenue per user (RPU)
- Guardrail metrics: click-through rate, conversion rate, user engagement (sessions per user, time spent), advertiser satisfaction (ROI, new advertiser retention)
- Slice analysis by user cohort, advertiser size, product category
Long-term vs. short-term tradeoff:
- Track cohort retention and lifetime value, not just immediate revenue
- Run long-horizon experiments (4+ weeks) to detect retention impacts
- Use bandit exploration or safe deployment (gradually ramp traffic while monitoring guardrails)
9. Common Pitfalls
- Ignoring calibration: Multiplying probabilities by bids requires well-calibrated estimates. Miscalibration directly misprices ads.
- Training-serving skew: Feature computation must match exactly between training and inference. Log features at serving time.
- Ignoring position bias: Treating position as a feature without correction bakes in bias.
- Overfitting to clicks: Optimizing only for CTR leads to clickbait. Include conversion and satisfaction signals.
- Static weights: The balance between revenue and UX should adapt to context and business conditions.
This design balances immediate monetization with sustainable user experience and advertiser success, using principled ML techniques to handle sparse labels, fairness, and exploration.