02 / Understand the decisions

Machine learning interview questions

Build intuition with worked examples, then connect each concept to a design decision. 129 guides on models, evaluation, and trustworthy production ML.

Start with models

Understand how predictions are learned.

Read logistic regression, gradient descent, and tree ensembles. Then examine bias and variance.

Start with evaluation

Decide whether a model helps.

Begin with validation strategy and leakage. Continue to calibration and monitoring.

Build a reliable foundation.

Start with a question you struggle to explain.

01

How do you know a recommendation is good?

Worked examples for retrieval, ranking, and product evaluation.

8 min read
02

Data leakage: when a model knows too much

Point-in-time features, preprocessing boundaries, and delayed labels.

6 min read
03

Class imbalance and decision thresholds

Precision, recall, calibration, sampling, and action thresholds.

7 min read
04

Overfitting, regularization, and early stopping

Learning curves, L1 and L2, validation discipline, and model selection.

6 min read
05

Logistic regression, from score to decision

Understand the sigmoid, log loss, coefficients, and the difference between probability and action.

5 min read
06

Gradient descent and training diagnostics

Calculate an update, compare step sizes, and diagnose a training run before changing the model.

5 min read
07

The bias–variance trade-off

State the assumptions, work through the decomposition, and connect it to model choices.

5 min read
08

Decision trees, random forests, and boosting

Follow a split and a boosting update, then compare the practical costs of tree ensembles.

5 min read
09

Embeddings and similarity search

Connect learned geometry to similarity functions, index recall, and model versioning.

5 min read
10

Choose the right validation strategy

Match splits to deployment and separate model selection from final assessment.

5 min read
11

When can you trust a probability?

Distinguish ranking from calibration and fit a probability mapping without leakage.

5 min read
12

Model drift and production monitoring

Separate population changes from pipeline failures, then choose an evidence-based response.

5 min read
13

K-means: what makes a useful cluster?

Work through an assignment step, then question the distance function and the purpose of the groups.

4 min read
14

PCA and dimensionality reduction

Separate variance preservation from predictive usefulness, and reason about scaling and reconstruction.

4 min read
15

Feature engineering and missing data

Design transformations around prediction time, missingness, and consistent serving behavior.

4 min read
16

Feature selection and importance

Distinguish a useful predictor from a causal explanation and measure whether a feature earns its cost.

4 min read
17

Regression metrics and asymmetric errors

Calculate MAE and RMSE, then choose a loss that reflects the decision being made.

4 min read
18

A/B tests: from randomization to a decision

Choose the experimental unit, interpret uncertainty, and avoid declaring a winner from noise.

4 min read
19

Negative sampling for retrieval models

Understand what an unobserved interaction means and how sampled training differs from catalog-wide evaluation.

4 min read
20

Attention and transformers: the serving trade-offs

Trace one attention operation and connect context length to memory, caching, and system design.

4 min read
21

Confidence intervals for model comparisons

Work through paired accuracy differences, bootstrap sampling units and practical significance.

8 min read
22

Diagnose selection bias in recommendation data

Worked population-mix and propensity-weighting examples, with support and uncertainty limits.

8 min read
23

Choose thresholds using precision–recall curves

Worked threshold choices, average precision, tied scores and changing positive-class prevalence.

8 min read
24

Distinguish prediction from causal effects

Worked coupon economics, randomized assignment, confounding and policy evaluation.

8 min read
25

Control false discoveries across many model experiments

Worked Bonferroni, Holm and BH examples, dependence assumptions and test-set reuse.

8 min read
26

Survival Analysis: Censoring, Kaplan–Meier and Competing Risks

Work through survival probabilities, right censoring, Kaplan–Meier estimates and competing risks. Learn why terminal cancellation is not ordinary missing follow-up.

8 min read
27

Choose a bootstrap strategy for dependent observations

Cluster dependence, paired differences, ratio metrics and uncertainty limits.

10 min read
28

Gradient Accumulation: Effective Batch Size and DDP Scaling

Calculate effective batch size and correctly normalize unequal token batches in distributed gradient accumulation. Cover clipping, AMP and synchronization.

9 min read
29

Explain contrastive representation learning

Worked contrastive loss, false negatives, batch interactions and retrieval evaluation.

10 min read
30

Explain quantization accuracy and memory trade-offs

Scale and zero point, outliers, metadata, calibration and hardware limits.

10 min read
31

Ranking Losses Explained: Pointwise, Pairwise and Listwise

Compare pointwise, pairwise and listwise ranking losses with worked gradients, NDCG examples, query weighting and biased click-label limitations.

12 min read
32

Diagnose high-variance importance-weighted estimates

Rare-event variance, misleading effective sample size, self-normalization and clipping bias.

11 min read
33

Reason about base rates and diagnostic evidence

Natural frequencies, likelihood ratios, prevalence shift and operational decisions.

11 min read
34

Connect regularization with probabilistic priors

Gaussian and Laplace priors, feature scaling, sparse solutions and posterior uncertainty.

12 min read
35

Distinguish missingness mechanisms and remedies

MCAR, MAR, MNAR, weighted means, nonidentifiability and sensitivity analysis.

12 min read
36

Explain reversals under aggregation

Simpson’s paradox, common population weights, decomposition and evaluation design.

12 min read
37

Construct and evaluate conformal prediction sets

Calibration ranks, adaptive intervals, prediction sets and distribution-shift limits.

12 min read
38

Compare momentum and adaptive optimization

Momentum dynamics, Adam moments, numerical conventions and faithful restarts.

12 min read
39

Combine rankings from incompatible retrievers

Worked rank fusion, truncation and duplicate-branch counterexamples.

12 min read
40

Compare batch and layer normalization

Tiny-matrix calculations, saved statistics, small batches and padding.

13 min read
41

Choose targets and losses for model distillation

Temperature, teacher mistakes, worked gradients and honest compression evaluation.

12 min read
42

Explain positional information in attention

A numerical RoPE example, precise causal-mask caveats and long-context validation.

12 min read
43

Explain gradient clipping and its side effects

Global versus coordinate clipping, accumulation order, loss scaling and update-size counterexamples.

12 min read
44

Use Jensen's inequality in ML reasoning

Probability ensembles, perplexity aggregation and a support-aware likelihood bound.

12 min read
45

Correct probabilities under changing class priors

Prior correction, confusion-based prevalence estimation and a failure counterexample.

13 min read
46

Effective Sample Size: Correlated Data and Unequal Weights

Calculate effective sample size for clustered observations and unequal weights. Compare sampling designs and learn where common ESS formulas stop applying.

8 min read
47

Explain probability accuracy with the Brier score

Worked Brier decomposition, binning pitfalls and honest reference forecasts.

13 min read
48

Choose a low-rank approximation using singular values

Worked SVD residuals, factor storage and an activation-distribution counterexample.

14 min read
49

Explain fast adaptation with meta-learning

Support/query splits, exact and first-order gradients, and leakage-resistant evaluation.

14 min read
50

Predict conditional quantiles with pinball loss

Worked pinball losses, nonunique quantiles, cost ratios and crossing predictions.

14 min read
51

Choose the direction of KL divergence

Asymmetry, support, likelihood gradients and a restricted-family mode example.

14 min read
52

Mutual Information Explained: Examples, Conditioning and Leakage

Understand mutual information in bits and nats, nonlinear dependence, conditional information and feature leakage through worked discrete examples.

11 min read
53

Derive expectation maximization for a mixture

A numerical EM iteration, lower-bound proof, singularities and validation.

14 min read
54

Use curvature to reason about optimization

Quadratic dynamics, eigenvalues, saddle points, conditioning and HVP diagnostics.

14 min read
55

Model counts with Poisson regression

Count likelihood, weighted rates, coefficient interpretation and conditional dispersion.

14 min read
56

Estimate expectations with Monte Carlo

Paired estimators, control variates, stopping rules and reproducible simulation.

14 min read
57

Approximate uncertainty with the delta method

Propagate uncertainty through ratio metrics, retain covariance, and recognize when a linear approximation fails.

14 min read
58

Compare nested models with likelihood ratios

Compute a nested-model test, check its regularity assumptions, and derive a case where boundary constraints change the answer.

14 min read
59

Reason about stationary Markov distributions

Solve an invariant distribution, distinguish it from a limiting law, and diagnose periodicity and slow mixing.

14 min read
60

Select diverse items with diminishing returns

Derive a greedy coverage guarantee, then test its limits with prerequisites, unequal costs and stale marginal gains.

14 min read
61

Understand focal loss and difficult examples

Derive focal-loss gradients, compare easy and difficult examples, and separate classification decisions from probability calibration.

14 min read
62

Compare distributions with optimal transport

Solve a weighted transport example, preserve meaningful geometry, and distinguish empirical distance from evidence of drift.

