Machine Learning Mock Interview: Questions & Answers

Author Image
Sakshi Jhunjhunwala
Machine Learning Mock Interview: Questions & Answers

A machine learning engineer interview at a FAANG company is one of the most multi-layered technical interviews in the industry. You are expected to perform at the level of a software engineer on coding rounds and simultaneously demonstrate depth on ML fundamentals, ML system design, and applied ML experience in your own work.

Most candidates who do not clear ML engineer interviews are not failing because they cannot build models. They are failing because they cannot explain their modelling decisions clearly, cannot design an ML system end to end at scale, or cannot reason about ML problems they have not seen before under interview pressure.

If you want to practice these questions with a real ML engineer before your actual interview, book a mock interview on Intervue.io. The rest of this guide gives you what you need to walk in prepared.

What an ML Engineer Interview Covers

ML engineer interviews at FAANG companies test across four distinct areas, and a typical onsite includes rounds that probe each one.

Coding and DSA is the same expectation as a software engineering interview. ML engineers are expected to solve medium to hard algorithmic problems in coding rounds. The ML title does not lower the coding bar. Graphs, trees, dynamic programming, and sliding window problems all appear. If your coding is weak, address it before preparing ML-specific content.

ML fundamentals covers the theoretical and practical foundations of machine learning: supervised and unsupervised learning, bias-variance tradeoff, regularisation, evaluation metrics, model selection, and classical algorithms. This is tested through a rapid-fire question format in a phone screen or as a dedicated round in the onsite.

ML system design asks you to design a machine learning system end to end: a recommendation engine, a search ranking system, a fraud detection pipeline, or a content moderation classifier. This is the round most ML candidates are least prepared for because it requires combining ML knowledge with distributed systems thinking.

Applied ML and project deep dive asks you to walk through a project you have worked on, explain the problem you were solving, the model you chose and why, how you evaluated it, what went wrong and what you would do differently. At senior levels, the entire round can be spent on a single project.

ML Fundamentals Questions

What is the bias-variance tradeoff?

Bias is the error introduced by approximating a complex real-world relationship with a simpler model. High bias means the model is too simple and underfits the data: it performs poorly on both training and test sets.

Variance is the sensitivity of the model to fluctuations in the training data. High variance means the model has overfit the training data and performs well on training but poorly on the test set.

The tradeoff: as you increase model complexity, bias decreases but variance increases. The goal is to find the complexity that minimises total error (bias squared plus variance plus irreducible noise).

In practice: if your model performs poorly on both training and test data, it has high bias and you need a more complex model or more features. If it performs well on training but poorly on test data, it has high variance and you need regularisation, more training data, or a simpler model.

What is the difference between L1 and L2 regularisation?

Both L1 and L2 regularisation add a penalty term to the loss function to discourage overly large weights.

L2 regularisation (Ridge) adds the sum of the squared weights to the loss: loss + lambda * sum(w^2). This shrinks all weights toward zero but rarely makes them exactly zero. It works well when all features contribute to the prediction and you want to reduce the magnitude of all coefficients.

L1 regularisation (Lasso) adds the sum of the absolute values of the weights: loss + lambda * sum(|w|). This can drive some weights to exactly zero, effectively performing feature selection. It works well when you believe only a subset of features are relevant and want a sparse model.

L1 is better when you expect many irrelevant features and want automatic feature selection. L2 is better when most features are relevant and you want to reduce their magnitude without eliminating them.

What is the difference between precision and recall, and when do you optimise for each?

Precision is the fraction of predicted positives that are actually positive: true positives divided by true positives plus false positives. It answers: of everything the model called positive, how many actually were?

Recall is the fraction of actual positives that the model correctly identified: true positives divided by true positives plus false negatives. It answers: of everything that actually was positive, how much did the model catch?

There is a tradeoff between the two. Lowering the classification threshold increases recall (catch more positives) but decreases precision (more false alarms).

Optimise for precision when false positives are expensive: spam detection (you do not want to mark legitimate emails as spam), medical diagnosis for non-urgent conditions (you do not want unnecessary treatment).

Optimise for recall when false negatives are expensive: fraud detection (missing a fraudulent transaction is worse than flagging a legitimate one), cancer screening (missing a diagnosis is worse than a false alarm).

F1 score is the harmonic mean of precision and recall and is used when you want a single metric that balances both.

What is gradient descent and what are the differences between batch, stochastic, and mini-batch variants?

Gradient descent is an optimisation algorithm that iteratively updates model parameters in the direction of the negative gradient of the loss function. The learning rate controls the size of each step.

Batch gradient descent computes the gradient using the entire training dataset before updating parameters. It is accurate but slow and memory-intensive for large datasets.

