Measure where the time goes first: retrieval, reranking, each model call, tool calls and network. Then attack the largest pieces. Stream the response so users see text quickly, cut output length since generation time grows with output tokens, run independent steps in parallel, use a smaller model for routing or simple steps, cache repeated work, and keep a stable prompt prefix where the provider supports prompt caching.
Why interviewers ask this
Latency is one of the most common complaints about LLM products, and the interviewer wants a measured approach rather than reaching straight for a faster model. They listen for a breakdown of where the time goes, the distinction between time to first token and total time, the effect of output length, and parallelism across steps. Knowing that streaming improves perceived speed even when total time barely moves shows product sense.
How to structure your answer
- Break the eight seconds down with tracing.
- Separate time to first token from total generation time.
- Fix the biggest components first.
- Improve perceived speed with streaming and progress cues.
Example answer
Eight seconds is a symptom, so I start with a trace of where it goes. On a system like this it is usually several model calls in sequence plus retrieval. I once found a request doing query rewriting, retrieval, reranking, the answer and a separate safety check, all one after another, with a long answer on top. Once you can see that, the fixes are fairly mechanical. Output length matters a lot because generation time grows with the number of tokens produced, so we tightened the answer format and asked for concise answers, which took a big slice off total time. Steps that did not depend on each other, like the safety check on the question and retrieval, ran in parallel. The query rewrite moved to a much smaller model. Repeated questions hit a cache, and keeping the long system prompt identical at the start of every request let us use the provider's prompt caching. Then perceived speed: we streamed the answer, so users saw the first words in about a second, and that did more for the complaints than anything else we changed.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- Which matters more here, time to first token or total latency?
- How would you cache answers safely when the documents change?
- When would you accept a weaker model to get lower latency?
Related ai engineer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions