KatInterview

Diagnosing and Fixing a Train–Test Performance Gap

Machine LearningModel answer
MediumModel answerMachine Learningoverfittingbias-varianceregularization

Last updated

Given a supervised model that scores much higher on training data than on held-out data, explain the bias-variance trade-off and work through a systematic plan to close the gap.

Scenario

You have trained a supervised learning model and evaluation reveals a striking pattern: the model achieves strong performance on the training set but falls noticeably short on the held-out test set.

Your Task

  1. Explain the bias-variance decomposition. Define each term, show how they combine to form expected prediction error, and describe what drives each one up or down.
  2. Diagnose the gap. A train-test gap is usually overfitting, but other causes can masquerade as it. Walk through the checks you would run before reaching for a fix.
  3. Propose concrete remedies. For each remedy, explain why it addresses variance rather than just naming it. Discuss trade-offs and rough ordering by cost and impact.
  4. Describe how you would confirm the fix worked.

A strong answer moves from theory → diagnosis → remedies → validation, and avoids jumping straight to "add regularization" without checking whether that is actually the right lever.

Hints

Hint 1

Before prescribing a fix, ask whether the gap is really overfitting — data leakage, distribution shift between splits, and poor split hygiene can each produce a similar-looking metric gap but require completely different solutions. Sketch out a quick checklist of diagnostic checks you would run first.

Hint 2

The bias-variance decomposition has a precise mathematical form: E[(y − f̂)²] = Bias² + Variance + σ². Think about what happens to each term as you increase model capacity, and use that to explain why the trade-off is U-shaped in test error rather than monotone.

Hint 3

Remedies differ in what they cost and how reliably they help. More data is the most robust fix when the learning curve shows the gap still closing, but it is expensive to collect. Regularization is cheap to try but scale-dependent. Ensembling reliably cuts variance but multiplies inference cost. Organizing your answer around these trade-offs signals engineering judgment, not just memorization of a…