Skip to content

Machine Learning Engineer interview questions

100 real questions with model answers and explanations for Junior candidates.

See a Machine Learning Engineer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

supervisedunsupervised

The difference is whether the training data includes known target labels.

  • Supervised learning maps inputs to provided targets.
  • Unsupervised learning finds structure in unlabeled data.
  • Classification and regression are supervised, while clustering is unsupervised.

Why interviewers ask this: The interviewer checks whether you can distinguish learning from labeled targets from discovering patterns without them.

classification

Classification predicts categories, while regression predicts numerical values.

  • A spam detector is a classification model.
  • A house price predictor is a regression model.
  • Both are supervised tasks when examples include target values.

Why interviewers ask this: A strong answer identifies the type of target produced by each task.

ml

Features are model inputs, and the target is the value the model learns to predict.

  • Features can be measurements, categories, or derived values.
  • The target is available during supervised training.
  • Feature quality strongly affects what patterns a model can learn.

Why interviewers ask this: The interviewer is evaluating whether you can correctly define the inputs and desired output of a supervised problem.

validation

The three sets separate model fitting, model selection, and final evaluation.

  • The training set is used to learn model parameters.
  • The validation set is used to tune hyperparameters and compare models.
  • The test set estimates performance on unseen data after all choices are fixed.

Why interviewers ask this: The interviewer checks whether you know how separate datasets prevent an overly optimistic evaluation.

overfitting

Overfitting means learning the training data too closely, while underfitting means missing useful structure.

  • An overfit model performs well on training data but poorly on new data.
  • An underfit model performs poorly on both training and new data.
  • Model complexity, regularization, and data volume affect both problems.

Why interviewers ask this: A strong answer relates model fit to both training performance and generalization.

bias-variancedispersion

The bias-variance tradeoff balances errors from models that are too simple and models that are too sensitive to training data.

  • High bias often causes underfitting.
  • High variance often causes overfitting.
  • Good generalization requires an appropriate balance between them.

Why interviewers ask this: The interviewer wants to see that you connect model complexity with underfitting and overfitting.

regularization

L1 and L2 regularization penalize model weights in different ways.

  • L1 adds a penalty based on absolute weight values.
  • L2 adds a penalty based on squared weight values.
  • L1 can produce zero weights, while L2 usually shrinks weights smoothly.

Why interviewers ask this: A strong answer explains both the penalty formulas and their different effects on weights.

hyperparameters

Parameters are learned from data, while hyperparameters are chosen around the training process.

  • Linear regression coefficients are model parameters.
  • Learning rate and tree depth are hyperparameters.
  • Hyperparameters are commonly selected using validation results.

Why interviewers ask this: The interviewer checks whether you distinguish fitted values from settings that control model training or structure.

loss-functions

A loss function measures how far model predictions are from desired outputs.

  • Training aims to minimize the loss.
  • Different tasks need different loss functions.
  • The loss gives the optimization algorithm a numerical objective.

Why interviewers ask this: A strong answer connects prediction error, optimization, and the choice of task-specific objective.

loss-functions

Mean squared error is the average squared difference between predictions and true values.

  • It is commonly used for regression.
  • Squaring makes every contribution nonnegative.
  • Large errors receive a stronger penalty than small errors.

Why interviewers ask this: The interviewer checks whether you understand why MSE emphasizes large regression errors.

loss-functions

Cross-entropy measures how well predicted class probabilities match the true classes.

  • It is commonly used for classification.
  • Confident incorrect predictions receive a large penalty.
  • Lower cross-entropy means better probability assignments to the true labels.

Why interviewers ask this: A strong answer explains that cross-entropy evaluates probabilities rather than only final class labels.

training

Gradient descent repeatedly updates model parameters in the direction that reduces the loss.

  • The gradient shows how the loss changes with each parameter.
  • Parameters move in the opposite direction of the gradient.
  • Repeated updates can approach a local loss minimum.

Why interviewers ask this: The interviewer is evaluating whether you understand how derivatives guide parameter updates.

optimization

The learning rate controls the size of each parameter update during optimization.

  • A rate that is too small can make training slow.
  • A rate that is too large can overshoot good parameter values.
  • A suitable rate helps training converge reliably.

Why interviewers ask this: A strong answer connects the learning rate to both optimization speed and stability.

trainingbatch

