Design a Weekly User Activity Prediction System
Design a leakage-safe ML data and serving system that predicts a user's next-week streaming activity from high-cardinality temporal behavior.
Problem statement
For this exercise, assume a streaming product wants one weekly prediction per eligible user: the amount of meaningful listening activity the user will generate during the next complete calendar week. The system uses high-cardinality content and context features plus temporal sequences across sessions, days, and weeks.
It must build reproducible point-in-time training examples without label leakage, aggregate a trillion-scale event corpus, compare progressively richer model families, publish immutable model and feature versions, and deliver a weekly prediction dataset with visible coverage and freshness.
Design the data, training, evaluation, and batch-serving system. Real-time recommendation ranking, audio delivery, and online model inference are outside scope.
What to build
- Authorized ML owners can publish immutable target, eligibility, feature, and data-split definitions for a weekly prediction contract.
- The platform creates reproducible training examples whose features use only information available before each weekly cutoff and whose labels use the following week.
- ML owners can train and compare baseline, tree or feed-forward, recurrent, and attention-based candidates on fixed datasets and cohort-aware metrics.
- The system publishes one versioned weekly prediction dataset for eligible users with coverage, cutoff, freshness, and model metadata and supports deterministic backfill.
At scale
- For this exercise, assume one billion eligible users, a retained corpus of one trillion listening events, and peaks of five million accepted events per second.
- For this exercise, publish predictions for 99 percent of eligible users within six hours after the weekly feature cutoff and expose missing or partial cohorts explicitly.
- For this exercise, allow source events to arrive up to 24 hours late and make backfills or corrected weekly datasets versioned rather than silently overwriting prior output.
- For this exercise, retain immutable source envelopes for 90 days, reproducible weekly feature snapshots for 18 months, and dataset, model, evaluation, and prediction metadata for three years.