Month-by-Month Employee Departure Forecasting System
Machine LearningModel answerLast updated
Design an end-to-end ML system that estimates, for each active user, the probability of leaving their current employer in each of the next K months.
Month-by-Month Employee Departure Forecasting System
A professional networking platform wants to predict whether each of its members will change employers within a rolling future window. The goal is a monthly hazard estimate per member — not just "will they ever leave" but "how likely are they to leave this month, next month, and each of the following K months."
You have access to:
- Profile history (job titles, employers, start/end dates, skills, education)
- On-platform behavioral signals (searches, logins, profile edits, messaging activity)
- Network and company-level data (connections, employer headcount changes, peer activity)
- Approximately 5 years of history across a large member base (assume ~200M members)
What you are expected to cover
Problem framing How do you formulate this as a time-to-event problem rather than a simple binary classification? What does "censoring" mean here and why does it matter?
Label construction How do you build a training dataset that correctly captures who is at risk, when, and whether the event happened? How do you handle members who never change jobs, members who change multiple times, and members whose profiles go stale?
Feature engineering What signals are most predictive? What transformations are necessary? How do you ensure every feature is a valid point-in-time snapshot?
Leakage prevention Enumerate the specific ways a naive pipeline would introduce data leakage in this problem. How do you prevent each one?
Model selection and training What model family fits the formulation? How do you handle the extreme class imbalance (monthly change rates are roughly 1–2%)?
Evaluation How do you measure model quality offline, given censoring? What baselines should you beat? What slice-level checks matter?
Fairness and deployment How do you audit for disparate impact? What does production scoring look like at scale?
There is no single correct implementation — the interviewer wants to see sound reasoning at each step and awareness of the trade-offs.
Hints
Hint 1
A simple binary classifier trained on 'did this person change jobs?' ignores *when* the event happened and discards partial information from members still in their current role. Think about what modeling framework naturally handles both events and censored observations — and how that framework decomposes into something a standard binary classifier can still solve.
Hint 2
The trickiest leakage in this problem is not the obvious future-target leak. It comes from two subtler sources: (1) behavioral signals that spike *after* a job change because people update their profile, add new-employer connections, and get endorsements — even though those signals appear timestamped before the reported start date; and (2) the last few months of training data where labels are not …
Hint 3
Your baseline should be a tenure-only model: the probability of leaving rises sharply around 12 and 24 months and spikes in January. This baseline is surprisingly competitive. Make sure your evaluation framework (time-dependent AUC, calibration plots, lift over the tenure baseline) can detect whether the complex model actually adds value over that simple one.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Approach
The first thing to say clearly: this is not a binary classification problem. It is a discrete-time survival problem with recurrent events. Framing it as survival analysis is what separates a strong answer from a mediocre one, and every downstream choice — labels, splits, metrics, deployment — flows from that framing.
1. Clarify scope before modeling
Before writing any code, pin down:
- What counts as an event? A new employer, not a title change within the same company.
- Who is in scope? Members currently employed and visible on the platform.
- What is the output? For each member, a monthly hazard
h(t)and a derived cumulative probability over a horizon of K months (e.g. K = 12). - Who consumes it? Recruiter targeting, "open to work" prompts, and job-recommendation ranking. Each consumer cares about a different horizon and metric.
- Label source? Self-reported profile updates, which are noisy and lagged by weeks to months. This matters a lot.
2. Label construction via person-period expansion
Define the hazard at month t as:
h(t | x) = P(T = t | T ≥ t, x_t)
where T is the month of departure. The key insight is that the discrete-time survival likelihood factorizes into independent Bernoulli terms, so any binary classifier trained on log-loss is a valid hazard model — as long as the data is structured correctly.
Person-period expansion: Create one row per member per month they are at risk.
| member | month | tenure_months | features (snapshot) | y |
|---|---|---|---|---|
| A | 2023-01 | 14 | … | 0 |
| A | 2023-02 | 15 | … | 0 |
| A | 2023-03 | 16 | … | 1 |
| B | 2023-01 | 3 | … | 0 (censored) |
Rules:
y = 1only in the month the departure is recorded.- After an event, the member re-enters the risk set with tenure reset to 0, because job changes are recurrent.
- Censored members (inactive, deleted account, still employed) contribute
y = 0rows up to their last observed month, then stop. They are not dropped, and future months are not labeled negative — that would be fabricating outcomes.
With ~200M members and 60 months of history, this produces ~12B person-month rows. Downsample negatives (e.g. keep 5% of y = 0 rows) and correct predicted probabilities afterward by scaling the odds back up: p_corrected = p / (p + (1-p)/q) where q is the keep rate.
3. Feature engineering
Every feature must be a point-in-time snapshot as of the start of that month — no lookahead.
- Tenure and career trajectory: current tenure in months, count of past changes, average past tenure, seniority level, function, industry.
- Behavioral engagement: trailing 7/30/90-day aggregates of job searches, job views, applications submitted, recruiter message response rate, logins, profile edits, connections added at companies other than the current employer.
- Employer context: headcount trend at current employer, peer attrition rate (co-workers who left in the past 90 days), company age, funding news.
- Market signals: open job postings in the member's skill cluster and geography, macro hiring index for that sector.
- Network contagion: fraction of former colleagues who changed jobs in the past 3 months.
- Tenure spline: a smoothed nonlinear encoding of tenure captures the well-known hazard spikes at 12 and 24 months. Also include calendar month as a feature — January sees a reliable seasonal spike.
4. Leakage prevention
This is where most candidates stumble. There are four distinct leakage vectors here.
Label lag. Members update their profiles weeks after actually starting a new job. Engagement signals such as profile edits, new-employer connections, and peer endorsements often appear timestamped before the reported start date but after the true departure. Fix: use the reported start date as the event month, and hard-exclude behavioral features that are known post-change proxies (e.g. "connections at company X" where X becomes the new employer). Also drop the last 2–3 months of training data, where labels are still immature.
Snapshot correctness. Profile fields like "current title" are overwritten on update. You need a feature store with as-of joins — aggregate trailing windows using only data available before the row's month, never the full column history.
Post-event features. Any feature derived from the new employer, new colleagues, or post-change engagement is off-limits. Audit your feature list explicitly against this criterion.
Temporal and member-level split. Use a rolling-origin split: train on months ≤ T, validate on T+1 to T+3, test on T+4 and beyond. Also group by member ID so the same person's rows cannot appear in both train and test — otherwise the model learns individual-level patterns that are impossible to generalize.
5. Model selection
- Baseline: logistic regression on tenure splines plus a handful of engagement features. Interpretable, fast, well-calibrated, and surprisingly hard to beat.
- Primary model: LightGBM on person-period rows. Handles missing values, scales well, and supports monotonic constraints (e.g. enforcing that more recent job-search activity is non-negatively associated with departure probability).
- Alternatives: DeepHit or a Transformer over monthly activity sequences captures richer temporal patterns but adds complexity and training cost. Justify the jump only if offline metrics clearly improve.
- Recalibration: Apply isotonic regression or Platt scaling per forecast horizon, because downstream consumers use raw probabilities directly in ranking and nudge logic.
6. Evaluation
Use a rolling-origin backtest across multiple cutoff months, not a single train/test split.
- Discrimination: time-dependent AUC at each horizon k, Uno's C-index (which correctly handles censoring), and PR-AUC given the ~1–2% monthly base rate.
- Calibration: reliability diagrams per horizon and the integrated Brier score with IPCW weighting for censored observations.
- Business lift: precision in the top-k% of scored members, and lift over the tenure-only baseline. The tenure baseline is a real bar — if your model does not beat it meaningfully, the complexity is not justified.
- Slice analysis: new members vs. long-tenure, low-engagement (cold-start) members, regions, seniority bands, and industries. Cold-start and low-activity members are the hardest subpopulations.
7. Fairness and deployment
Use protected attributes (gender, age band, region) for auditing only, never as input features. Check for calibration parity across groups: if the model systematically over-scores one demographic, downstream nudges and recruiter targeting will amplify that bias. Report disparate impact ratios and set thresholds per consumer use case, not globally.
At scale, run monthly batch scoring in a distributed framework. Store per-member hazard curves (not just a single score) so downstream systems can query any horizon. Monitor distribution shift on input features and on score distributions — a sudden spike in predicted hazard at a specific company often reflects real-world layoff news and is a useful sanity check, not a bug.
Common mistakes to avoid
- Treating censored members as negative examples — this introduces systematic bias toward underestimating hazard.
- Using a single train/test split instead of a rolling backtest — this hides temporal covariate shift.
- Forgetting to correct predicted probabilities after negative downsampling.
- Reporting only AUC without calibration — a well-discriminating model with poor calibration produces misleading probability estimates that break downstream ranking.
- Skipping the tenure-only baseline and claiming the complex model "works" without a meaningful comparison point.