All jobs / AI engineer / LLM APIs
AI engineer interview question · 3–5 years
You switch the assistant to streaming. What changes for your backend beyond “the text appears sooner”?
The strongest answer
Only time to first token improves. Failures can now land mid-answer, so I handle partial output, cancel upstream when the client disconnects, and accept that I cannot validate or moderate the full reply before it shows
Why it works
Right — streaming moves the first byte, not the last. One success-or-failure becomes a sequence that can break halfway, and an abandoned stream can keep generating, and billing, unless you cancel it.
What a good answer covers
- Streaming moves first token, not last.
- Plan for failure mid-answer.
- Cancel upstream when the client leaves.
- Full-reply checks now happen after display.
Answers that fall short
- Close, but not the strongest: Mostly infrastructure: make sure proxies and gateways do not buffer the stream, and raise the idle timeouts
True and worth saying, but it is plumbing. The design change is partial failure and losing the chance to check the whole answer first. - Weak: The model generates faster in streaming mode, so total latency and cost both go down
Same tokens, same total time, same cost — streaming changes when the user sees them, not how fast they are made. - Red flag: I would have the browser call the provider directly with our API key, so the stream skips our servers
A key in the browser is a key anyone can copy. The stream must pass through a backend that holds the secret and enforces limits.
Who gets asked this
More LLM APIs questions
- 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…
- What are your levers, in what order, and what do you promise?
- 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?