InterviewStack.io LogoInterviewStack.io

Complexity Analysis and Performance Modeling Questions

Analyze algorithmic and system complexity including time and space complexity in asymptotic terms and real world performance modeling. Candidates should be fluent with Big O, Big Theta, and Big Omega notation and common complexity classes, and able to reason about average case versus worst case and trade offs between different algorithmic approaches. Extend algorithmic analysis into system performance considerations: estimate execution time, memory usage, I O and network costs, cache behavior, instruction and cycle counts, and power or latency budgets. Include methods for profiling, benchmarking, modeling throughput and latency, and translating asymptotic complexity into practical performance expectations for real systems.

MediumTechnical
65 practiced
How would you instrument and visualize GPU memory usage across a large multi-worker training run to detect memory leaks or fragmentation? Describe the data-collection method (NVML/Nvidia-smi, periodic dumps), visualization approach (time series per worker and aggregated HWM), and what patterns indicate true leaks versus expected episodic growth (e.g., gradient accumulation).
EasyTechnical
70 practiced
List practical steps and specific tools you would use to profile a Python-based model training job that appears slower than expected. Cover CPU, GPU, memory, I/O, and network checks, and include framework-level profilers or commands (e.g., torch.profiler, tf.profiler) and system tools (e.g., top, iostat, nvidia-smi, perf). Explain the order you would run checks and what signals indicate each type of bottleneck.
MediumTechnical
74 practiced
For an autoregressive generation model with vocabulary size V, beam width B, sequence length L, and average branching factor k after pruning, derive the time and memory complexity of beam search inference. Discuss practical trade-offs when increasing beam width and list strategies (e.g., batched scoring, vocabulary pruning) you would implement to reduce computational cost while maintaining quality.
HardSystem Design
77 practiced
Compare communication complexity (total bytes transferred and synchronization steps) for parameter-server style updates, synchronous all-reduce (ring and hierarchical), and asynchronous updates for training a model with N parameters across P workers. Discuss how network bandwidth, latency, batch size, and model sparsity influence which approach is preferable.
HardTechnical
87 practiced
You deploy a new model version and observe a 30% slowdown in p95 inference latency across the fleet. Outline a systematic debugging plan to isolate the root cause across model changes, runtime or driver updates, hardware differences, dependency upgrades, and infra changes. List the metrics, traces, and binary-search rollback steps you would execute and quick mitigations to restore SLA.

Unlock Full Question Bank

Get access to hundreds of Complexity Analysis and Performance Modeling interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.