# Machine learning interview questions and how to answer them

Updated: 2026-11-13. https://thegccengineer.com/guides/ml-interview-questions

**Quick answer:** Machine learning interview questions mostly test fundamentals: the bias-variance trade-off, overfitting and regularisation, evaluation metrics for imbalanced data, data leakage, tree ensembles, gradient descent and drift in production. A strong answer gives a one-sentence definition, the intuition behind it, a concrete example and the practical consequence. The ten questions here are representative practice questions with answer outlines, not a list from any company.

Machine learning interview questions concentrate on a small set of fundamentals: generalisation, evaluation, data handling, the main model families, optimisation and what happens to a model in production. A strong answer has four moves: a one-sentence definition, the intuition, a concrete example and the practical consequence. The ten questions below are representative practice questions with answer outlines; they are not taken from any company's interviews.

## What do machine learning interviews test?

Machine learning interviews test whether you understand why methods work, because that understanding is what lets you debug a model that does not. Interviewers usually start with a project from your resume, then move to fundamentals, going one level deeper with each follow-up until they find the limit of your understanding. Reaching that limit is normal and is not a failure.

| Area | Typical question theme | What a follow-up probes |
| --- | --- | --- |
| Generalisation | Bias and variance, overfitting, regularisation | Can you diagnose from learning curves? |
| Evaluation | Metrics, imbalance, validation design | Do you know when a metric misleads? |
| Data | Leakage, missing values, feature handling | Have you been burned by real data? |
| Models | Linear models, trees, ensembles, neural networks | Can you choose between them with reasons? |
| Production | Drift, monitoring, retraining | Do you think beyond the notebook? |

*The five areas a fundamentals round usually covers.*

