Model and Inference EngineeringEnd-to-end serving and modalitiesStaff
Why can first-token latency rise while GPUs are underused, and how would you find the bottleneck?
By Amit Kumar3 min readWorked answer includedReviewed 26 Sept 2026
The question
Interview question
After a traffic increase, GPU utilization falls and first-token latency rises. Measured model execution time is unchanged, while prompts now contain longer code files and histories. Design experiments to distinguish CPU input work, engine scheduling and GPU execution before adding capacity. Some responses also pause after the first token, so include the output path.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Before a GPU can process a chat request, software must turn the conversation into the model’s input. A chat template serializes roles, messages and tool definitions into the format expected by the model. Tokenization converts that rendered text into token IDs. These operations use CPU resources, as do admission and parts of scheduling. After generation, detokenization converts IDs back into text for streaming. A busy input or output stage can leave an expensive GPU waiting.
Current vLLM optimization guidance identifies input processing, scheduler work and output processing as possible CPU bottlenecks. That makes them hypotheses to measure here, rather than proving tokenization alone is the cause. A dashboard starting at model execution omits the time users spend waiting to reach it.
For a hypothetical slow request, the timeline might be 20 ms for authentication, 800 ms waiting for a tokenizer worker, 120 ms tokenizing and 60 ms on GPU before output begins. Its one-second delay is mostly outside the GPU. Compare this with an otherwise matched pretokenized request. The numbers illustrate the experiment, not an expected tokenizer performance claim.
Put a trace clock at request receipt, template completion, tokenization completion, engine admission, prefill start (GPU processing of the prompt), first token, detokenization and client flush. Compare time distributions by prompt tokens, raw bytes, template version, tenant, CPU host, and arrival burst. A long code file can be expensive to tokenize even if the eventual token count looks manageable. A single-threaded template or a shared process pool can produce a queue while GPUs wait. Check CPU saturation, cgroup limits, run queues, allocator or GC pauses, and scheduling time inside the engine. Measure offered demand and waiting requests, including ones that time out before model admission.
To isolate the stage, replay a permitted sample with a fixed pretokenized input in a test environment and compare it with the ordinary frontend path. Preserve the exact tokenizer and template version so this comparison does not silently change the request. If the frontend is the limit, add appropriately sized CPU workers, keep them near their GPU or NIC where locality matters, and bound the intake queue. Cache only deterministic preprocessing whose key includes the prompt and policy-relevant version. Extra GPUs behind the same saturated frontend will mostly sit idle.
The stream pause changes the investigation. Check per-token engine scheduling, detokenization, serialization, network flush, and client backpressure. It might be the same CPU pool that was slow before prefill, or a separate decode or transport fault. One trace per token can tell us where the first growing gap appears. If model steps become slow under larger batches, the original “unchanged forward-pass time” aggregate was hiding a workload slice. Fix the measured critical path and retest completed answers within both first-token and inter-token targets.
Related questions
Keep practising model and inference engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux