All jobs / AI engineer / LLM APIs
AI engineer interview question · 5+ years
The assistant’s p95 response time is 9 seconds. Product wants it under 3 and asks you for a date.
What are your levers, in what order, and what do you promise?
The strongest answer
Measure where the time goes first. Then shorten the output, stream, trim or cache the prompt, send easy requests to a smaller model — and promise a date only after the eval set shows the quality cost
Why it works
Exactly — output is generated token by token, so the length of the answer often dominates, but you only know after measuring. Every lever trades quality, and the eval set is how you price it.
What a good answer covers
- Measure before you pull any lever.
- Output length often dominates generation time.
- Stream, trim, cache, route the easy requests.
- Price every lever on the eval set.
Answers that fall short
- Close, but not the strongest: Switch to the fastest small model the provider has and turn on streaming; that usually gets there
Both are real levers, but pulled blind: if the time is in retrieval or in three chained calls, a smaller model fixes nothing and costs quality. - Weak: Ask the provider for dedicated capacity; latency is on their side, so there is little we can do
Some latency is the provider’s, but prompt size, output length, call count and model choice are all yours. - Red flag: Promise the date now, then set a hard three-second timeout so that the metric meets the target
A timeout that cuts off slow answers makes the chart green and the product worse. Gaming your own metric is what an interviewer remembers.
Who gets asked this
More LLM APIs questions
- Your chat feature sends only the user’s newest message to the model API, and follow-up questions get confused…
- How do you choose which model to call for a new feature?
- What is missing between the model’s reply and your order object?
- You turned on prompt caching for an assistant with a long system prompt and a dozen tools, but the provider’s…
- At peak your service starts getting HTTP 429 from the model provider. What should the client do?
- You switch the assistant to streaming. What changes for your backend beyond “the text appears sooner”?
- Traffic to the assistant grew by a tenth this month and the model bill doubled. How do you find out why, and…
- A nightly job classifies the day’s support tickets through the same synchronous endpoint and API key as the…