Learning path: Prepare for ML Engineer Interviews · Step 11 of 13
The ML Depth Round: Five Questions That Always Come, in Thirty Seconds Each
Five ML depth questions that keep coming up (bias and variance, leakage, imbalance, regularisation, tree or network), each as a thirty-second answer in one shape, plus the follow-up that comes after it.
What you will learn
- Answer depth questions in one shape: what it is, how you spot it, what you do, then the follow-up
- Give thirty-second answers on bias and variance, leakage, imbalance, regularisation, and tree or network
- Prepare the follow-up each question usually brings
- Reach the edge of your knowledge honestly instead of bluffing
Before you start
- Polynomial Regression, Overfitting and Underfitting
- Train-Test Split and Data Leakage
In the ML depth round they ask you to explain things you've already used. Five questions keep coming up: bias and variance, leakage, imbalance, regularisation, and tree against network. For each one you'll get a thirty-second answer and the follow-up that usually comes after it. All numbers are for illustration.
One shape for every answer
Think of a viva. You give a good answer; the examiner nods and says "why?" You answer that too. Then "why?" again. They'll keep going until they find where your knowledge stops. Reaching that edge isn't failing; everybody gets there. What they score is what you do when you arrive. "I haven't tested that; here's how I would" is a strong answer.
1. Bias and variance
What it is. Bias is when the model is too simple, so it misses on the training data as well. Variance is when it has learned the training data too closely, so it falls over on new data.
How you spot it. Compare two scores:
| Train | Validation | Reading |
|---|---|---|
| 72 | 70 | Both low and close: bias |
| 99 | 70 | A big gap: variance |
What you do. For bias, give it more to work with: better features or a bigger model. For variance: more data, a simpler model, or regularisation. (Seen in practice in Overfitting and Underfitting.)
Follow-up: "Both scores are low and close, and more features didn't help. Now what?" Check the labels and the noise, because this data may only be able to tell you so much.
2. Leakage
What it is. The model trains on information it won't have at the moment it predicts. Say you're predicting whether a customer will leave, and one column holds the date they closed their account.
How you spot it. Validation looks too good, or one feature does nearly all the work, and then the score falls once it's in production.
What you do. Ask of every feature: would I have this at the moment I predict? When time matters, split by time, so you train on the past and test on the future (Time Splits and Group Splits).
Follow-up: "Where do your scaling values come from?" From the training rows only. If you use all the rows, a little of your test data has leaked in, and you get a slightly flattering score. See Split First, Learn After.
3. Imbalance
What it is. One class is rare. For illustration, one case in a hundred is fraud.
How you spot it. In the metric. A model that always says "no" gets 99% accuracy and catches nothing. So look at precision and recall on the rare class (Precision, Recall and F1).
What you do. Weight the rare class more, resample the training rows, or move the decision threshold. Which one, and how far, depends on what each kind of mistake costs (Handling Imbalanced Data).
Follow-up: "You resampled. Are your predicted chances still right?" No, they've shifted, because the model saw a different mix of classes. So you correct them, or you only use them for ordering (Probability Calibration).
4. Regularisation
What it is. A penalty for large weights, so the model has to pay for complexity.
How you spot the need. That gap between train and validation.
What you do. L2 shrinks all the weights a little. L1 can push some of them right to zero, so it also drops features. Choose the strength on validation data. With trees, limiting the depth does a similar job. (Ridge and Lasso.)
Follow-up: "Why would smaller weights help?" Because a small change in the input can't swing the output as far, so the model chases less noise. "And if you set it too strong?" You're back to bias.
5. Tree or network?
What it is, plainly. On tables, tree ensembles often do well with less data and less tuning. On images, text and sound, networks often win, because they learn the features for you.
How you spot which fits. The data's shape, and how much of it you have.
What you do. Start with the simple one as a baseline, then make the other one beat it. That's a habit, not a law, so say that part too.
Follow-up: "What can't a tree do?" It can't predict outside the range it saw in training, because each answer comes from values it has already seen. A good one to have ready. (Background: Decision Trees.)
More follow-ups and a rubric
Follow-ups can come from anywhere: What if your validation set is small? What if the two scores disagree from one run to another? How would you explain this to someone who isn't technical?
Mark yourself, one point each, out of 5:
| Row | You get the point if you... |
|---|---|
| Clear | said what it is in one sentence |
| Spot | said how you'd see it |
| Action | said what you'd do |
| Follow-up | survived one more "why" |
| Edge | said where your knowledge stops, without bluffing |
If it's a choice between a confident guess and an honest edge, take the honest edge. They can test the guess in one more question.
Recap
| Question | The thirty-second core |
|---|---|
| Bias and variance | Read the gap between two scores |
| Leakage | Information you won't have when you predict |
| Imbalance | Accuracy can look great while catching nothing |
| Regularisation | Trades a little bias for less variance |
| Tree or network | Start from the data's shape; make the other beat the baseline |
Try it yourself
Pick one of the five, answer it out loud in thirty seconds, then ask yourself "why?" three times.
Related course on Udemy
Machine Learning Engineer: From First Model to ML Engineer
Learn machine learning in Python, then ship it: data analysis, regression, classification, tuning, deployment and MLOps.View on Udemy ↗: Machine Learning Engineer: From First Model to ML Engineer (paid course, opens in a new tab)Related posts
The ML Engineer Interview Loop: Five Rounds, What Each One Looks For, and a Simple Rubric
The rounds you go through for one ML engineer job: recruiter screen, coding, ML depth, ML system design and behavioural. What each round looks for, the follow-up it brings, and a four-check rubric for your own answers.
The Answer Framework for Technical Interviews: Five Moves, Scored Out of 24
Good interview answers share one shape: a 30-second answer, the mechanism, the trade-off, the metric and the failure test. Worked on one question about a batch job starving everyone else, with a 24-point example rubric.
From Symptom to Pattern: How to Answer "Which Pattern Would You Use?" in an Interview
Start from what you can see, not from the pattern you know. A four-step rule (symptom, cost, metric and failure test, ship first), a symptom table, one worked answer for 429s at peak, and the trap of using a prompt as a lock.
The ML System Design Framework: Eight Steps, in Order, on a Spam Filter
One repeatable route through any ML system design question: goal, metric, data, features, model, serving, monitoring and failure. Worked on an email spam filter, with the follow-ups and a three-check rubric.