179 questions
No questions match those filters.
How do you implement streaming responses for an LLM app...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansStreaming’s real value is psychological, not computational: total time-to-completion for a response is roughly the same whether you stream it or not, but a user watching words appear within 200-400ms perceives the system as fast, while the same user staring at a blank screen for 5-8 seconds waiting for a full response perceives it as slow or broken — even though the backend did the same amount of work either way. Server-Sent Events cover the common case cleanly, since most chat UIs only need one-directional token delivery from server to client; WebSocket earns its extra complexity only when the client needs to interrupt generation or send additional input mid-stream.
The failure mode that catches teams off guard has nothing to do with the LLM call — it’s infrastructure between the server and the client. Nginx and similar reverse proxies buffer upstream responses by default, so tokens accumulate server-side and arrive at the browser all at once anyway, exactly the outcome streaming was supposed to prevent. Fixing it means explicitly disabling proxy buffering (X-Accel-Buffering: no for nginx) for the streaming endpoint. Beyond that, error handling gets genuinely harder mid-stream — a failure partway through means the user has already seen a partial, possibly misleading answer — and any content guardrail has to be able to evaluate partial tokens as they arrive, not just a complete response.