An application needs an LLM answer inside a web page within two seconds, and long answers feel slow. What improves the user experience most?
- Exam domain
- Developing and deploying generative AI solutions
- Difficulty
- Medium
- In this mock
- 5 questions on this domainPractise this domain
Why D is the answer
Streaming tokens to the page as they are generated
Streaming shows the first tokens almost immediately, so users see progress instead of waiting for the full answer.
Remember: Stream for responsiveness.
In detail
- Stream for perceived speed.
- Pick model size by need.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Always using the largest modelWrong
Larger models are usually slower.
B. Batching all users' requests into one daily jobWrong
A daily batch cannot serve live requests.
C. Removing the system prompt, which is the main cause of slow responsesWrong
System prompts are rarely the main cost.
D. Streaming tokens to the page as they are generatedRight
Stream for responsiveness.
Use case
An illustrative scenario, not a real incident.
Illustrative: a help widget streams answers and users stop abandoning long replies.
See it in different ways
sequenceDiagram participant P0 as Browser participant P1 as App participant P2 as Model P0->>P1: request P1->>P2: stream=true P2-->>P0: tokens as they come
How to read this chart
- 1. Browser sends "request" to App.
- 2. App sends "stream=true" to Model.
- 3. Browser gets a reply from Model: "tokens as they come".
flowchart TD
Q{"Does a user wait?"}
Q -->|"Yes"| A0["Stream"]
Q -->|"No"| A1["Batch"]How to read this chart
- At "Does a user wait?": if "Yes", go to "Stream"; if "No", go to "Batch".