InterviewStack.io LogoInterviewStack.io

Model Deployment and Inference Optimization Questions

Serving trained models efficiently in production. Covers deployment and containerization, real-time and batch serving, latency budgets, throughput and cost optimization, quantization and model compression, and online/real-time learning constraints. Emphasizes meeting production performance targets without sacrificing model quality.

MediumTechnical
23 practiced

Estimate the memory footprint and approximate floating point operations (FLOPs) for a Transformer model with ~350 million parameters, sequence length 512, and batch size 8 during inference. Clearly state assumptions (e.g., float32 weights, number of layers, hidden size) and recommend hardware choices and optimizations (quantization, model parallelism) to meet a 500ms latency SLO.

MediumTechnical
17 practiced

Coding (Python): simulate a batch inference scheduler to evaluate throughput and latency trade-offs. Input parameters: per-item single-thread latency l0 (ms), a function speedup(batch_size) that returns relative per-item speedup (e.g., 1.0 -> no speedup, 0.5 -> per-item half time), max batch size B, request arrival rate λ (req/s). Implement a simulator that computes average latency and 95th percentile latency under a simple batching policy (collect up to B items or wait t_max ms). Explain assumptions and how the simulator could guide architecture decisions.

EasyTechnical
19 practiced

Explain the primary functional and resource differences between the training and inference phases of machine learning models. In your answer, cover compute patterns (forward vs backprop), memory usage (activations, gradients, optimizer state), latency vs throughput goals, data requirements, and typical optimization priorities for each phase. Give concrete examples (e.g., BERT fine-tuning vs BERT serving) and explain how these differences drive hardware and architecture choices.

EasyTechnical
24 practiced

Describe the difference between structured and unstructured pruning techniques for neural networks. For each approach, explain how pruning is applied, what sparsity patterns result, the implications for actual runtime speedups on CPU/GPU, and situations where you would prefer one over the other in production.

HardTechnical
18 practiced

You're optimizing matrix operations for a tight inner loop in C++ that will run on both CPU and GPU. Describe how BLAS/LAPACK libraries, memory layout (row-major vs column-major), cache blocking, and numeric precision choices affect performance and numerical behavior. Provide guidelines for interoperability with Python-based stacks.

Unlock Full Question Bank

Get access to all 24 Model Deployment and Inference Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.