InterviewStack.io LogoInterviewStack.io

Debugging and Performance Optimization Questions

Finding and fixing what is wrong or slow: systematic debugging strategies, reading stack traces, profiling to locate hotspots, and optimizing execution time and memory. Covers reasoning from symptom to root cause and measuring before optimizing, including runtime, memory, and profiling analysis. Tests how a candidate operates on code they did not write.

MediumSystem Design
45 practiced

A feature store computes expensive features repeatedly. Propose a caching strategy to reduce recomputation: design the cache key scheme, invalidation policy, storage layer (in-memory vs disk), and how to measure cache hit/miss impact on latency and correctness.

MediumTechnical
43 practiced

A PyTorch DataLoader in production is slower than expected. Explain how num_workers, pin_memory, prefetch_factor, and worker_init_fn can affect performance. Propose a methodical experiment to find optimal settings for your workload and hardware.

EasyTechnical
52 practiced

You have this PyTorch training loop in Python:

for batch in loader:
outputs = model(batch['x'])
loss = loss_fn(outputs, batch['y'])
loss.backward()
optimizer.step()

Training loss rapidly becomes NaN and validation accuracy collapses. List the most likely causes, explain how to reproduce and trace the exact cause, and describe concrete fixes you would apply to make the loop robust in production.

HardSystem Design
59 practiced

A distributed inference system needs to serve models with extremely low tail-latency. Explain how request scheduling, prioritized queues, CPU pinning, NUMA-awareness, and worker model placement reduce variability in p95/p99 latency. Provide a plan to evaluate these changes on real hardware.

EasyTechnical
58 practiced

List common causes of memory leaks in long-running Python ML processes (training or serving). For each cause, explain how you would detect it (which tools or metrics), reproduce a minimal example, and fix it safely without disrupting service.

Unlock Full Question Bank

Get access to all Debugging and Performance Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.