Top 30 Intermediate AI & ML Interview Questions and Answers
30 intermediate multiple-choice AI & ML interview questions, past the definitions: how the pieces fit together, what breaks in practice, and the trade-off behind a choice. They come from 30 bites in the AI & ML library, the middle slice of the 546 AI & ML interview questions in the library. 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.
Artificial intelligence, machine learning, and data science
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
When training a large transformer, training loss falls while validation loss rises. Which action most directly addresses the root cause?
Show the answer
Answer: b · Apply early stopping or add regularization like weight decay
The divergence signals overfitting, where the model memorizes training noise instead of generalizable patterns. Early stopping and regularization directly combat this, whereas longer training or more parameters typically worsens the gap, and a lower learning rate does not directly fix memorization.
Read the full bite: Validation loss increases while training loss decreases: what is this?
Question 2 of 30
A monthly subscriber cancels mid-cycle but retains access until month-end. Which approach reflects a rigorous churn definition for this user?
Show the answer
Answer: a · Waiting until the billing period ends or a reactivation window passes
A rigorous definition ties churn to the actual end of access or the close of a defined renewal window, not just the intent signal. Counting the cancellation click immediately is the naive error highlighted in the card, because the user may still revert and the revenue is still active through the billing period.
Read the full bite: How do you define churn for a subscription service?
Question 3 of 30
A deployed fraud model degrades. Using immutable lineage best practices, what is the most reliable way to isolate data drift from a code bug?
Show the answer
Answer: a · Reproduce the exact training run by combining the manifest's commit SHA, dataset hash, and locked dependencies, then verify the metrics match production logs
Reproducing the full training context from the manifest proves the model still yields the same metrics, confirming that production degradation is due to data drift rather than a code bug. Option B is tempting because it uses the exact dataset, but swapping in the latest code introduces a new variable and breaks the lineage chain needed for a valid comparison.
Read the full bite: Why version code, data, and models in MLOps?
Question 4 of 30
How are the intrinsic parameters fx and fy in K derived from physical camera properties?
Show the answer
Answer: a · They equal the focal length divided by pixel width and height respectively
fx and fy convert the physical focal length into pixel units by dividing by pixel width and height, making C correct. A is a common misconception because K stores focal length in pixel units, not millimeters, and D is wrong since distortion is modeled outside the idealized pinhole matrix.
Read the full bite: Explain the pinhole camera model and intrinsic matrix K
Question 5 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 6 of 30
A checkout A/B test shows significantly higher conversion but slightly lower AOV. What is the strongest basis for a launch recommendation?
Show the answer
Answer: d · Estimate net revenue and ensure the AOV decline is within a pre-specified non-inferiority margin
The right framework classifies conversion as a success metric and AOV as a guardrail requiring non-inferiority, then uses net revenue to judge the business outcome. Treating AOV as a co-success metric that must significantly increase is a tempting error that causes unnecessary conservatism and missed wins.
Read the full bite: How would you recommend launching a checkout flow with mixed A/B metrics?
Question 7 of 30
In full BPTT, what is the primary reason memory usage grows linearly with sequence length T?
Show the answer
Answer: c · All intermediate hidden states from the forward pass must be kept for the backward pass.
During BPTT the backward pass flows through every time step, so every forward hidden state must be retained, yielding O(T) memory. Option D repeats the common misconception that training memory is constant like inference memory, while option A confuses unrolling with parameter duplication.
Read the full bite: Explain BPTT and its computational and memory challenges for long sequences
Question 8 of 30
A marketing team debates predicting exact spend versus High/Medium/Low tiers. What most strongly determines whether regression or classification is the better framing?
Show the answer
Answer: a · Whether the downstream campaign action requires a ranked list and continuous segmentation or a hard gate into fixed segments.
The campaign action dictates whether you need a ranked continuous score or a discrete gate, making B correct. D is tempting but dangerous because choosing classification solely for yes/no simplicity ignores the information loss from binarizing a continuous signal and may mismatch flexible budget allocation.
Question 9 of 30
Which event should trigger an automated CI/CD retraining pipeline rather than just an alert or manual review?
Show the answer
Answer: c · Sustained accuracy drop of 5% over a rolling window or business metric degradation past a predefined cost threshold
The card specifies that automated retraining launches on sustained accuracy drops of 5% or more or business metric degradation exceeding a cost threshold, whereas latency spikes and missing features should page an on-call engineer for infrastructure issues. Weekly manual reviews and overly sensitive single-hour drift alerts are red flags that signal immature operational practices.
Read the full bite: What production metrics and auto-thresholds trigger model retraining?
Question 10 of 30
During checkerboard calibration, why must you capture many images of the board at different orientations rather than a single frontal shot?
Show the answer
Answer: b · Varied views provide the geometric diversity needed to solve stably for intrinsics and distortion
Multiple poses constrain the parameter estimation enough to recover intrinsics and distortion coefficients reliably. One frontal view is degenerate and underdetermines the solution; it has nothing to do with resolution.
Question 11 of 30
What core limitation of a vanilla RNN encoder-decoder does the attention mechanism specifically address?
Show the answer
Answer: a · Compressing the entire input into one fixed-size vector loses detail on long sequences
Attention removes the single fixed-context-vector bottleneck by letting the decoder weight all encoder states per step. Parallelism and positional encodings are Transformer concerns, not what classic seq2seq attention was introduced to fix.
Read the full bite: Attention in Sequence-to-Sequence Models
Question 12 of 30
Why is demosaicing necessary after a Bayer sensor captures an image?
Show the answer
Answer: a · Because each photosite records only one color channel, leaving missing values to estimate.
Demosaicing is required because every photosite measures only a single color channel, so the missing two channels must be interpolated from neighbors. Option D represents the common misconception that Bayer pixels already contain complete RGB data.
Read the full bite: How does a Bayer filter capture color and what is demosaicing?
Question 13 of 30
Switching from RGB to YCbCr does not reduce uncompressed frame size, yet 4:2:0 YCbCr cuts bandwidth roughly in half. What best explains where the savings come from?
Show the answer
Answer: d · Separating luma from chroma allows chroma planes to be stored at lower spatial resolution because human eyes have lower color spatial acuity.
The YCbCr transform is lossless and does not reduce uncompressed size; savings come from chroma subsampling, which exploits the human visual system's lower spatial resolution for color versus brightness. Distractor B is wrong because the transform does not inherently use fewer bits per pixel—it merely enables efficient subsampling and quantization.
Read the full bite: Compare YCbCr and RGB. Why chroma subsampling for compression?
Question 14 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 15 of 30
Why does multi-head attention generally not cost much more than a single full-width attention head?
Show the answer
Answer: c · The model dimension is split across heads, so each head operates in a smaller subspace
The total dimension is partitioned among heads, keeping aggregate compute comparable to one full head while gaining diverse attention patterns. Heads run in parallel with their own projections, not shared weights, and each still uses softmax.
Question 16 of 30
During parallel teacher-forced training, what problem does the causal mask in decoder self-attention solve?
Show the answer
Answer: c · It stops position i from attending to future target tokens, preventing the model from copying answers
The causal mask forces token i to attend only to prior positions, preserving the autoregressive property and stopping the model from cheating by looking at future target tokens during parallel training. Option D describes the padding mask, which is a common misconception.
Read the full bite: What is masked in decoder self-attention and why?
Question 17 of 30
What justifies using a z-test for a population mean when the underlying data are heavily skewed?
Show the answer
Answer: a · The sampling distribution of the sample mean becomes approximately normal for large n
The CLT states that the sampling distribution of the sample mean approaches normality as n grows, which justifies using z-tests even when the population is skewed. Option B describes the Law of Large Numbers, a common look-alike that explains convergence to a single value rather than the bell-curve shape required for inference.
Read the full bite: Explain the Central Limit Theorem and its importance for hypothesis testing
Question 18 of 30
Why does a median filter remove salt-and-pepper specks more cleanly than a Gaussian blur of similar size?
Show the answer
Answer: c · Extreme outlier pixels sort to the ends of the window and are never chosen as the median
Median selection ignores extreme values, so corrupted black or white pixels are discarded while edges stay sharp. Gaussian blur averages those outliers into the result, smearing the noise and blurring edges.
Question 19 of 30
Which statement correctly describes how increasing model complexity affects bias and variance?
Show the answer
Answer: b · Bias decreases but variance increases because the fit depends more on the specific training sample.
The card explains that increasing complexity reduces bias by fitting training data more closely but simultaneously increases variance by making predictions dependent on the specific sample. Option D is the most tempting distractor because it reflects the common red-flag misconception that adding parameters improves both error sources.
Question 20 of 30
How does a tool like DVC let you version a 10TB dataset without duplicating it per version?
Show the answer
Answer: d · It stores content-addressed objects so unchanged files are shared across versions and only deltas are added
Content-addressed hashing means identical files are stored once and reused across versions, so a new version costs only changed objects. Putting binaries in Git or sampling would defeat reproducibility.
Question 21 of 30
A medical model reports 99% accuracy on a disease with 1% prevalence. Which observation best shows why accuracy is misleading?
Show the answer
Answer: a · The model could predict every patient is healthy and still score 99%.
When prevalence is 1%, an all-negative classifier automatically achieves 99% accuracy while detecting zero actual cases, proving accuracy can mask total failure. Distractor A is a common misconception the card explicitly warns against, as the problem is class imbalance rather than sample size.
Read the full bite: Why is 99% accuracy misleading with 1% disease prevalence?
Question 22 of 30
Which statement best explains why the Sobel Gx kernel has its specific 3x3 weight pattern?
Show the answer
Answer: b · It factors into a horizontal central-difference filter and an orthogonal vertical smoothing filter.
The Sobel Gx kernel is separable into a horizontal central-difference row and a vertical smoothing column, which reduces noise while estimating the partial derivative. Distractor A is wrong because, although the smoothing weights loosely approximate a Gaussian, the kernel is separable and explicitly not rotationally invariant.
Read the full bite: How does the Sobel operator approximate image gradients for edge detection?
Question 23 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 24 of 30
When applying a 3x3 convolution to the top border of a bright photo, which padding mode preserves spatial dimensions while avoiding dark vignettes and flat streaking?
Show the answer
Answer: c · Reflect-padding, because it mirrors edge pixels to assume continuity across the boundary
Reflect-padding mirrors edge pixels to maintain continuity across the boundary, avoiding both the dark vignettes caused by zero-padding and the flat streaking caused by replicate-padding. Replicate-padding is tempting because it avoids darkening, but it creates frozen-edge artifacts by repeating the same pixel value outward.
Read the full bite: Zero-padding vs reflect vs replicate padding and their visual artifacts
Question 25 of 30
Under Chinchilla's compute-optimal scaling laws, how should a fixed FLOP budget be divided between model parameters and training tokens?
Show the answer
Answer: b · Scale model parameters and training tokens equally, resulting in smaller models trained on much more data.
Chinchilla showed that for a fixed compute budget, parameters and training tokens should be scaled equally, meaning smaller models must be trained on proportionally more data to be compute-optimal. Option D describes the pre-Chinchilla approach that produced undertrained models, while option C incorrectly suggests holding model size fixed rather than scaling both dimensions together.
Read the full bite: How did Chinchilla change compute allocation between model size and data size?
Question 26 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 27 of 30
What is the primary reason that complex feature computations on a 1 TB pandas DataFrame are riskier in Dask than in Apache Spark?
Show the answer
Answer: b · Dask lacks an advanced query planner like Spark's Catalyst, making complex shuffles and global aggregations less efficient
The card highlights that Dask can struggle with complex shuffles, while Spark's optimized query planner and Catalyst optimizer make it more resilient at terabyte scale. B is tempting because it reverses the actual API trade-off: the card emphasizes that Dask offers a pandas-like API with minimal changes, whereas Spark demands a heavier rewrite.
Read the full bite: How would you scale 1TB Pandas feature computation across machines?
Question 28 of 30
In a canonical 3D hybrid strategy for a massive model, why is tensor parallelism placed within a node while pipeline parallelism spans across nodes?
Show the answer
Answer: c · Tensor parallelism requires frequent all-reduce on activations that saturates high-latency inter-node links, whereas pipeline parallelism uses coarser point-to-point communication.
Tensor parallelism performs all-reduce on activations every layer, so keeping it inside a node avoids saturating slower inter-node bandwidth, while pipeline stages only exchange activations via point-to-point between passes. Option A is tempting because it mentions NVLink, but pipeline parallelism can also use fast links; the placement is driven by tensor parallelism's intense communication pattern, not pipeline's inability to use NVLink.
Read the full bite: Explain data, tensor, and pipeline parallelism and hybrid training strategy
Question 29 of 30
Which combination of techniques should anchor a production drift detection pipeline to catch both feature-level and interaction-level shifts without alert fatigue?
Show the answer
Answer: c · Chunk live traffic into periods, run separate univariate tests per feature type, add multivariate detection, and rank threshold alerts
Chunking, type-specific univariate tests, multivariate layering, and ranked thresholds together catch individual and interaction shifts while controlling noise and fatigue. Option A sounds maximally vigilant but is computationally infeasible and statistically noisy, as comparing every single row against the full training set generates excessive alerts and misses stable period patterns.
Read the full bite: How would you design automatic data drift detection for production inference?
Question 30 of 30
In a long pre-training run, the loss suddenly spikes. Which action should you take FIRST before applying any mitigation?
Show the answer
Answer: c · Check the gradient norm logs to confirm whether a gradient explosion occurred
The card emphasizes checking gradient norm logs first to confirm an explosion before deciding on recovery actions like rollback or hyperparameter changes. Option A is tempting because rolling back is a crucial recovery step, but doing so before confirming the root cause is premature and skips the diagnostic phase.
Read the full bite: What causes sudden loss spikes in long pre-training runs?
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.