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.

EasyTechnical
73 practiced

A large model-training run fails with a GPU out-of-memory error when you increase the batch size. List the practical mitigation strategies available to you, and describe the trade-off each one makes (extra compute time, implementation complexity, or a change in effective batch-size semantics).

HardTechnical
52 practiced

In a multi-node distributed training job, one node intermittently throws a CUDA out-of-memory error, or the job produces diverging results across otherwise-identical nodes. Outline a thorough debugging plan: what logs and traces to collect (NCCL, CUDA, system logs), how to distinguish a genuine memory leak or fragmentation from a legitimate peak-allocation spike, how to check that batch sizes and any model sharding are actually consistent across ranks, and how you would isolate WHICH rank is producing the anomaly (e.g. a NaN) when the job spans many GPUs. Give one short-term mitigation to keep the job running while you investigate.

HardTechnical
43 practiced

After migrating model training from on-premises hardware to cloud GPUs, validation AUC drops by several points compared to the on-prem results, with no intentional code change. Propose a root-cause investigation plan covering the full environment difference between the two setups, and describe concrete steps to reproduce and isolate the regression to one specific difference.

HardTechnical
43 practiced

A large transformer model's production performance has degraded, and you suspect the cause lives in a specific internal component (for example a particular attention head or an embedding layer) rather than the model as a whole. Propose a method to attribute the regression to internal components: component ablations, per-head masking, or representational-similarity analysis. Describe the instrumentation you would need to run these experiments safely against production traffic, and how you would validate that a component is actually causally responsible before changing the deployed model.

MediumTechnical
38 practiced

Do a code walkthrough of a model-training loop with a colleague. Explain where common pitfalls occur in a loop like this one, and for each one you identify, name one concrete code-level change or guard that would prevent it. Keep every answer tied to an actionable code change, not just a description of the pitfall.

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.