· Interview Prep · 8 min read
Machine Learning Interview Questions for Data Scientists
Machine learning interview questions for data scientists: data splits, gradient descent, classification versus regression, and production monitoring.
Machine learning interview questions for data scientists usually cover five areas: how you split and evaluate data, how models learn, how you choose a problem type, and what you do when a model is already live. This guide walks through each topic with practical answers you can use in real interviews.
TL;DR:
- Split data into training, validation, and test sets, and never evaluate on data used for training.
- Match the problem type to the outcome: classification predicts categories, regression predicts continuous values.
- Watch for drift and monitor metrics and distributions after a model goes live.
What is the difference between training data and testing data?
Training data is the portion of data the algorithm uses to learn patterns and set parameters. Testing data is held out and never seen during training, so it gives an unbiased measure of how the model performs on new examples. Evaluating on training data alone would overstate performance because the model has already seen the answers. A good test set also reflects the real-world distribution the model will face in production.
Why do you need a validation set?
Many models have hyperparameters, such as the number of layers in a neural network or the learning rate, that you cannot learn directly from training data. A validation set is a slice of the training data reserved for tuning those choices. You pick the settings that perform best on validation data, then report final performance on the untouched test set. A common mistake is tuning on the test set itself, which leaks information and makes performance look better than it will be in production.
Example with a 10,000-row dataset: a common split is 7,000 rows for training, 1,500 for validation, and 1,500 for testing. The exact ratio depends on your data size and the problem, so treat these numbers as an illustration, not a rule.
How do batch, mini-batch, and stochastic gradient descent differ?
Gradient descent finds the minimum of a loss function by taking steps in the direction of the steepest descent. The variants differ in how much data they use for each step.
| Variant | Data used per step | Memory need | What to expect |
|---|---|---|---|
| Batch gradient descent | The full training set | High; very large datasets may not fit | Stable updates, but slow per step on big data |
| Mini-batch gradient descent | Small fixed-size batches | Moderate; fits well on GPU memory | Faster updates; the noise acts as a light regularizer |
| Stochastic gradient descent | Shuffled data in small batches or single examples | Low to moderate | Noisiest updates; use a careful learning rate schedule |
Choose batch or mini-batch when memory allows and stability matters. Choose stochastic or small mini-batches for very large datasets or when you want the noise to help escape shallow local minima. In interviews, name the variant that fits the data size and mention the learning rate, since step size affects convergence just as much as the variant choice.
How do you choose between classification and regression?
Classification predicts a category, such as whether an email is spam or not. Regression predicts a continuous number, such as next month’s spending in dollars. The same raw problem can sometimes be framed either way: you could predict exact spending with regression, or bin spending into low, medium, and high buckets and treat it as classification. Pick the framing that matches the decision you need to support and the data you have. Evaluation also differs: classification is often judged with precision, recall, or F1, while regression uses metrics such as mean absolute error or root mean squared error.
When should you refresh a model in production?
Refresh a model when live performance degrades relative to the training baseline. Follow these steps:
- Check the launch metrics, such as precision, recall, or accuracy, against the baseline measured during training.
- Confirm whether you have ground truth labels for recent production data; if labels arrive late, use proxy metrics in the meantime.
- Compare the distribution of input features in production against the training distribution.
- Compare prediction distributions and model confidence scores over time.
- Retrain only when evidence shows a real, sustained drop rather than normal week-to-week variation. Document the trigger and the owner of the retraining decision so the team acts on evidence rather than a single bad week.
Ground truth is not always available immediately, so monitoring input and prediction distributions is often the earliest warning sign.
Why does model performance drop after deployment?
A common cause is concept drift: the relationship between input features and the outcome changes over time, so the assumptions made during training no longer apply. Another cause is a shift in the input data itself, such as new user behavior or a change in data collection. Some models are also more sensitive to out-of-distribution data than others; models with wider decision boundaries tend to be more robust. Track metrics, feature distributions, and prediction distributions to detect the shift early. Set a monitoring cadence, such as weekly metric reviews, so drift is caught before it affects users.
How do you handle exploding gradients during training?
Exploding gradients happen when gradient values grow very large during backpropagation through many layers, making training unstable. Common fixes include clipping gradients at a threshold, using batch normalization after layers to rescale activations, reducing the number of hidden layers, or choosing architectures with skip connections that give gradients a shorter path through the network. In an interview, name two or three fixes and compare them, for example that clipping is simple to apply but can slow learning if the threshold is too low.
When answering, structure your response in three parts: define the term, give a short example, and name the trade-off. Interviewers care more about your reasoning process than a perfect definition.
For adjacent topics such as large language model system design and retrieval-augmented generation, see AI Talent Report blog. The question bank at AI Talent Report blog covers the full interview loop for AI and machine learning roles.
The 0→1 AI Engineer Interview Playbook ($19.99, one-time purchase) and the free practice tools are featured on the AI Talent Report home page.
FAQ
Should I tune hyperparameters on the test set?
No. Tune on a validation set and keep the test set untouched until the final evaluation. Tuning on the test set produces an optimistic estimate that usually does not hold up in production.
What is overfitting, and how do you spot it?
Overfitting is when a model learns the training data, including its noise, and fails to generalize to new data. You spot it when training error is much lower than validation or test error. Options include simplifying the model, adding regularization, or collecting more data.
How do precision and recall differ?
Precision measures how many predicted positives were actually correct, while recall measures how many actual positives were found. Favor precision when false positives are costly, and recall when missing a positive case is costly.
Why does feature scaling matter for gradient descent?
Features on very different scales create an uneven loss surface, so gradient descent takes unstable steps and converges more slowly. Scaling features to similar ranges helps updates move toward the minimum more directly.
What is concept drift?
Concept drift is when the relationship between inputs and the outcome changes over time, so a trained model’s assumptions no longer hold. It is a common reason production performance drops. Monitor metrics and data distributions to catch it early.
VERIFIED: wrote D:\ClaudeCode\ops\dsh_jobs\video_articles_drafts\ai-engineer-interview-questions\machine-learning-interview-questions-for-data-scientists.md, 1218 words.
Based on a video by Aced (formerly Exponent): Top 6 ML Engineer Interview Questions (with Snapchat MLE). Written in our own words with added steps and an FAQ.