14 min read
63

Preserve geometry with random projections

Derive a finite-set distortion budget, test nearest-neighbor margins, and compare theoretical guarantees with empirical compression.

15 min read
64

Learn when outcomes are only partially observed

Distinguish censoring from truncation, derive a likelihood for capped measurements, and expose assumptions about an unseen tail.

14 min read
65

Predict with a Gaussian process and explain its uncertainty

Calculate a kernel posterior, distinguish latent and observation uncertainty, and budget stable Gaussian-process inference.

14 min read
66

Estimate an outcome with two imperfect nuisance models

Worked AIPW scores, robustness proof, cross-fitting and overlap failures.

15 min read
67

Keep a uniform sample from an unknown-length stream

Sample stream positions without replacement.

6 min read
68

Sample a fixed categorical distribution in constant time

Assume nonnegative finite weights with positive total, independent random draws and a distribution that stays fixed between rebuilds.

6 min read
69

Update a conversion probability with a beta prior

Assume conditionally independent Bernoulli outcomes with a stable common probability p.

6 min read
70

Distinguish sequence likelihood from the best hidden path

Assume two hidden states, a first-order Markov transition model and observations conditionally independent given the state sequence.

6 min read
71

Explain support-vector margins and feature scaling

Use binary labels −1 and +1 and the canonical hard-margin constraints y(w·x+b) at least 1.

6 min read
72

Interpret ROC AUC through positive-negative pairs

Assume binary labels, larger scores indicating positives and half credit for ties.

6 min read
73

Compare datasets with a kernel two-sample statistic

Assume independent samples within and between groups for the basic test.

6 min read
74

Test paired model improvements with valid permutations

Specify the null that makes within-pair label swaps valid.

6 min read
75

Monitor experiments without treating every peek as a fixed test

Separate fixed-horizon inference from time-uniform inference.

6 min read
76

Connect entropy to lossless coding and log loss

Use base-two logarithms and a discrete distribution with positive probabilities for observed symbols.

6 min read
77

Compute softmax stably and derive its gradient

Assume finite logits and a normalized target distribution.

6 min read
78

Trade activation memory for recomputation during training

This is recomputing forward activations during backward, distinct from saving training checkpoints to durable storage or accumulating gradients across batches.

6 min read
79

Measure monotonic association with ranks

Two model scores have different scales.

5 min read
80

Explain ranking agreement through concordant pairs

Compare two rankings using Kendall correlation and explain what changes when there are ties.

5 min read
81

Update uncertainty over several category probabilities

Use a Dirichlet prior to estimate category proportions from a small multinomial sample.

5 min read
82

Use Student's t when estimating a mean

Explain a t interval for a small sample and the assumptions that make it exact.

5 min read
83

Explain why naive Bayes can overcount evidence

Derive a two-feature naive Bayes decision and show how duplicated features distort confidence.

5 min read
84

Interpret agreement beyond a raw percentage

Calculate Cohen's kappa for two annotators and explain why it is not a universal label-quality score.

5 min read
85

Solve one-to-one matching without greedy mistakes

Assign workers to tasks at minimum total cost and show why choosing the cheapest available pair can fail.

5 min read
86

Use low-discrepancy samples for integration

Explain when a Sobol sequence can improve numerical integration and how its error assessment differs from independent Monte Carlo.

5 min read
87

Separate latent components with independent component analysis

Explain when ICA can recover mixed signals and which ambiguities remain even in an ideal setting.

5 min read
88

Interpret nonnegative matrix factorization

Factor a nonnegative count matrix into additive components and explain why the factors are not uniquely determined.

5 min read
89

Stabilize a noisy covariance estimate

Explain covariance shrinkage when feature count is large relative to sample size.

5 min read
90

Connect two feature views with canonical correlation

Explain how CCA finds related directions in two views and why high training correlation can be misleading.

5 min read
91

Fit a monotone curve by pooling violations

Fit nondecreasing predictions to a small ordered sequence and explain isotonic regression's limits.

5 min read
92

Understand CTC paths, blanks and repeated labels

Explain how CTC maps frame-level paths to a shorter label sequence and why greedy decoding need not maximize sequence probability.

5 min read
93

Calculate a convolutional network's receptive field

Calculate receptive field and effective stride through a stack of convolutions, stating padding assumptions.

5 min read
94

Reason about transposed convolution output shape

Explain transposed convolution shape arithmetic and why it is not generally the inverse of a convolution.

5 min read
95

