After studying this material, students should be able to:
User Sees Ad → User Acts (Click/Save/Buy) → System Learns → Better Predictions
Core Problem:
Predict the probability that a user will engage with an advertisement
Key Metrics:
Advantages | Limitations
--------------------|------------------
✓ Interpretable | ✗ Manual features
✓ Fast training | ✗ Limited patterns
✓ Works on tabular | ✗ No sequence data
Input Features
↓
[Embedding Layer] ← Converts categories to vectors
↓
[Hidden Layers] ← Learns complex patterns
↓
[Output Layer] ← Probability prediction
More Data Available
+
Complex User Behaviors
+
Need for Better Accuracy
=
Move to Deep Learning
User Journey Example:
[Saw Recipe Pin] → [Saved Recipe] → [Clicked Kitchen Ad] → [Bought Item?]
t-3 t-2 t-1 t
Key Insight:
Past user actions contain valuable signals about future behavior
A) Sequence Representation
# Conceptual representation
user_sequence = {
'actions': ['view', 'save', 'click'],
'items': ['pin_1', 'pin_2', 'ad_1'],
'timestamps': [t1, t2, t3]
}
B) Attention Mechanism
Recent Actions → Higher Weight → More Influence
Older Actions → Lower Weight → Less Influence
[Action_1] × 0.1
[Action_2] × 0.3
[Action_3] × 0.6 ← Most Recent
↓
Final Prediction
| Without Sequence | With Sequence |
|---|---|
| Static user profile | Dynamic user intent |
| Misses context | Captures context |
| Lower accuracy | Higher accuracy |
[Shared Layers]
/ | \
/ | \
[Task 1] [Task 2] [Task 3]
Click Save Purchase
Pred. Pred. Pred.
Problem: Purchase data is SPARSE
(Few users actually buy)
Solution: Learn from related tasks
Clicks (Abundant) ──┐
Saves (Medium) ──┼──► Better Purchase Prediction
Views (Abundant) ──┘
Model 1 (Specialized) ─┐
Model 2 (Specialized) ─┼──► Ensemble ──► Final Score
Model 3 (Specialized) ─┘
OFFLINE (Training) ONLINE (Production)
───────────────── ──────────────────
Historical data ≠ Real-time data
Static distribution ≠ Dynamic distribution
Controlled testing ≠ Real user behavior
1. DATA FRESHNESS
Training Data (Old) ──► Model ──► Predicts on New Data
↑
Distribution Shift!
2. FEATURE INCONSISTENCY
Offline Features ≠ Online Features
(Batch computed) (Real-time computed)
3. FEEDBACK DELAY
User Buys Item
↓
[Hours/Days Later]
↓
System Records Conversion
↓
Model Doesn't Know Yet!
Problem Solution
─────────────────────────────────────────
Data Freshness → Continuous Training
Feature Gap → Feature Store Alignment
Feedback Delay → Delayed Feedback Models
Distribution Shift→ Online Learning
USER BEHAVIOR
│
▼
┌─────────────────────────────────┐
│ FEATURE ENGINEERING │
│ • User Sequences │
│ • Ad Features │
│ • Context Features │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ MULTI-TASK DNN │
│ • Shared Representation │
│ • Task-Specific Layers │
│ • Ensemble Components │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ ONLINE SERVING │
│ • Real-time Inference │
│ • Discrepancy Monitoring │
│ • Continuous Updates │
└─────────────────────────────────┘
│
▼
AD RANKING SCORE
| Concept | Core Idea | Why Important |
|---|---|---|
| Sequence Modeling | User history predicts future | Better personalization |
| GBDT→DNN Evolution | More complex = more accurate | Industry best practice |
| Multi-Task Learning | Share knowledge across tasks | Handles data sparsity |
| Online-Offline Gap | Training ≠ Production | Critical for reliability |
Basic: Why did Pinterest move from GBDT to DNN models?
Intermediate: How does attention mechanism help in sequence modeling?
Advanced: Design a solution for handling delayed conversion feedback in an ads system
Applied: What metrics would you monitor to detect online-offline discrepancy?