Skip to content
RED SAGSkills
hardMachine Learning Engineer interview question

How would you design LLM inference serving to maximise throughput while keeping latency acceptable?

What the interviewer wants to hear

  • Continuous batching to keep the GPU busy
  • Paged KV cache and prefix caching to fit more requests
  • Quantisation and efficient attention kernels
  • Speculative decoding or smaller models for latency
  • Separate SLOs for time to first token and per-token latency
  • Autoscaling, routing and load testing with realistic traffic

Model answer

I would start with a modern serving engine that supports continuous batching, so new requests join the running batch at each decoding step instead of waiting for a whole batch to finish. Memory is the main limit, so I use a paged KV cache to avoid fragmentation and prefix caching for shared system prompts. Quantising weights to 8 or 4 bits, and the KV cache where quality allows, frees memory for more concurrent sequences. Fused attention kernels cut memory traffic. For latency I track time to first token and time per output token separately, cap the maximum batch size to protect tail latency, and consider speculative decoding. I might route easy requests to a smaller model. Finally I load test with realistic prompt and output lengths, set autoscaling on queue depth and KV cache usage, and monitor p50, p99 and cost per thousand tokens.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Machine Learning Engineer questions