Stochastic gradient descent (SGD) computes the gradient and updates parameters after each single training example. It is fast and can escape local minima due to its noisy updates, but it converges erratically.

Mini-batch gradient descent computes the gradient on a small random subset (typically 32 to 512 examples) and updates parameters. It is the most commonly used variant in practice because it balances the accuracy of batch gradient descent with the speed of SGD and fits naturally into GPU memory constraints.

How do you handle class imbalance in a classification problem?

Class imbalance means one class has significantly more examples than another, which causes models to predict the majority class almost exclusively.

The approaches to handle it: resampling the training data by either oversampling the minority class (creating synthetic examples with SMOTE or randomly duplicating) or undersampling the majority class. Adjusting class weights in the loss function so the minority class errors are penalised more. Choosing evaluation metrics that are meaningful under imbalance (precision, recall, F1, AUC-ROC) instead of accuracy, which is misleading when classes are skewed. Using tree-based models that are naturally more robust to imbalance than linear models.

In practice, combining class weight adjustment with appropriate evaluation metrics is the most common production approach.

What is the difference between a generative and a discriminative model?

A discriminative model learns the boundary between classes directly by modelling P(y|x): the probability of the label given the features. Examples include logistic regression, SVMs, and neural networks. These are typically more accurate for classification tasks.

A generative model learns the distribution of each class by modelling P(x|y) and P(y). It can then apply Bayes' theorem to compute P(y|x). Examples include Naive Bayes, Gaussian Mixture Models, and GANs. These can generate new data samples and handle missing features more naturally.

The practical difference: discriminative models are generally better at pure classification. Generative models are useful when you need to generate data, handle missing features, or have very little labelled data because they can learn from unlabelled data too.

What is the difference between bagging and boosting?

Both are ensemble methods that combine multiple models to improve predictive performance.

Bagging (Bootstrap Aggregating) trains multiple independent models in parallel on random subsets of the training data. The final prediction is the average (regression) or majority vote (classification). Random Forest is the most well-known bagging algorithm. Bagging reduces variance without increasing bias.

Boosting trains models sequentially, where each model focuses on the examples the previous model got wrong. The final prediction is a weighted combination. Gradient Boosting, XGBoost, and AdaBoost are the most well-known boosting algorithms. Boosting reduces bias but can increase variance if not regularised.

Bagging is better when you have high variance and want to reduce overfitting. Boosting is better when you have high bias and want to improve accuracy, but requires careful tuning to avoid overfitting.

ML System Design Questions

ML system design is the round that most ML engineer candidates underestimate. The expectation is not to describe a model. It is to design the entire system that produces, serves, monitors, and improves that model at production scale.

How to structure an ML system design answer

Define the problem. What is the ML task (classification, regression, ranking, generation)? What is the ground truth label and how is it collected? What does success look like in terms of business metrics?

Define the data pipeline. Where does training data come from? How is it cleaned, labelled, and versioned? How do you handle data drift over time?

Choose the model architecture. What type of model is appropriate and why? What features will you use? How do you handle cold start (new users or items with no history)?

Define the training pipeline. How often do you retrain? Online learning or batch retraining? How do you validate before deploying?

Design the serving infrastructure. How does the model serve predictions at low latency? Do you use batch inference, real-time inference, or a hybrid? How do you cache predictions for common inputs?

Define monitoring and feedback. How do you detect model degradation in production? How do you collect feedback to improve the model? How do you A/B test a new model against the current one?

Design a Content Feed Ranking System

This is the most commonly asked ML system design question at Meta and Google. The goal is to rank posts in a user's feed so the most relevant and engaging content appears at the top.

Defining the problem

The ML task is ranking: given a user and a set of candidate posts, predict which posts the user is most likely to engage with (like, comment, share, or spend time reading).

The label is user engagement. Implicit signals (time spent on a post, scroll past without action, clickthrough) are collected automatically. Explicit signals (likes, comments, shares) are rarer but stronger.

Feature engineering

User features: interests derived from past engagement, demographic signals, recency of last active session.

Post features: topic classification, author's historical engagement rate, post age, media type (text, image, video).

User-post interaction features: whether the user has engaged with this author before, whether this topic matches the user's historical interests, how similar this post is to posts the user has recently engaged with.

Model choice

A two-stage approach is standard at this scale. Stage 1 is candidate retrieval: a lightweight model (approximate nearest neighbour search on embeddings) that reduces millions of posts to hundreds of candidates. Stage 2 is ranking: a more complex model (gradient boosting or a neural network) that scores each candidate precisely.

The two-stage approach exists because running a complex model on all posts for all users simultaneously is computationally infeasible.

Training and serving

