InterviewStack.io LogoInterviewStack.io

Assertions and Behavior Verification Questions

Choosing what to assert and how to verify behavior meaningfully. Covers assertion strategy, verifying observable behavior over implementation detail, avoiding weak or over-specified assertions, and using assertion libraries effectively. Emphasizes assertions that fail for the right reasons and give a clear diagnosis.

HardTechnical
135 practiced

Mixed precision (FP16/FP32) speeds up training but can introduce numeric instability. Describe tests and runtime assertions you would add to detect instability early (NaNs in activations/gradients, sudden loss spikes). Provide a PyTorch-based example of an assertion that catches overflow/underflow during training with AMP.

HardTechnical
82 practiced

Design an automated process that creates a reproducible minimal failing example for flaky or failing training jobs. Describe what artifacts to capture (seed, code commit hash, small dataset slice, model checkpoint, environment), how to reduce size of artifacts, and an automated script that attempts to reproduce and validate the problem.

EasyTechnical
84 practiced

Explain property-based testing and show a concise Hypothesis example that tests a text-normalization function normalize_text(s: str) -> str for properties: idempotence (normalizing twice yields same result) and that output contains no control characters. Provide Hypothesis strategies you would use.

EasyTechnical
71 practiced

When validating model predictions against ground truth in unit or integration tests, describe the difference between asserting exact equality, threshold-based assertions (e.g., accuracy above X), and distributional checks. Provide guidelines for when to use each and how to write assertion messages that help debugging.

EasyTechnical
83 practiced

Describe steps to create a minimal, reproducible failing example when you encounter a bug in a training pipeline that only occurs on specific data and hardware. What artifacts should you collect and what small scripts or fixtures would you include with a bug report to help engineers reproduce the issue?

Unlock Full Question Bank

Get access to all 40 Assertions and Behavior Verification interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.