KatInterview

Taming a High-Variance Regressor Under a Latency Budget

Machine LearningModel answer
HardModel answerMachine Learningregularizationoverfittinggradient-boosting

Last updated

Diagnose a severe train/validation RMSE gap on tabular data, then select, prioritize, and experimentally validate three overfitting interventions without exceeding a 20 ms inference limit.

The Situation

You are working on a production regression model over tabular data. After a recent training run you observe:

SplitRMSE
Train4,000
Validation9,500

Two hard constraints apply:

  1. No additional data can be collected.
  2. Online inference must complete in under 20 ms at p95 latency.

What You Are Asked to Do

  1. Diagnose what the error gap most likely indicates, and name at least one alternative cause you would rule out first.
  2. Select and rank three interventions from the list below. For each one, explain the mechanism by which it reduces overfitting and note any latency implications.
  3. Outline a concrete experiment plan: specify hyperparameter grids, a cross-validation strategy, monitoring metrics, stopping criteria, and how you would determine that an improvement is statistically meaningful.

Candidate Interventions (choose three and prioritize)

  • L1, L2, and elastic-net regularization — describe the expected effect on model weights or leaf values
  • Early stopping with a patience window
  • Reducing model capacity (tree depth, number of leaves, minimum samples per leaf)
  • Feature selection and target encoding with smoothing
  • Tabular data augmentation
  • K-fold cross-validation with stratification
  • Bagging vs. boosting trade-offs
  • Data leakage audits

What a Strong Answer Covers

  • The diagnostic step before any tuning
  • Clear prioritization logic that accounts for both variance reduction and the 20 ms constraint
  • Specific, numeric hyperparameter ranges — not just "tune lambda"
  • A validation protocol that produces unbiased estimates
  • Awareness of common failure modes (leakage, distribution shift, evaluation set contamination)

Hints

Hint 1

Before touching any hyperparameter, ask whether the validation metric is actually trustworthy — leakage or a distribution shift between splits can produce a gap that looks like overfitting but won't respond to regularization at all.

Hint 2

Latency and variance reduction often point in the same direction for tree models: shallower trees with fewer leaves are both faster to score and harder to overfit with. Start there before reaching for ensembles, which multiply inference cost.

Hint 3

Target encoding a high-cardinality categorical on the full training set is one of the most common sources of subtle leakage. Smoothing the mean toward a global prior and computing encodings out-of-fold are two separate fixes that address two separate problems.