This round is the depth round in the [GCC AI interview process](https://thegccengineer.com/guides/gcc-ai-interview-process). If any topic below feels unfamiliar, revise it in [machine learning fundamentals](https://thegccengineer.com/guides/machine-learning-fundamentals) first.

## How should you answer a machine learning interview question?

Answer a machine learning interview question in four moves, and stop after the fourth so the interviewer can steer.

**Four moves for a fundamentals answer**

1. **Define**: One plain sentence. No jargon you could not explain if asked.
2. **Give the intuition**: Why it happens or why it works, in everyday terms.
3. **Give an example**: A small concrete case, ideally from your own project.
4. **State the consequence**: What you would do differently in practice because of it.

**Answering: 'What is overfitting?'**

**Weak answer**

- 'When the model is too complex' and nothing more
- No way to detect it
- Lists regularisation types without saying what they do

**Strong answer**

- The model learns noise in the training data, so it scores well on training data and worse on unseen data
- Detected by a gap between training and validation error
- Fixed with more data, a simpler model, regularisation or early stopping, with one example from a real project

## Questions on generalisation

### 1. Explain the bias-variance trade-off.

- **Bias** is error from a model too simple to capture the pattern; it underfits, with high error on both training and validation data.
- **Variance** is error from a model too sensitive to the particular training sample; it overfits, with low training error and a large gap to validation error.
- Increasing model complexity usually lowers bias and raises variance, so the aim is the complexity where validation error is lowest.
- Diagnose with learning curves: two high, close curves suggest bias; a wide gap suggests variance.
- Consequence: high bias calls for a richer model or better features; high variance calls for more data, regularisation or a simpler model.

### 2. What is the difference between L1 and L2 regularisation?

- Both add a penalty on weight size to the loss, which discourages the model from fitting noise.
- L1 penalises the sum of absolute weights and tends to push some weights exactly to zero, giving a sparse model and a form of feature selection.
- L2 penalises the sum of squared weights and shrinks all weights smoothly towards zero without removing them; it handles correlated features more stably.
- Choose L1 when you suspect many features are irrelevant; L2 as a general default. The penalty strength is a hyperparameter tuned on validation data.
- Features should be on comparable scales first, or the penalty treats them unequally.

## Questions on evaluation

### 3. Your fraud model has 99% accuracy. Is it a good model?

- Not necessarily. When fraud is rare, a model that predicts "not fraud" for everything is also highly accurate and catches nothing.
- Use precision (of the cases flagged, how many were fraud) and recall (of the fraud cases, how many were flagged).
- The right balance depends on costs: a missed fraud against a blocked genuine customer. Choose the decision threshold from those costs.
- Compare models with the precision-recall curve, which is more informative than ROC AUC when positives are rare.
- Check the result against a simple baseline and on recent data, since fraud patterns change.

### 4. What is data leakage, and how do you prevent it?

- Data leakage is when training uses information that would not be available at prediction time, so offline scores look better than production results.
- Target leakage: a feature that is recorded after the outcome, such as a "chargeback filed" flag in a fraud model.
- Preprocessing leakage: fitting a scaler or imputing missing values on the full dataset before splitting.
- Time leakage: random splits on time-ordered data, so the model trains on the future.
- Prevent it by splitting first, fitting every transformation on training data only inside a pipeline, splitting by time or by group where rows are related, and being suspicious of results that look too good.

### 5. How do you validate a model when data is limited?

- Use k-fold cross-validation: train on all folds but one, validate on the remaining fold, rotate, and average, which gives a steadier estimate than one split.
- Use stratified folds for imbalanced classes, grouped folds when several rows belong to one customer or patient, and forward-chaining splits for time series.
- Keep a final test set untouched until the end; tuning on it turns it into another validation set.
- Report the spread across folds as well as the mean.

## Questions on models and optimisation

### 6. How does gradient boosting differ from a random forest?

- Both are ensembles of decision trees.
- A random forest trains many deep trees independently on bootstrap samples with random feature subsets and averages them; averaging mainly reduces variance.
- Gradient boosting trains shallow trees one after another, each fitting the errors of the ensemble so far; the sequence mainly reduces bias.
- Random forests are robust with little tuning and train in parallel. Boosting often reaches higher accuracy on tabular data but is more sensitive to learning rate, tree count and depth, and can overfit without early stopping.

### 7. Why is logistic regression called a linear model, and how is it trained?

- Logistic regression computes a weighted sum of features and passes it through the sigmoid function to produce a probability.
- It is linear because the decision boundary is a straight line or plane in feature space: the log-odds are a linear function of the inputs.
- It is trained by minimising log loss (cross-entropy), which heavily penalises confident wrong predictions, typically with gradient descent.
- Its strengths are speed, interpretable coefficients and well-behaved probabilities, which is why it remains a standard baseline.
- It cannot capture feature interactions unless you add them as features.

### 8. What happens if the learning rate is too high or too low?

- Gradient descent updates weights by a step against the gradient; the learning rate sets the step size.
- Too high: the loss oscillates or diverges because updates overshoot the minimum.
- Too low: training is slow and may stall on a plateau.
- Practical handling: start with a sensible default, watch the training loss curve, use a schedule that lowers the rate over time, and use an adaptive optimiser such as Adam.
- Mention mini-batches: they give noisy but cheap gradient estimates, which is why they are standard.

## Questions on data and production

### 9. How do you handle missing values and categorical features?

- First ask why values are missing; missingness can itself carry signal, so an indicator column is often useful.
- Impute numeric values with the median or a model-based estimate, fitted on training data only.
- One-hot encode categorical features with few levels. For many levels, consider frequency or target encoding, taking care to compute target encoding inside cross-validation to avoid leakage.
- Plan for categories that first appear in production with an "unknown" bucket.
- Scaling matters for linear models, distance-based models and neural networks; tree models do not need it.

### 10. Your model's performance dropped after deployment. What do you check?

- Rule out pipeline problems first: a broken upstream feed, a changed schema or unit, or features computed differently in production than in training.
- Then check data drift: have the input distributions shifted compared with training data?
- Then check concept drift: has the relationship between inputs and the outcome changed, as happens with new fraud tactics or a pricing change?
- Confirm with fresh labels where available, noting that labels may arrive late.
- Respond by fixing the pipeline, retraining on recent data or revisiting features, and add monitoring so the next drop is caught early. The operating practices are in [MLOps basics](https://thegccengineer.com/guides/mlops-basics).

## How do you prepare for machine learning interview questions?

Prepare for machine learning interview questions by explaining each idea aloud in your own words and attaching it to something you built. For every project on your resume, be ready to say which metric you chose and why, how you validated, what leaked or went wrong, and what you would change.

Fundamentals are one round among several. Roles built on large language models add the topics in [GenAI interview questions](https://thegccengineer.com/guides/genai-interview-questions), and mid-level and senior loops add the [ML system design interview](https://thegccengineer.com/guides/ml-system-design-interview). The expectations of the role itself are in the [ML engineer role guide](https://thegccengineer.com/guides/ml-engineer-role). To find which fundamentals you should revise first, take the [free readiness check](https://thegccengineer.com/signup) on The GCC Engineer.

## Key takeaways

- Fundamentals rounds reward clear explanations of a small set of ideas, not breadth of algorithms.
- Answer in four moves: definition, intuition, example, practical consequence.
- Expect follow-ups that go one level deeper, so prepare the 'why' behind every definition.
- Evaluation questions are the most common place candidates lose marks: know when accuracy misleads.
- Tie answers to your own projects whenever you can.

## Frequently asked questions

### How much maths do you need for machine learning interviews?

For most ML engineer roles you need working intuition, not proofs: what a gradient is, why a loss function is minimised, basic probability, and the idea of variance. Applied scientist roles go further, into derivations and statistical testing. If you can explain logistic regression's loss and gradient descent in plain words with the formula as support, you are at the right level for most engineering rounds.

### Do machine learning interviews ask for derivations on a whiteboard?

Occasionally, and mostly for research-leaning roles. The usual candidates are the gradient of the logistic loss, the linear regression solution, and backpropagation through a small network. For engineering roles, interviewers more often ask you to explain the idea and its consequences. Preparing one or two derivations is sensible insurance without taking over your preparation.

### Are deep learning questions asked for ML engineer roles?

Yes, at a conceptual level in most loops: what backpropagation does, why activation functions are needed, what dropout and batch normalisation are for, and how embeddings represent items. Depth depends on the job description. A role centred on tabular data leans on tree models; a role in vision, speech or language goes further into neural networks.

### How do you answer when the interviewer asks about an algorithm you have not used?

Say so, then reason from what you know. Place the algorithm in a family, describe what that family optimises, and compare it with a method you have used. For example, relate an unfamiliar boosting library to gradient boosting in general. Interviewers accept honest gaps; they mark down confident explanations that turn out to be wrong.

### Should you memorise answers to machine learning interview questions?

Memorise definitions only. Interviewers follow up with 'why' and 'what if', and a memorised answer collapses at the second question. Practise explaining each idea aloud in your own words, with an example from your own work, until you can handle a change to the question. Understanding that survives follow-ups is what the round measures.