They differ in how many training examples are used for each parameter update.

  • Batch gradient descent uses the full training set.
  • Stochastic gradient descent uses one example at a time.
  • Mini-batch gradient descent uses a small group and is common in practice.

Why interviewers ask this: The interviewer checks whether you understand how batch size changes update cost, frequency, and noise.

scaling

Feature scaling puts numerical features on comparable scales.

  • It prevents large-valued features from dominating distance calculations.
  • It can make gradient-based optimization converge faster.
  • Trees usually need scaling less than k-nearest neighbors or linear models.

Why interviewers ask this: A strong answer identifies which model families are sensitive to feature scale.

normalization

Standardization centers values by their mean and spread, while normalization usually maps them to a fixed range.

  • Standardization commonly produces mean zero and standard deviation one.
  • Min-max normalization commonly maps values between zero and one.
  • Both transformations must be fitted on training data only.

Why interviewers ask this: The interviewer checks whether you know the transformations and how to apply them without leakage.

missing-data

Missing values can be removed, imputed, or represented explicitly.

  • Drop rows or columns only when the data loss is acceptable.
  • Impute with statistics such as the median or with model-based estimates.
  • Add a missing-value indicator when absence may carry information.

Why interviewers ask this: A strong answer presents several methods and recognizes that the reason for missingness matters.

ml

Categorical variables are converted into numerical representations that a model can process.

  • One-hot encoding creates a binary column for each category.
  • Ordinal encoding assigns ordered numeric values.
  • The encoder must learn its categories from training data only.

Why interviewers ask this: The interviewer evaluates whether you can encode categories without inventing false relationships or leaking data.

feature-engineering

Ordinal encoding suits categories with a meaningful order, while one-hot encoding suits unordered categories.

  • Sizes such as small, medium, and large have a natural rank.
  • Colors usually have no natural order.
  • Arbitrary numeric codes can create false relationships between categories.

Why interviewers ask this: A strong answer makes the encoding reflect the real structure of the feature.

outliers

Outliers are observations that differ substantially from most of the data.

  • They may be valid rare cases or data errors.
  • They can strongly affect means, MSE, and some fitted models.
  • Their cause should be investigated before removal or transformation.

Why interviewers ask this: The interviewer checks whether you avoid deleting unusual values without understanding them.

