Streaming UI
Synonyms: streamed responses, token streaming, typewriter effect, progressive rendering, live output
Definition
Use cases
- Scroll hijack: The chat jumps down with every new line while the user is still reading paragraph 1.
- Markdown flicker: A half-written table shows up as raw pipes and asterisks, then snaps into shape and shifts the whole layout.
- No way out: The answer goes the wrong way in line 2, and the only option is to sit through the rest.
How it's used in practice
- Cover the gap before the first token: Show a "Generating" state on the avatar until text starts.
- Add each chunk to the end: Use a streaming Markdown renderer that holds back half-finished syntax until it's complete.
- Follow only at the bottom: Auto-scroll if the user is already at the bottom. If they scrolled up, show "Jump to latest".
- Put Stop where Send was: One tap, no confirm, then offer Regenerate.
- Mark the finish: Swap in Copy and Regenerate, and announce completion once through a polite live region.
Challenges & limitations
- Moderation lags behind: Partial text reaches users before safety checks on the full output can run.
- Structured output can't stream cleanly: Tables, charts, and tool inputs only make sense once complete.
- Speed is uneven: Output can pause mid-sentence while the model calls a tool, which reads as a freeze unless the UI says what's happening.
Free resources
- Chrome for Developers: Best practices to render streamed LLM responses — why to append chunks, use a streaming Markdown parser, and sanitize the combined output.
- OpenAI: Streaming API responses — server-sent events, plus a note on the moderation risk of partial output.
