Table of Contents
🌏 中文版
Today's Topic
Monday's rotation is ML Fundamentals — the baseline layer that shows up in nearly every ML/AI Engineer interview, not because interviewers want you to recite formulas, but because they want to hear you explain, on a whiteboard, why a model behaves the way it does. 2026 interview guides still rank bias-variance, regularization, cross-validation, and evaluation metrics among the most common phone-screen topics, because these concepts are the foundation everything later — feature stores, monitoring, A/B testing — gets built on. Today's material targets exactly the early-round questions that are easy to get asked and easy to lose points on by sounding rehearsed.
Core Concepts Cheat Sheet
The bias-variance tradeoff
A model can't minimize bias and variance simultaneously — making it more complex to reduce bias (fit training data more closely) typically raises variance (more sensitivity to training noise); simplifying it does the reverse. It's best framed as a continuous spectrum rather than a binary choice in an interview: the goal is minimizing test error, not driving training error to zero.
L1, L2, and Elastic Net regularization
Regularization adds a penalty term to the loss function to keep weights from growing unchecked. L1 (Lasso) adds the sum of absolute coefficient values — Loss + λΣ|wᵢ| — and drives some coefficients to exactly zero, performing automatic feature selection, which suits cases where most features are actually irrelevant. L2 (Ridge) adds the sum of squared coefficients — Loss + λΣwᵢ² — shrinking all coefficients toward zero without zeroing them out, which suits cases where most features carry some signal. Elastic Net combines both, with λ tuned via cross-validation.
Overfitting vs. underfitting: how to tell, how to fix
Overfitting means the model has memorized the training data's noise — low training error, high test error, detectable as a large gap between train and validation accuracy. Fixes: add regularization (L1/L2/dropout), simplify the model, add training data, use cross-validation, apply early stopping. Underfitting means the model is too simple — both training and test error are high. Fixes: use a more complex model, add features, reduce regularization strength, train longer. Stating the symptoms clearly carries more weight in an interview than reciting the fixes alone.
Choosing a cross-validation scheme
K-fold CV splits data into K folds, trains on K-1, validates on 1, and rotates — giving a more reliable generalization estimate than a single train/validation split. Stratified K-fold preserves class proportions within each fold, which is essential for imbalanced datasets — otherwise a fold might end up with no positive samples at all. Time-series cross-validation must respect temporal order — you can only ever validate on data that comes after what you trained on; splitting carelessly is a direct form of data leakage.
Evaluation metrics: which one for which scenario
Accuracy is misleading under class imbalance — a dataset with 1% positives gets 99% accuracy by predicting all-negative. Precision (of everything predicted positive, how much is actually positive) matters most when false positives are costly, like a spam filter blocking an important email. Recall (of everything actually positive, how much did you catch) matters most when false negatives are costly, like a cancer screening missing a real case. AUC-ROC is a threshold-independent ranking metric, useful when the threshold isn't fixed yet or you're comparing models across operating points; when positives are extremely rare, precision-recall AUC is the better call instead of ROC AUC.
Today's Practice Question
The Question
A model performs well in the development environment (offline validation set) but regresses noticeably after being deployed to production. Walk through how you'd investigate.
Source: DataExpertise, "Machine Learning Interview Questions and Answers — Top 60 for 2026" Difficulty: Intermediate to advanced Round: phone screen / onsite systems-debugging question
How to Break It Down
- Clarify first: Pin down what "regressed" actually means — which metric dropped, by how much, whether the drop started immediately at launch or crept in gradually, whether it's uniform across users or concentrated in a specific segment, and whether the feature pipeline or data sources changed around launch time. The answers determine which direction to dig in next.
- Build a framework: Investigate roughly in order of likelihood — first, pipeline bugs (is the feature logic identical between training and serving, i.e. training-serving skew); second, input distribution shift (is production's input distribution different from training's); third, concept drift (has the relationship between features and target itself changed); fourth, circle back to data leakage introduced during training (features that used information unavailable at real inference time).
- Go deep on the core: The detail most likely to get a follow-up question is training-serving skew — a feature like "user's average order count over the last 7 days" might be computed via a one-off batch SQL job at training time but computed incrementally in real time at serving time; the computation timing and missing-value handling can easily diverge between the two, and offline validation alone will never catch it, since offline evaluation reuses the same training-time logic.
- Close strong: Propose a monitoring feedback loop so the next occurrence gets caught faster, not just fixed once — feature distribution drift alerts (comparing production vs. training statistics), prediction distribution monitoring (a sudden shift in output distribution usually surfaces before ground-truth labels come back), and shadow deployment for any model update, comparing online and offline predictions before it takes real traffic.
Sample Answer (What You'd Actually Say)
Framing the problem: I'd first pin down exactly what "regressed" means — which metric, by how much, whether the drop is uniform or concentrated in a segment, and whether the feature pipeline changed around launch. That determines whether I start from pipeline bugs or distribution shift.
Systematic investigation: I'd check in order of likelihood — first, whether the feature computation logic is literally the same code path in training and serving, since that's the most common and easiest-to-verify form of training-serving skew; next, I'd pull production input statistics (means, missing-value rates, category distributions) and compare against training data for an obvious distribution shift; only if both come back clean would I move on to concept drift or data leakage introduced during training, since those take longer to confirm.
Prevention over firefighting: Once this instance is fixed, I'd add feature drift alerts and prediction distribution monitoring so the next shift gets caught before it hits real business metrics, and require any model revision to run a shadow deployment period before it takes production traffic.
Self-Check List
Use this table to check whether your answer covered the key points:
| Check item | Covered? |
|---|---|
| Clarified what "regressed" means quantitatively, which segment, and what changed at launch | |
| Mentioned training-serving skew (feature computation logic differing between training and serving) | |
| Distinguished data drift from concept drift | |
| Didn't skip the possibility of data leakage introduced during training | |
| Investigation order was logical (checked the most common, easiest-to-verify causes first) | |
| Bonus: proposed a monitoring feedback loop (drift alerts, prediction monitoring, shadow deployment) to prevent recurrence |
Further Reading
- Master the Bias-Variance Tradeoff: Top 10 Interview Questions — Analytics Vidhya — Walks bias-variance from definition to practical judgment across ten questions, good for filling in detail today's cheat sheet didn't expand on.
- bias-and-variance-interview-questions — Devinterview-io (GitHub) — A question-bank-style collection of bias-variance interview Q&A, useful for rehearsing out loud.
- Crash Course to Crack Machine Learning Interview - Part 1: Bias vs Variance — buildml — Frames bias-variance as part of a full interview-prep series, with a clear line to the topics that follow it.
References
- Machine Learning Interview Questions and Answers — Top 60 for 2026 — DataExpertise — Source for the regularization (L1/L2/Elastic Net), overfitting/underfitting diagnosis and fixes, cross-validation selection, evaluation metrics sections, and today's practice question.
- Master the Bias-Variance Tradeoff: Top 10 Interview Questions — Analytics Vidhya — Source for the bias-variance tradeoff framing.
Loading...