Locked questions

  • 21

    What is feature engineering?

    feature-engineering
  • 22

    What is data leakage?

    leakage
  • 23

    What is class imbalance and how can it be handled?

    imbalance
  • 24

    What does accuracy measure in classification?

    classification
  • 25

    What is the difference between precision and recall?

    evaluation
  • 26

    What is the F1 score?

    classification-metrics
  • 27

    What does a confusion matrix show?

    evaluation
  • 28

    What does ROC-AUC measure?

    evaluation
  • 29

    What do the precision-recall curve and PR-AUC show?

    evaluation
  • 30

    How do MAE, RMSE, and R-squared evaluate regression models?

    evaluationdecision-making
  • 31

    What is a baseline model and why is it useful?

    modeling
  • 32

    How does k-fold cross-validation work?

    cross-validationvalidation
  • 33

    What is stratified cross-validation?

    cross-validationvalidation
  • 34

    How should time-series data be split for validation?

    validation
  • 35

    How does linear regression work, and what are its main assumptions?

    regression
  • 36

    How does logistic regression perform classification?

    classificationregression
  • 37

    How does a decision tree make predictions?

    trees
  • 38

    How does a random forest differ from a single decision tree?

    ensemblestrees
  • 39

    How does gradient boosting work?

    boosting
  • 40

    How does k-nearest neighbors make a prediction?

    knn
  • 41

    What is the main idea behind a support vector machine?

    svm
  • 42

    How does a naive Bayes classifier work?

    bayesian
  • 43

    How does k-means clustering work?

    clustering
  • 44

    What is principal component analysis used for?

    components
  • 45

    What happens during the forward pass of a neural network?

    neural-nets
  • 46

    What is backpropagation?

    neural-networks
  • 47

    Why do neural networks need activation functions?

    neural-netsactivation
  • 48

    What are an epoch, a batch, and an iteration?

    batchiteration
  • 49

    What is a scikit-learn Pipeline used for?

    ci-cd
  • 50

    What roles do NumPy, Pandas, scikit-learn, PyTorch, and TensorFlow play in ML?

    pandasnumpypytorch
  • 51

    You need to predict customer churn from tabular data. What would you build first?

    churn
  • 52

    Only 1% of transactions in a fraud dataset are fraudulent. How would you evaluate a classifier?

    decision-makingtransactions
  • 53

    A screening model must avoid missing people who may have a disease. Which metric would you prioritize?

    monitoring
  • 54

    Users complain that a spam filter hides legitimate emails. How would you adjust your evaluation?

  • 55

    Your classifier outputs probabilities, but the default threshold of 0.5 performs poorly. What would you do?

    thresholding
  • 56

    A model has 96% accuracy, but users say it misses most rare cases. How would you investigate?

  • 57

    A neural network is slightly more accurate than logistic regression, but it is much slower. Which would you choose?

    neural-netsregression
  • 58

    Training accuracy keeps improving while validation accuracy gets worse. How would you respond?

    validation
  • 59

    Both training and validation performance are poor. What would you check first?

    validationperformance
  • 60

    Validation accuracy suddenly jumps from 75% to 99% after adding one feature. What would you suspect?

    validation
  • 61

    You are predicting next week's demand from historical sales. How would you split the data?

  • 62

    The same customer can appear in many rows. How would you prevent an overly optimistic split?

    locking
  • 63

    A teammate scales all data before creating train and test sets. What problem does this cause?

    train-test
  • 64

    A loan model uses a field called final_collection_status. Would you keep it?

  • 65

    Production sends a category that your encoder never saw during training. How would you handle it?

  • 66

    Several numeric columns contain missing values. How would you handle them?

    missing-dataschema
  • 67

    A regression dataset contains a few extremely large values. What would you do before removing them?

  • 68

    Manual review shows that many training labels are wrong. How would you proceed?

  • 69

    How would you improve a classifier trained on highly imbalanced data?

    imbalanced
  • 70

    You have only a few thousand labeled examples. How would you approach modeling?

  • 71

    How would you use training, validation, and test sets during a project?

    validation
  • 72

    Cross-validation scores vary widely between folds. How would you investigate?

    cross-validationvalidation
  • 73

    A feature named record_id is the model's strongest feature. What would you do?

  • 74

    Your test score is good, but the test data comes from a different source than production. What would you do?

    test-data
  • 75

    An offline metric improves, but an A/B test shows no product benefit. How would you investigate?

    ab-testingmonitoring
  • 76

    A teammate cannot reproduce your best experiment. What would you provide?

    experimentsdebugging
  • 77

    The training data changes every week. How would you keep experiments comparable?

    experiments
  • 78

    What would you record for each model experiment?

    experiments
  • 79

    How would you turn a notebook prototype into a repeatable training workflow?

    prototypes
  • 80

    What would you test in a preprocessing pipeline?

    ci-cd
  • 81

    How would you expose a scikit-learn model through a basic prediction API?

    api
  • 82

    When would you choose batch predictions instead of an online API?

    batchapi
  • 83

    A prediction endpoint is too slow. How would you debug it?

    endpoints
  • 84

    Your model uses too much memory to fit on the target server. What would you try?

    memory
  • 85

    What input checks would you add to a model endpoint?

    endpoints
  • 86

    How would you release a new model without sending all traffic to it immediately?

  • 87

    What would make a model deployment easy to roll back?

    deploymentrollback
  • 88

    Which service metrics would you monitor for a prediction API?

    monitoringapi
  • 89

    How would you detect that production inputs have drifted from training data?

    iac
  • 90

    Ground-truth labels arrive 30 days after predictions. How would you monitor model quality?

    monitoring
  • 91

    When would you retrain a deployed model?

    retrainingdeployment
  • 92

    A user reports one obviously wrong prediction. How would you debug it?

  • 93

    Offline predictions differ from production predictions for the same record. What would you check?

  • 94

    An upstream team renames a feature column and predictions start failing. How would you handle the incident and prevent a repeat?

    incidentsschema
  • 95

    A product manager asks whether your model will be 90% accurate in production. How would you answer?

  • 96

    You are stuck debugging a training pipeline. When and how would you ask for help?

    problem-solvingci-cd
  • 97

    A reviewer disagrees with your model implementation. How would you handle it?

    conflict
  • 98

    A teammate shares a notebook with a promising result that nobody else can reproduce. What would you do?

  • 99

    A deadline is close, and the best model misses the latency requirement. What would you propose?

    estimationlatency
  • 100

    Tell me about an ML project that did not work as planned. What should a good answer include?

    story