Skip to main content

Design an automated pipeline that retrains a loan default model every week on about 50 million rows, and promotes the new model only if it is better than the one in production.

System design · Pro 1

Short answer

Clarify the retraining trigger, the label delay and who approves a release. Then build pipeline steps: data validation, feature building, training with fixed versions of code and data, evaluation against the production model on the same holdout, a promotion gate, registration, and a canary release. Every run is tracked and reproducible, with alerts on failure.

Deeper answer

Ask first why weekly: is it a schedule, or should drift or a drop in performance trigger a run? Loan default labels take months to mature, so the newest rows have no outcome yet. The training window must end where labels are reliable.

The pipeline is a set of ordered steps run by an orchestrator. Step one validates the data: schema, row counts, null rates and distribution shifts against the last run. Step two builds features from a versioned snapshot. Step three trains with pinned code, configuration and random seed, and logs parameters and metrics to experiment tracking. Step four evaluates the candidate and the production model on the same time-based holdout, overall and on important slices. A gate promotes the candidate only if it beats the champion by a set margin and passes fairness and calibration checks. The model is then registered with its lineage and released as a canary.

Trade-offs: retraining often keeps the model fresh but costs compute and increases the chance of a bad release. At scale, the first failures are silent upstream data changes and long runs that do not finish.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

Experiment tracking and model registry

Practice System design questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.