KatInterview

Designing a Leak-Free Weekly Churn Model Pipeline

Machine LearningModel answer
HardModel answerMachine Learningchurn-predictiondata-leakageclass-imbalance

Last updated

Design a weekly batch churn-prediction system for millions of subscribers, covering leakage-free features, rare positives, time-aware validation, metrics, and drift monitoring.

Scenario: Predicting Who Won't Renew Next Week

A video streaming service has tens of millions of subscribers. Each week it wants to identify the subscribers who will not renew during the following seven days, so the retention team can contact them. You can draw on three sources: app and playback activity logs, billing and payment history, and content engagement data.

Roughly 2-5% of subscribers up for renewal churn in a typical week.

What to design

Describe a production-grade, scalable pipeline that answers each of the following:

  1. Preventing time-based leakage. How do you guarantee that features used for a given prediction date contain only information that was truly available at that moment?
  2. Rare positives. What do you do about the heavy imbalance during training, and during evaluation?
  3. Validation that mirrors production. Since the model is retrained and applied every week, what splitting scheme gives you an honest estimate of live performance?
  4. Running it in production. How do you detect both changes in the input data and changes in the relationship between inputs and churn once the model is live?

Deliverables

  • A text description of the end-to-end architecture (data ingestion through scoring and monitoring).
  • A justified choice of evaluation metrics. Compare ROC-AUC, PR-AUC, precision/recall at a contact budget, and a cost-weighted measure.
  • The workflow that produces weekly feature snapshots for all users efficiently.

State any assumptions you make (scale, label definition, how scores will be used).

Hints

Hint 1

Start by pinning down the label precisely: what is the snapshot time, which users are eligible, and when does the outcome become known (including payment retries)? Every leakage and validation decision follows from that.

Hint 2

Think about the gap between the prediction date and the date labels mature. A validation fold that ignores that delay will look better than production. Also ask why random row-level K-fold is wrong when each user appears in many weeks.

Hint 3

For metrics, ask what the score is used for: a fixed contact budget and a discount cost. That points to ranking quality at the top of the list, calibration, and an expected-value threshold, not a single global number. For monitoring, separate checks that need no labels from checks that must wait for labels.