InterviewStack.io LogoInterviewStack.io

Debugging and Testing ML Systems Questions

Finding, diagnosing, and fixing problems in ML code, data, and models, and building tests that catch these problems before they reach users. Covers common ML pitfalls (data leakage, shape mismatches, silent training bugs, mis-specified loss or metrics), root-cause analysis of model regressions and production incidents (accuracy drops, calibration drift, intermittent or hard-to-reproduce failures), distributed-training-specific failures (multi-GPU divergence, intermittent OOM, precision-related instability), and the diagnostic tooling that supports it (reproducibility artifacts, structured logging, instrumentation). Also covers testing ML systems directly: unit tests for data and feature pipelines, validation checks for datasets and features, test oracles and acceptance criteria for probabilistic or non-deterministic model outputs, and integration and regression tests that catch model or pipeline regressions before deployment. Emphasizes the engineering rigor that keeps ML systems correct and maintainable.

HardTechnical
56 practiced

An image classification model's predictions change drastically with tiny changes to input pixel values. Explain how you would debug whether this sensitivity comes from a preprocessing mismatch, numerical precision issues, genuine model brittleness (a sharp decision boundary), or an adversarial-robustness problem, and suggest one targeted experiment for each hypothesis plus a mitigation once you've localized the cause.

HardTechnical
53 practiced

Design a test suite specifically to ensure numerically stable training when switching to mixed-precision (FP16) or quantized training. Include checks for NaNs and Infs, gradient underflow or overflow, correctness of dynamic loss-scaling, and an acceptable-accuracy-delta check comparing the mixed-precision model's final accuracy to the full-precision baseline. Describe the automated thresholds you would set and what remediation each failing check should trigger.

MediumTechnical
46 practiced

You are training a neural network and after several epochs the training loss becomes NaN. Describe a step-by-step debugging checklist: checking inputs and intermediate activations for NaNs/Infs, using a framework's anomaly-detection mode to localize the operation that first produces a NaN, checking for exploding gradients, and reviewing recent data or label changes. Include a short code snippet that checks a tensor for NaN/Inf values, and describe your first two remediation steps (e.g. gradient clipping, reducing the learning rate) and how you would confirm each one actually fixed the root cause rather than just delaying the failure.

MediumTechnical
49 practiced

A recurrent (RNN-family) model performs well during training but underperforms in production, where input sequences vary in length and padding behaves differently than in your training pipeline. What debugging steps and fixes would you apply around padding, masking, batch bucketing, and inference-time preprocessing to align production behavior with training, and how would you construct a minimal test case that reproduces the discrepancy?

MediumTechnical
50 practiced

You observe a gap between training and validation performance for a model and need to determine whether it is caused by ordinary overfitting or by data leakage. Design an experiment and validation plan that distinguishes the two, what results would point to leakage versus genuine overfitting, and how your conclusion would change if training loss were near zero but validation accuracy were also unstable (not just low) across runs.

Unlock Full Question Bank

Get access to all 39 Debugging and Testing ML Systems interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.