Derive inverted dropout and its variance

Explain the scaling used by inverted dropout and what it preserves during training.

5 min read
96

Distinguish weight decay from an L2 gradient in Adam

Explain why adding an L2 penalty to an adaptive optimizer is not generally equivalent to decoupled weight decay.

5 min read
97

Calculate label-smoothed targets and their trade-offs

Explain multiclass label smoothing and distinguish two conventions for distributing the smoothing mass.

5 min read
98

Work through mixup training

Explain input and target interpolation in mixup and when the interpolated examples may be inappropriate.

5 min read
99

Learn a mean and input-dependent variance

Derive a Gaussian negative log-likelihood loss when prediction noise changes with the input.

5 min read
100

Connect Fisher information to estimation precision

Calculate Fisher information for a normal mean with known variance and explain the Cramer–Rao bound's scope.

5 min read
101

Use KKT conditions to identify an active constraint

Solve a simple constrained optimization problem and explain complementarity.

5 min read
102

Explain optimism in a bandit selection rule

Work through a simple upper-confidence selection rule and contrast it with always choosing the highest observed mean.

5 min read
103

Estimate variance from leave-one-out fits

Compute a jackknife variance estimate for a sample mean and explain why the leave-one-out estimates are not independent samples.

5 min read
104

Derive waiting time for independent successes

How many independent attempts should a worker expect before its first success, and when is that model misleading?.

5 min read
105

Explain exponential waiting times

Why does an exponential waiting model say past waiting does not change the remaining wait?.

5 min read
106

Update a Poisson rate with a Gamma prior

Estimate an event rate from counts and exposure while keeping uncertainty explicit.

5 min read
107

Model counts whose variance exceeds the mean

A count series has mean 4 and variance 12.

5 min read
108

Derive the maximum of uniform samples

For independent Uniform(0,1) samples, derive the distribution and mean of their maximum.

5 min read
109

Estimate time to observe every category

How many independent draws are needed on average to see every equally likely category?.

5 min read
110

Estimate identifier collision probability

Estimate the risk of at least one collision when assigning random identifiers from a finite space.

5 min read
111

Separate within-group and between-group variance

Explain how two stable populations can produce a variable combined metric.

5 min read
112

Reduce Monte Carlo variance with a control variate

Estimate E[X] using a correlated variable Y whose expectation is known.

5 min read
113

Use antithetic pairs without assuming they always help

Explain when paired samples U and 1−U reduce simulation variance.

5 min read
114

Design a valid rejection sampler

Sample from an unnormalized density using a proposal and a dominating envelope.

5 min read
115

Construct samples with an inverse CDF

Generate samples from an exponential distribution and explain how inverse-CDF sampling extends to discrete distributions.

5 min read
116

Bound deviations using only finite variance

How much can you say about a random variable when you know only its mean and variance?.

5 min read
117

Use a bounded-sample concentration bound

Choose a sample size for a bounded metric without assuming a normal distribution.

5 min read
118

Derive a scalar Kalman measurement update

Combine a noisy prediction and measurement with explicit uncertainty.

5 min read
119

Explain particle-filter weight collapse

Track a nonlinear hidden state with weighted particles and decide when resampling is needed.

5 min read
120

Derive stability of an AR(1) process

Explain when Xt=φXt−1+εt has a stationary variance.

5 min read
121

Align time series with dynamic time warping

Compare two sequences that express similar shapes at different speeds.

5 min read
122

Explain aliasing in sampled signals

Why can a sampled signal confuse a high frequency with a lower one?.

5 min read
123

Explain FFT leakage and window trade-offs

A pure tone appears in several FFT bins.

5 min read
124

Compare linear and quadratic discriminant analysis

Explain why sharing class covariance creates a linear decision boundary.

5 min read
125

Trace one AdaBoost reweighting step

Show how a binary weak learner changes example weights in AdaBoost.

5 min read
126

Quantify how correlation limits bagging

Why does averaging more models eventually stop reducing variance much?.

5 min read
127

Derive the Huber loss and robust gradient

Design a regression loss that is quadratic near zero error and less sensitive to large residuals.

5 min read
128

Derive soft thresholding for an L1 penalty

Solve a quadratic-plus-L1 subproblem and explain why coefficients can become exactly zero.

5 min read
129

Compare two rankers with a controlled interleaving test

Two search rankers reorder similar candidates. Design a small online interleaving experiment and explain what its click preference can and cannot establish.

3 min read

Take the ideas into a system.