Top 30 Machine Learning Interview Questions and Answers
30 multiple-choice questions on Machine Learning, drawn from 30 bites out of the 51 tagged Machine Learning on Tezvyn. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
An e-commerce company notices prediction accuracy dropping on a model whose serving code hasn't changed. What is the most appropriate first step in a mature MLOps setup?
Show the answer
Answer: a · Trigger the CT pipeline to validate data, train, evaluate against the champion, and promote if blessed
When model performance decays but serving code is unchanged, the CT pipeline should validate data, retrain, and evaluate before promotion. Option D is wrong because it bypasses evaluation gates and data validation, and B is wrong because models are separate deployable units from serving code.
Read the full bite: Explain ML pipelines and typical CI/CD/CT components
Question 2 of 30
Which promotion flow best reflects a robust automated testing strategy for a weekly retrained production model?
Show the answer
Answer: a · Offline per-slice thresholds and bias checks, data validation for training-serving skew and drift, shadow deployment comparing latency and prediction distributions, then canary gated on business metrics with automatic rollback
This option captures the four-layer strategy from the card: offline statistical validation, data validation, shadow deployment, and canary gated on business metrics with automatic rollback. Option D is the most tempting distractor because it uses correct terminology but reverses the order and incorrectly uses offline accuracy as the final promotion gate rather than live business metrics.
Read the full bite: Design a robust automated testing strategy for ML models before production
Question 3 of 30
Why does self-attention use three separate learned projections of the same input rather than the raw embeddings directly?
Show the answer
Answer: a · It allows the model to learn which token features to use for matching versus which to pass forward as content
The correct answer reflects that learned projections decouple the matching process from content retrieval, letting the model decide which aspects of a token to use for scoring and which to propagate forward. The distractor describing a decoder query with encoder key and value defines cross-attention, not self-attention, where all three matrices are derived from the same input sequence.
Read the full bite: Explain Q, K, and V matrices in self-attention
Question 4 of 30
When designing a pipeline to discover unknown pain-point categories from thousands of unstructured reviews, which sequence best ensures valid grouping and reliable severity ranking?
Show the answer
Answer: c · Deduplicate and normalize the corpus, cluster to discover themes, then apply sentiment analysis within each cluster to rank by severity.
The correct sequence matches the card's recommended lifecycle: preprocess to remove noise and duplicates, use unsupervised clustering to discover emergent themes since categories are unknown, and score sentiment within each cluster to rank pain points by frequency and severity. Option A is a tempting distractor because LLMs are popular, but the card flags jumping straight to summarization without cleaning as a red flag that yields unreliable, unvalidated output.
Read the full bite: Outline an NLP pipeline to categorize reviews and identify pain points
Question 5 of 30
Which architectural element of a feature store most directly prevents training-serving skew for a precomputed feature?
Show the answer
Answer: a · Running identical transformation logic in offline training pipelines and online serving paths
Training-serving skew is eliminated when the exact same transformations generate features for both training backfills and live inference. Option C is tempting but wrong because offline and online stores are separate, workload-optimized layers rather than a single shared database.
Read the full bite: Describe feature store architecture and training-serving skew
Question 6 of 30
What happens when the learning rate in gradient descent is set too high?
Show the answer
Answer: a · Steps overshoot the minimum and the loss may oscillate or diverge
Too large a step size overshoots the minimum, causing oscillation or divergence instead of convergence. A high rate does not guarantee faster or correct convergence, and it does not change how the gradient is computed.
Read the full bite: How gradient descent and the learning rate work
Question 7 of 30
In PCA on mean-centered data, what does the eigenvalue associated with a principal component directly represent?
Show the answer
Answer: d · The variance of the data projected onto that component's direction
Each eigenvalue equals the variance captured along its eigenvector, which is why components are ranked by eigenvalue. Accuracy is a downstream model metric, not what the eigenvalue measures.
Read the full bite: Eigenvalues, eigenvectors, and their role in PCA
Question 8 of 30
An ML platform team still spends days debugging accuracy drops because they must manually cross-reference spreadsheets, data catalogs, and model registries across hundreds of models. Which architectural change most directly fixes this?
Show the answer
Answer: d · Building a unified lineage graph with automated hooks connecting raw sources, transformations, training runs, and deployments
A unified lineage graph with automated hooks treats lineage as a connected graph problem, enabling traversal from a deployed model back to raw data and transformations. Options A and B address only fragments of the pipeline, while D merges storage without guaranteeing the relationships or automated capture needed for root-cause analysis.
Read the full bite: How to establish data lineage and reproducibility for hundreds of ML models
Question 9 of 30
A model degrades in production because separate batch and streaming pipelines produce slightly different values for the same feature. What does a feature store primarily solve here?
Show the answer
Answer: b · It ensures identical transformation logic is used for both training and real-time serving
A feature store prevents training-serving skew by governing the same transformations and definitions across batch and real-time contexts. Describing it as merely a cache or database misses its core consistency and governance role.
Read the full bite: What problems does a Feature Store solve in ML systems?
Question 10 of 30
Which approach best detects training-serving skew for a critical numerical feature requiring sub-hour detection?
Show the answer
Answer: b · Compute distribution divergence metrics like PSI over sliding windows, with severity-based tiered alerting and minimum sample size guards
The card emphasizes comparing aggregate distributions via PSI or KS over sliding windows, not raw values, and advocates tiered alerts with sample size checks. Option D is tempting because row-level validation seems rigorous, but it cannot detect population drift and contradicts the card's red flag of comparing individual values instead of distributions.
Read the full bite: Design a system to detect training-serving skew for a numerical feature
Question 11 of 30
When designing an ML system to optimize habit-loop notifications, why should you prefer a contextual bandit over a supervised click-prediction model?
Show the answer
Answer: a · It explores personalized user contexts and optimizes long-term habit rewards while explicitly penalizing notification fatigue
A contextual bandit treats habit formation as a sequential decision problem that must explore individual states and shape rewards around routine completion and retention, not just clicks. The most tempting distractor describes a supervised click-prediction model, which ignores exploration and optimizes for short-term engagement, leading to spammy cues that erode trust and fail to build lasting habits.
Read the full bite: How would you use ML to optimize habit-loop notifications?
Question 12 of 30
Which architectural approach best balances real-time choice-paralysis detection with user autonomy and low latency?
Show the answer
Answer: a · Use a streaming feature pipeline with a lightweight contextual bandit at the edge, include one-click reversion, and cap changes per session
This option combines low-latency behavioral inference via a lightweight contextual bandit with critical safety guardrails like one-click reversion and change-capping. Option D is tempting because fast response feels user-friendly, but triggering on a single signal violates the minimum-observations guardrail and risks interface churn.
Question 13 of 30
When a categorical feature has thousands of unique values, which approach avoids the dimensionality and memory issues of one-hot encoding while keeping predictive signal?
Show the answer
Answer: d · Target encoding, which replaces each category with the mean of the target variable for that category
Target encoding collapses a high-cardinality categorical feature into a single numeric column by using the mean target value per category, avoiding sparse dimensionality while preserving signal. Label encoding is a common distractor because it keeps the feature as one column, but it imposes an artificial order on nominal categories that can mislead linear or distance-based models.
Read the full bite: Why avoid one-hot encoding for high cardinality and what are alternatives?
Question 14 of 30
A decision tree's split on a feature remains unchanged if that feature is multiplied by 100 because...
Show the answer
Answer: b · Information gain and Gini impurity depend only on the relative ordering of feature values, not their absolute scale
Decision trees split based on rank order, so rescaling a feature leaves information gain and Gini impurity unchanged. The distractor about Euclidean distances confuses combinatorial tree splitting with the geometric distance objectives that make scaling critical for SVMs and K-Means.
Read the full bite: Why is scaling unnecessary for trees but critical for SVM or K-Means?
Question 15 of 30
What makes standard post-hoc hypothesis testing invalid after running a multi-armed bandit campaign?
Show the answer
Answer: c · Adaptive allocation shifts traffic toward leading arms, biasing sample sizes and violating fixed-sample assumptions
The card states that MAB's adaptive traffic allocation corrupts the fixed-sample assumptions required for classical hypothesis testing, producing biased lift estimates. Option D is tempting because it mentions fixed samples, but the exploration floor is an operational guardrail, not the source of the statistical bias.
Read the full bite: Architect a real-time multi-armed bandit and compare trade-offs to A/B testing
Question 16 of 30
Which combination of automated CI tests best validates a classification model artifact before deployment?
Show the answer
Answer: c · Data schema checks, performance regression against a baseline, bias audits, and artifact integrity tests
Data schema checks, performance regression, bias audits, and artifact integrity tests validate the model artifact itself rather than just the surrounding code. Option A is tempting because it verifies the pipeline runs and responds quickly, but it never asserts whether the model's accuracy, fairness, or data assumptions have degraded.
Read the full bite: What automated tests belong in CI before deploying a classification model?
Question 17 of 30
A media company personalizes a daily digest using 24-hour browsing windows. Which approach best respects the operational constraints of high-volume email delivery?
Show the answer
Answer: d · Aggregate events into per-user vectors with Flink, cache in Redis, and inject article IDs during a pre-send phase
Pre-computing aggregated vectors and injecting them before delivery avoids the thundering herd of real-time inference and respects that email content is frozen at send time. Option B is tempting but wrong because most email clients block dynamic scripts, while Option A incorrectly couples the analytics pipeline to the delivery renderer.
Read the full bite: Design a personalized newsletter recommendation pipeline
Question 18 of 30
What is the key reason gradient boosting can overfit more easily than a random forest?
Show the answer
Answer: a · It sequentially fits each tree to the prior ensemble's residual errors
Boosting fits trees sequentially to remaining errors, so without regularization it can chase noise and overfit. A random forest averages independent trees, which reduces variance rather than aggressively fitting residuals.
Question 19 of 30
What is the main reason k-fold cross-validation is more robust than a single train-test split for estimating generalization performance?
Show the answer
Answer: b · It averages multiple performance scores from different partitions, lowering estimate variance while using all data for both training and testing.
Cross-validation reduces variance in the performance estimate by averaging scores across k rotations where every observation serves in both training and validation. It does not create a single final model trained on all folds—its purpose is evaluation, not producing a production estimator.
Read the full bite: What is cross-validation and why is it more robust than a holdout split?
Question 20 of 30
What is a key weakness of relying solely on a keyword blocklist to moderate ad copy?
Show the answer
Answer: c · It is easily evaded and cannot judge context, causing misses and false positives
Blocklists are trivially bypassed by character substitution and are context-blind, causing both evasions and false positives like the Scunthorpe problem. They are actually fast and need no training data, which is why the other options are wrong.
Read the full bite: Automatically moderate user-generated ad copy
Question 21 of 30
A fraud detection model has 99.9% uptime and 200ms latency, but its catch rate drops sharply. Which monitoring approach would most likely reveal the root cause?
Show the answer
Answer: d · Comparing production transaction features to training distributions for data drift
Healthy infrastructure with degrading predictions signals data drift, which is uncovered by statistically comparing production inputs to training baselines. Checking API logs for 500 errors is tempting because traditional REST APIs fail through explicit errors, but ML models degrade silently when input distributions shift even while returning successful responses.
Read the full bite: Differences between monitoring a traditional REST API and a production ML model
Question 22 of 30
When clustering GPS customer pings to identify irregular commercial corridors surrounded by sparse residential zones, which property most strongly favors DBSCAN over K-Means?
Show the answer
Answer: b · DBSCAN discovers arbitrary-shaped density peaks and labels low-density points as noise, whereas K-Means partitions space into K convex, isotropic regions.
DBSCAN captures irregular commercial corridors and explicitly marks sparse regions as noise, while K-Means forces every point into K spherical Voronoi cells. Distractor B misrepresents K-Means' tendency to place centroids over rivers as outlier handling, when forced assignment actually distorts hotspot boundaries.
Read the full bite: K-Means vs DBSCAN: which for geospatial hotspots?
Question 23 of 30
Why might you avoid a tree model's built-in gain or split-count feature importance for stakeholder explanations?
Show the answer
Answer: c · It is biased toward high-cardinality or frequently split features
Impurity- or split-based importance inflates features with many distinct values, giving a distorted ranking. Permutation importance or mean absolute SHAP values provide a less biased global view.
Read the full bite: Interpreting a black-box gradient boosting model
Question 24 of 30
After visualizing 500-dimensional data with t-SNE, you measure a 5-unit gap between two clusters. Which conclusion is best supported?
Show the answer
Answer: b · The clusters are likely dissimilar, but the 5-unit gap should not be treated as a precise geometric measurement
t-SNE preserves local similarity probabilities rather than exact geometry, so large separations suggest dissimilarity but exact gap sizes are unreliable. Distractor A is wrong because the card explicitly warns against reading precise distances from a t-SNE plot.
Read the full bite: t-SNE: Map High-Dimensional Similarity to 2D
Question 25 of 30
Which architecture best balances low inference latency with continuous feature drift detection?
Show the answer
Answer: c · Emit feature vectors asynchronously to a stream processor that compares windowed distributions against a versioned training baseline using feature-specific thresholds
Asynchronous streaming keeps inference latency low while enabling continuous monitoring against a versioned baseline, and per-feature thresholds reduce false positives. Running synchronous tests inside the prediction API (A) adds unacceptable latency at scale and is a common anti-pattern.
Read the full bite: Design a system to monitor a real-time prediction service for feature drift
Question 26 of 30
Which approach best detects systemic model degradation across a high-cardinality fleet without causing alert fatigue?
Show the answer
Answer: d · Aggregate models into cohorts, baseline against peers, and alert on fleet-wide drift percentages while batching individual outliers into digests
Cohort-based aggregation and hierarchical alerting surface systemic issues sub-linearly while preventing operator fatigue. A is a common trap because per-customer dashboards feel thorough but do not scale past a few dozen instances.
Read the full bite: How do you monitor thousands of per-customer models as a fleet?
Question 27 of 30
An NLP pipeline clusters and tags research transcripts into themes. Which risk does the card call out as the deepest trap when interpreting the results?
Show the answer
Answer: a · Mistaking the most frequently mentioned theme for the most important one, even in a small sample where counts are not real statistics.
The card explicitly calls conflating theme frequency with importance the deepest trap, since mention counts in a small qualitative sample are not real statistics. The other options are real challenges it lists but are not the one singled out as deepest.
Read the full bite: NLP pipeline to theme and tag research transcripts
Question 28 of 30
When building data infrastructure to measure causal viral growth, which layer must be hardened first before downstream feature stores or model serving can be trusted?
Show the answer
Answer: b · An identity resolution layer that links inviter and invitee across devices and sessions
The card emphasizes that without clean attribution between inviter and invitee, any k-factor model is built on garbage data, and a broken join causes the feature store to serve incorrect network topology. Fast streaming ingestion is valuable but cannot fix a broken identity link, making attribution the prerequisite.
Read the full bite: What data pipelines and infrastructure feed a viral user acquisition model?
Question 29 of 30
When running a Core ML image classifier through Vision, why is wrapping it in a VNCoreMLModel and using VNImageRequestHandler preferred over calling the model's prediction directly?
Show the answer
Answer: b · Vision handles required scaling, cropping, and color conversion to the model's input format
Vision normalizes the image to the model's expected input size and pixel format and respects orientation, eliminating error-prone manual preprocessing. It does not auto-encrypt the model or remove the need to bundle it.
Question 30 of 30
Which problem does a feature store directly solve in a production ML platform?
Show the answer
Answer: c · Training and serving pipelines use inconsistent feature transformations
A feature store guarantees identical feature vectors during training and inference, preventing training-serving skew. Option A is a tempting distractor because both the feature store and model registry are centralized storage layers, but versioning model stages is the registry's job.
Read the full bite: What are the essential components of an end-to-end ML platform?
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.