Training data comes from logged user interactions. Positive examples are posts the user engaged with; negative examples are posts shown but not engaged with. Retrain daily or more frequently depending on how fast the content pool changes.

For serving, precompute embeddings for all posts. At inference time, retrieve the user embedding, find nearest-neighbour candidate posts, and run the ranking model on those candidates. Total latency budget is typically under 100ms.

Monitoring

Track engagement rate per session over time. A sudden drop signals model degradation or a data pipeline issue. Shadow-deploy new model versions and compare their engagement predictions against the current model before switching traffic.

Design a Fraud Detection System

Defining the problem

Classify each financial transaction as fraudulent or legitimate in real time, with a latency budget of under 100ms per transaction.

The core challenge

Extreme class imbalance: fraudulent transactions are typically less than 0.1% of all transactions. Standard accuracy is meaningless. Use precision and recall, and optimise the decision threshold based on the cost ratio of false positives (blocking legitimate transactions) to false negatives (missing fraud).

Features

Transaction features: amount, merchant category, time of day, transaction frequency in the last hour.

User behaviour features: deviation from the user's typical spending amount, location change since last transaction (velocity check), new device or IP address.

Graph features: whether the receiving merchant account has been flagged by other users recently.

Model

Gradient boosting models (XGBoost, LightGBM) work well for tabular transaction data and produce well-calibrated probabilities. For graph-based signals, a Graph Neural Network can capture relationships between accounts.

At high transaction volumes, a two-stage approach: a fast rule-based filter eliminates obvious cases, and the ML model handles ambiguous ones.

Serving

Predictions must happen synchronously before the transaction is approved. Feature computation and model inference must complete within the latency budget. Precompute and cache user behaviour features that change slowly. Compute transaction-level features in real time at inference.

Monitoring

Fraud patterns evolve. A model that was accurate six months ago may be blind to new fraud tactics. Monitor the false negative rate (missed fraud discovered later) and retrain frequently. Add human review for a sample of borderline cases to generate fresh labelled data.

What Interviewers Score in an ML Interview

In ML fundamentals rounds, they score clarity of explanation. Can you explain bias-variance tradeoff to someone who has not heard it before? Can you give a concrete example rather than just a definition?

In ML system design rounds, they score end-to-end thinking. Did you define the label and collect ground truth before choosing a model? Did you think about serving latency before picking a complex architecture? Did you raise monitoring and feedback loops before being asked?

In project deep-dive rounds, they score the depth and honesty of your self-evaluation. Did you make a specific model choice for a specific reason? Did you catch and describe a real failure in the project rather than presenting only the success?

FAQs

How much coding do ML engineer interviews involve? Full software engineering level coding is expected. Coding rounds for ML engineer roles at FAANG are the same medium to hard algorithmic problems as SWE coding rounds. The ML fundamentals and ML system design rounds are additional, not substitutes for coding.

What is the most common ML system design mistake? Jumping to model architecture before defining the label and the data pipeline. Interviewers consistently note that candidates who start by saying "I would use a neural network here" without first asking what the ground truth label is and how it is collected are not demonstrating senior ML thinking.

Do I need to know deep learning for ML engineer interviews? For general ML engineer roles, classical ML knowledge combined with a solid understanding of neural network fundamentals is sufficient. For roles specifically focused on deep learning (computer vision, NLP, generative AI), deep learning depth is required.

How is an ML system design interview different from a software system design interview? A software system design interview focuses on distributed systems: databases, caches, message queues, and API design. An ML system design interview adds the ML pipeline on top: how you define the label, collect and clean training data, choose and train the model, serve predictions at low latency, and monitor for degradation. Both require distributed systems thinking; the ML interview requires additional ML-specific layers.

What is the most important thing to know about feature engineering for ML interviews? That it is usually more impactful than model choice. A simple model trained on good features consistently outperforms a complex model trained on poor features. Interviewers at senior levels specifically evaluate whether you think about feature quality and feature engineering before jumping to model complexity.

Summary

ML engineer interviews test coding at the full SWE level, ML fundamentals through rapid-fire questions, ML system design end to end, and applied ML depth through project discussions. The candidates who pass have thought carefully about their modelling decisions and can explain them clearly, not just implement them.

Book a machine learning mock interview on Intervue.io to practice with an ML engineer who has been through real FAANG ML hiring rounds and knows what each round is actually evaluating.

Visit Intervue.io

Author Image
Sakshi Jhunjhunwala
Product Marketing Manager @Intervue.io
Passionate about turning complex products into clear, compelling narratives that drive demand. Deeply focused on positioning, differentiation, and conversion.

Join the Future of Hiring

Find how Intervue can reduce your time-to-hire, enhance candidate insights, and help you scale your engineering team effortlessly.

Book a Demo