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.

MediumTechnical
45 practiced

Explain how layers like BatchNorm and Dropout, and data transforms like random crop, behave differently between training and inference. Describe a concrete bug scenario where a team forgets to switch a model to evaluation mode before serving it, what symptom that would produce in production (e.g. degraded, inconsistent, or slowly-drifting predictions), and how you would catch this specific class of bug in a pre-deploy test rather than discovering it in production.

MediumTechnical
43 practiced

Implement a function validate_events(events, schema) in Python that takes a list of event dictionaries and a schema dictionary (for example {'user_id': {'type': 'int', 'required': True}, 'amount': {'type': 'float', 'min': 0}, 'ts': {'type': 'timestamp', 'format': 'iso8601', 'required': True}}) and returns (valid_events, errors). The function must validate types, required fields, timestamp format, and numeric ranges. Discuss what error information you would include for each invalid record to make debugging a failed validation run fast.

MediumTechnical
51 practiced

Implement a deterministic, group-aware train/validation/test split function in Python. Requirements: split by hashing a group key (e.g. customer_id) so records sharing a group never span splits; the split must be reproducible across runs; target approximate fractions of 0.7/0.15/0.15; and the function should run in roughly linear time in the number of rows. Describe the edge cases you would test for (e.g. a group larger than a whole split's target size, a very small number of distinct groups) and how you would verify no group leaks across splits.

MediumTechnical
41 practiced

A production model returns predictions that differ from what the training notebook produced for the same inputs. Outline a systematic debugging checklist covering: code differences between the notebook and the deployed artifact, data-schema drift, environment and package-version differences, random seeds, feature-preprocessing mismatches, and model-artifact versioning. Indicate which checks are quick to run first and which require deeper investigation, and explain why this differs from a generic 'my model regressed' investigation.

MediumTechnical
42 practiced

A code-generation feature in your product sometimes produces incorrect or insecure code. Describe a testing and CI/CD strategy to catch regressions before deployment: unit tests, property-based tests, static analyzers, execution sandboxes, and fuzzing, plus staged rollout practices. Explain how you would define automatic blocking criteria (what specifically fails the pipeline) rather than relying on manual review alone.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.