Users say the bot feels slow. Will streaming help?
Question
A support bot first searches the help center for 0.4 seconds. The model's first token arrives 0.8 seconds after it gets the request. Then it writes 50 tokens a second. A typical answer is 400 tokens. Today the app shows the answer only when it is complete.
Users say the bot feels slow. A teammate says: "Turn on streaming, and it will be fast."
- When does the user see the first words, with and without streaming? When is the answer complete?
- What does streaming not fix, and what would make the whole answer faster?
- When can't you stream the answer straight to the user?
Show hints (3)
- "TWO PARTS"
Split the wait into the time to the first token and the time to write the rest. Writing 400 tokens at 50 a second takes how long?
- "WHAT STREAMING CHANGES"
Streaming shows each token as soon as it is ready. Does the model write any faster?
- "CHECK IT FIRST"
What if your code must parse the answer as JSON, or a safety check must read the whole answer before anyone sees it?
Show checked explanation
Streaming moves the first words from 9.2 seconds to 1.2 seconds, so the bot feels much faster. The answer still completes at 9.2 seconds, because the model writes no faster. To finish sooner, write shorter answers: 150 tokens complete at 4.2 seconds. Buffer what must be checked whole first, like JSON for your code.
def timeline(search, first_token, tokens, speed): # seconds, tokens/s first = search + first_token return first, first + tokens / speed for tokens in (400, 150): first, done = timeline(0.4, 0.8, tokens, speed=50) print(f"{tokens} tokens: first words {first:.1f} s, complete {done:.1f} s") print("without streaming, the user sees nothing until complete")
400 tokens: first words 1.2 s, complete 9.2 s 150 tokens: first words 1.2 s, complete 4.2 s without streaming, the user sees nothing until complete
Code run on CPython 3.12 against the example above. Checked by an editor other than the author.
Walkthrough
The time for an LLM answer has two parts:
total ≈ time to first token + output tokens ÷ tokens per second
Time to first token (TTFT) covers everything before the model writes: the search, any queue, and reading the prompt. Here it is 0.4 + 0.8 = 1.2 seconds. Writing 400 tokens at 50 a second takes 8 more seconds.
| first words | answer complete | |
|---|---|---|
| no streaming | 9.2 s | 9.2 s |
| streaming | 1.2 s | 9.2 s |
| streaming, 150-token answer | 1.2 s | 4.2 s |
Without streaming, the user stares at a spinner for 9.2 seconds. With streaming, text starts at 1.2 seconds, and the user reads while the model writes. That feels fast, but the answer still completes at 9.2 seconds.
To finish sooner, cut output tokens, because writing is usually the slowest part. Ask for short answers, and don't ask for long formats you never show. A shorter prompt mostly helps the time to first token, and usually only a little.
When you can't stream straight to the user:
- Your code needs the whole answer. Half a JSON object can't be parsed. Wait for the end, or stream only the text field the user reads.
- A check must read it first. If a safety check must approve the whole answer, you buffer it, and the user waits the full 9.2 seconds. You can stream and check each sentence as it arrives instead, but then a bad sentence may reach the user before the check catches it.
Common mistakes
- Saying streaming makes the model faster. It shows tokens earlier, but the last one arrives at the same time.
- Forgetting the steps before the model. The 0.4-second search happens before the first token, and streaming can't hide it.
- Measuring only the average total time. Track time to first token and total time separately, at p50 and p95.
Follow-up questions
- "The bot first calls a tool, like looking up the order. What changes?" The tool call and an extra model step now come before the final answer, and the user sees nothing meanwhile. Show a short status like "Checking your order…", run unrelated tool calls in parallel, and stream the final answer.
- "Users still say the bot is slow, even with streaming. What would you check?" Look at p95 time to first token, not the average. A slow search, a queue or a huge prompt can delay the first word by seconds. Also check answer length: a bot that writes 800 tokens when 150 would do is slow by design.
What a strong answer covers
Splits latency into time to first token plus output tokens ÷ speed. Says streaming changes when text appears, not when the answer completes. Cuts output length to finish sooner. Buffers when the whole answer must be checked first.
Open in interactive practice deck →