Machine Learning Interview Questions for 10 Years Experience
40 questions with answers for candidates with 10+ years of experience — 12 medium, 28 hard.
What interviewers expect: 10 years experience
At ten years, roles are head of data science, principal ML engineer or AI practice lead. Discussions centre on organisation-level impact: building teams, choosing build-versus-buy for ML platforms, responsible AI policies, budgeting compute and aligning ML investment with business goals. Expect deep questions on past programmes, their measurable outcomes and lessons from failures.
This set is weighted towards MLOps and Deployment (7), Data Preprocessing and Feature Engineering (6), Model Evaluation and Tuning (6), Clustering and Dimensionality Reduction (6).
Organisation-level AI strategy Responsible AI and compliance Team and hiring plans Executive communication
Solved at this levelStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
✓ 3 questions free • Unlock the rest in seconds
01
Leadership wants a model in one week, but data quality is poor. How do you handle it?
I would agree on a narrow first version: a simple, explainable baseline built on the cleanest available fields, with clear notes on data gaps and expected accuracy. In parallel I would log specific data issues and their impact. Delivering a working baseline with an honest limitations section builds trust and gives a reference point for improvement in later iterations.
02
How would you encode cyclical features like hour of day or month?
Map the value onto a circle with sine and cosine so the end connects to the start.
import numpy as np
df['hour_sin'] = np.sin(2 * np.pi * df['hour'] / 24)
df['hour_cos'] = np.cos(2 * np.pi * df['hour'] / 24)
Now 23:00 and 00:00 are close, which linear and distance-based models cannot see with raw integers. Tree models often manage with the raw value.
03
How do you select the top k features using mutual information in scikit-learn?
SelectKBest with mutual_info_classif captures non-linear relationships, unlike plain correlation.
from sklearn.feature_selection import SelectKBest, mutual_info_classif
sel = SelectKBest(score_func=mutual_info_classif, k=20)
X_new = sel.fit_transform(X_train, y_train)
print(X_train.columns[sel.get_support()])
Put the selector inside a pipeline so selection is redone in each CV fold.
04
Your real-time model API takes 400 ms but the requirement is under 50 ms. What do you do?
Profile first to see whether time goes to feature lookup, preprocessing or the model. Then cache or precompute features, load the model once at startup, reduce trees or features, use a faster library like LightGBM or ONNX Runtime, and batch requests if possible. Run several workers and keep the service close to its data store. Re-measure p95 and p99 latency, not just the average.
05
Your cross-validation score is 0.85 but the test score is 0.70. What could explain it?
Possible causes: leakage inside CV, such as preprocessing or feature selection fit outside folds; repeated tuning that overfit the CV folds; a test set from a different time period or population; or duplicate entities across folds but not test. I would check pipeline structure, switch to time-based or group splits that match how test data differs, and compare feature distributions between the two sets.
06
How do you evaluate clustering when there are no labels?
Use internal metrics: silhouette score, Davies-Bouldin index (lower is better) and Calinski-Harabasz index (higher is better). Check stability by re-clustering on bootstrap samples. Most important is external usefulness: profile each cluster with key statistics and check whether business teams find the segments distinct and actionable, for example different response to a campaign.
07
What is Local Outlier Factor and how does it differ from Isolation Forest?
Local Outlier Factor compares the local density of a point with the density of its neighbours; a point in a much sparser area than its neighbours gets a high outlier score. It catches local anomalies inside varied-density data but is distance-based, so it needs scaling and is slower on large data. Isolation Forest is tree-based, faster and scales better, but is less sensitive to local density differences.
08
How do you handle pressure to report better model numbers than the data supports?
I explain the risk clearly: inflated numbers lead to bad decisions and lose trust when production results arrive. I present the honest metric with confidence intervals, and then offer a concrete plan to improve it, such as new data sources. In one case I showed that a 'better' number came from leakage, and leadership agreed to report the lower but reliable figure.
09
What fairness checks would you run on a model that affects people?
Compare metrics across groups such as gender, age band or region: approval rate (demographic parity), true positive rate (equal opportunity) and false positive rate. Check calibration per group too. Remove or audit proxy features like pin code that may stand in for protected attributes. Document findings in a model card, and involve legal or compliance teams, especially for lending and hiring use cases.
10
Tell me about a time a production model failed and how you communicated it.
Situation: our daily scoring job silently produced all-zero scores for two days after an upstream column was renamed. Task: fix it and inform affected teams. Action: I rolled back to cached scores, patched the feature mapping, and sent a short note explaining impact, cause and fix. I then added schema validation and a check on score distribution. Result: the issue never repeated, and teams trusted our alerts more.
A feature store is a system that defines, computes and serves features consistently for both training and real-time inference, with an offline store for historical data and an online store for low-latency lookup. It prevents training-serving skew and lets teams reuse features. It is worth it when many models share features or need real-time features; small teams can start with well-managed tables.
12
A new model version performs badly right after release. How do you handle it?
Roll back immediately to the previous version from the model registry, which should be a one-step action. Then investigate: compare the input features served with those used in validation, check for training-serving skew, version mismatches or a wrong artifact. Add the failure case to automated pre-release checks, and use canary or shadow releases next time so issues affect only a small share of traffic.
13
When would you use Huber or quantile regression instead of OLS?
Huber regression uses squared loss for small errors and absolute loss for large ones, so it resists outliers while staying smooth. Quantile regression predicts a chosen percentile, such as the 90th percentile of delivery time, which is useful for setting safe promises or prediction intervals. Gradient boosting libraries support both losses for non-linear versions.
14
Business users do not trust a gradient boosting model because it is a black box. How do you help?
I would use SHAP to show global drivers with a summary plot and explain individual decisions with waterfall plots, such as why one applicant got a high risk score. I would also check that the top drivers make business sense, add monotonic constraints where logic requires it, and share a few real case examples. If trust is still an issue, a scorecard model can serve as a transparent benchmark.
15
An A/B test of a new recommendation model shows no significant uplift despite better offline metrics. What next?
I would check the test first: enough sample size and duration, correct randomisation, and no bugs in serving such as stale features. Then investigate whether offline metrics really reflect user value, for example optimising clicks rather than purchases, or popularity bias. Segment-level analysis may show gains in some groups. I would revise the offline metric to better match the online goal.
16
How do you prioritise when several teams ask you for models at the same time?
I estimate each request's business value, effort and urgency, then share a ranked list with my manager so priorities are agreed rather than assumed. For quick wins I offer a simple baseline first. In one quarter this helped us deliver a high-value churn model first while giving another team a dashboard-based interim answer, and both teams knew the timeline.
17
What is a Gaussian Mixture Model and how is it different from k-means?
A GMM assumes data comes from a mix of Gaussian distributions and fits their means, covariances and weights with the Expectation-Maximisation algorithm. Unlike k-means' hard assignments, GMM gives soft probabilities of belonging to each cluster and can model elliptical clusters of different sizes. You can choose the number of components using BIC or AIC.
18
What is multicollinearity and how do you detect it?
Multicollinearity is high correlation between input features, which makes linear model coefficients unstable and hard to interpret, though predictions may remain fine. Detect it with a correlation matrix or the Variance Inflation Factor, where VIF above 5 to 10 signals a problem. Fix it by dropping one of the correlated features, combining them, using PCA, or applying Ridge regularisation.
19
Why does L1 regularisation produce sparse models while L2 does not?
The L1 constraint region is a diamond with corners on the axes, so the optimal point often lands on a corner where some coefficients are exactly zero. The L2 region is a circle with no corners, so coefficients shrink smoothly but stay non-zero. In gradient terms, L1 applies a constant push toward zero regardless of size, while L2's push becomes tiny as weights get small.
20
Your preprocessing works in notebooks but gives different results in production. Why?
Common causes are preprocessing written separately in two places, statistics like means recomputed on production data instead of using training values, different library versions, or different column order and data types. The fix is to save one fitted Pipeline with preprocessing and model together, pin versions, validate input schema, and test that the saved pipeline gives identical outputs on sample rows.
21
Your dataset has a city column with 2,000 unique values. How will you encode it?
One-hot would create 2,000 sparse columns, so I would first group rare cities below a frequency threshold into 'Other'. Then options are frequency encoding, out-of-fold target encoding, or mapping cities to useful attributes such as tier, state or population. For boosting models like CatBoost or LightGBM, native categorical handling also works well. I would compare options with cross-validation.
22
What is nested cross-validation and when do you need it?
Nested CV has an inner loop that tunes hyperparameters and an outer loop that evaluates the whole tuning process on unseen folds. It gives an unbiased performance estimate when you tune heavily on small data, because a normal CV score used both to tune and to report is optimistic. It is expensive, so it is mainly used for small datasets or research reporting.
23
Your classifier works well overall but poorly for one customer segment. What do you do?
I would measure metrics per segment to confirm, then check if that segment is under-represented or has different feature distributions. Fixes include collecting more data, sample weighting, segment-specific features, or a separate model if the behaviour is truly different. If the segment relates to a protected attribute, I would also review fairness metrics and involve the compliance team.
24
Your gradient boosting model performs worse on recent months than older ones. What do you check?
I would check for drift between periods in feature distributions and target rate, and confirm that the evaluation uses a time-based split. If behaviour has changed, I would train on a more recent window or weight recent data more, add features that capture the change, and set up a regular retraining schedule. Comparing SHAP importance across periods shows which relationships have shifted.
25
Why can impurity-based feature importance be misleading?
Impurity-based importance is computed on training data and favours high-cardinality or continuous features, which offer more split points, even if they are noise. It also splits credit between correlated features. Permutation importance on validation data, which measures the score drop when a feature is shuffled, is more reliable, and SHAP values give consistent per-prediction attributions.
26
What is training-serving skew and how do you prevent it?
Training-serving skew is when features at prediction time are computed differently from features used in training, causing silent accuracy loss. Causes include separate code paths, different data sources, or time windows that use future data in training. Prevent it by sharing one feature-computation code path or a feature store, logging served features and comparing their distributions with training data.
27
Why do skewed features often need a log or power transform?
Heavily right-skewed features like income or transaction amount have long tails that can dominate linear models and distance metrics. A log1p, Box-Cox or Yeo-Johnson transform compresses large values and makes the distribution closer to normal, which often improves linear and distance-based models. Yeo-Johnson works with zero and negative values. Tree models usually do not need these transforms.
28
The segments you built six months ago no longer match customer behaviour. What do you do?
I would measure drift by comparing feature distributions and segment sizes over time. Then refit clustering on recent data and map new clusters to old ones by centroid similarity so business names stay consistent. I would set up a quarterly refresh with stability checks and alert when segment sizes shift sharply, and explain any renamed or merged segments to stakeholders.
29
You need prediction intervals, not just point estimates, for delivery time. How?
Options are quantile regression, training separate models for the 10th and 90th percentiles with GradientBoostingRegressor(loss='quantile') or LightGBM; conformal prediction, which wraps any model and gives intervals with guaranteed coverage; or bootstrapping. I would check calibration: about 80 percent of actual values should fall within an 80 percent interval on a holdout set.
30
Explain a single prediction with SHAP for a tree model.
import shap
explainer = shap.TreeExplainer(model)
sv = explainer(X_val)
shap.plots.waterfall(sv[0])
shap.plots.beeswarm(sv)
The waterfall shows how each feature pushes one prediction up or down from the base value; the beeswarm shows global importance and direction. TreeExplainer is fast and exact for tree ensembles.
31
Lasso dropped a feature the business considers very important. How do you handle it?
Lasso often keeps only one of a group of correlated features, so the dropped feature may be redundant rather than useless. I would check correlations, try Elastic Net which keeps correlated groups, and compare cross-validated performance with the feature forced in. I would explain the trade-off clearly; if the accuracy difference is small, keeping the feature for trust and interpretability is reasonable.
32
Random forest and LightGBM give the same AUC. Which would you deploy?
I would compare beyond AUC: model size, inference latency, training time, calibration and stability across time periods. LightGBM is usually smaller and faster to score, while random forest needs less tuning and is less prone to overfitting. If both are equal, I would choose the one that is cheaper to run and easier for the team to maintain and retrain.
Use an imbalanced-learn pipeline so oversampling happens only on training folds.
from imblearn.pipeline import Pipeline
from imblearn.over_sampling import SMOTE
from sklearn.model_selection import cross_val_score
pipe = Pipeline([('pre', pre), ('smote', SMOTE(random_state=42)),
('clf', LogisticRegression(max_iter=1000))])
print(cross_val_score(pipe, X, y, cv=5, scoring='average_precision').mean())
Applying SMOTE before splitting puts synthetic copies of test points into training.
34
Labels for your loan model arrive only after 6 months. How do you monitor it meanwhile?
I would rely on proxy signals: input data drift with PSI, prediction score distribution, approval rates by segment, and early indicators like first missed payment at 30 or 60 days. Once enough early outcomes arrive, I would check performance on these. I would also set up a delayed evaluation job that computes full metrics as labels mature and compares them with the validation baseline.
35
What is the difference between a generative and a discriminative model?
A discriminative model learns the decision boundary or P(y|x) directly, such as logistic regression or SVM. A generative model learns how data is produced, P(x|y) and P(y), and can generate new samples, such as Naive Bayes or Gaussian mixture models. Discriminative models usually give better accuracy with enough data, while generative models handle missing data and small samples better.
36
You need to detect unusual transactions but have no fraud labels. What do you do?
I would start with unsupervised anomaly detection: Isolation Forest or Local Outlier Factor on features like amount relative to the customer's usual spend, time of day, new device and merchant risk. I would set the threshold based on what the review team can handle, collect investigator feedback as labels, and move to a supervised model once enough labelled cases exist.
37
Your manager asks for a single number showing the model's business value. What do you give?
I would convert model outcomes into money or time using a cost matrix agreed with the business, for example savings from caught fraud minus the cost of reviewing false alerts. I would compare this against the current process or a rule-based baseline on holdout data and show a range rather than one point. A short note on assumptions keeps the number honest.
The model is poorly calibrated: it ranks customers but its probabilities are not reliable. Since pricing depends on actual probabilities, I would calibrate it with isotonic regression or Platt scaling on a held-out set and validate with a reliability curve and Brier score. I would also check whether the default rate has drifted since training, which would require retraining.
Stacking trains several diverse base models and then a meta-model on their out-of-fold predictions to combine them. It often gives a small accuracy gain, common in competitions. In production it adds complexity, latency and maintenance, so it is worth it only when the gain has clear business value. scikit-learn provides StackingClassifier and StackingRegressor.
Frequently asked questions
What is asked in Machine Learning interviews for 10+ years of experience?
At ten years, roles are head of data science, principal ML engineer or AI practice lead. Discussions centre on organisation-level impact: building teams, choosing build-versus-buy for ML platforms, responsible AI policies, budgeting compute and aligning ML investment with business goals. Expect deep questions on past programmes, their measurable outcomes and lessons from failures.
How many questions should I practise before a Machine Learning interview?
Work through all 40 questions here, then the company-wise sets for the employers you are targeting. Quality matters more than count: be able to explain why each answer is right.
Which topics matter most for 10+ years of experience?
Focus first on Organisation-level AI strategy, Responsible AI and compliance, Team and hiring plans, Executive communication.