---
title: "Discussion on \"Why AI replies stream word-by-word\" | Hashnode"
description: "Discussion on \"Why AI replies stream word-by-word\". Why AI replies stream word-by-word"
url: "https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why AI replies stream word-by-word](https://nagspidey.hashnode.dev/why-ai-replies-stream-word-by-word?utm_source=hashnode&utm_medium=feed)

Why AI replies stream word-by-word

Oct 5 · 8 min read · nagspidey.hashnode.dev  
Read the article

-   [#ai](https://hashnode.com/tag/ai)
-   [#llm](https://hashnode.com/tag/llm)
-   [#streaming](https://hashnode.com/tag/streaming)
-   [#machine-learning](https://hashnode.com/tag/machine-learning)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Nagappan S](https://hashnode.com/@imkarthik03)

@imkarthik03 · Chennai, India

  
[View profile](https://hashnode.com/@imkarthik03)

Building scalable products at the intersection of Full Stack Engineering & AI

I build scalable web apps, experiment with AI, and turn complex engineering problems into working products.

## Responses 7

Markdown supported · ⌘↵ to post

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Oct 6](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac54d574e3ae971a15544d5)

Your split UTF-8 example has a cousin in streamed tool calls: the arguments arrive as JSON fragments, and parsing per chunk crashes on half-formed objects. I buffer the fragments and parse once the stop signal arrives. Does the series cover streamed tool calls?

[Nagappan S](https://hashnode.com/@imkarthik03)

[Oct 13](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac54d574e3ae971a15544d5#reply-6acdd272acaf114305c1ac7f)

Buffering until the stop signal is the safe default. If you need to act earlier, an incremental JSON parser that only commits complete values works, but I'd still never execute the call before the arguments validate. It's not in the series yet, so it's a good candidate for a follow-up post. Thanks for the nudge.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 5](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac39a2f6dbf382c5678bc73)

The separation between generation latency and perceived latency is useful, and the moderation-buffering example shows that delaying delivery can have a real purpose. I would distinguish transport packet loss from a broken application stream in the failure section: HTTP over TCP already recovers ordinary packet loss while the connection survives.

The harder UI case is a reconnect after the response was partly displayed. A test could cut the connection after a complete SSE event, then check whether the client marks the answer incomplete, restarts it or resumes from an application event ID. That makes the reliability tradeoff explicit without treating every dropped packet as permanently lost generated text.

[Nagappan S](https://hashnode.com/@imkarthik03)

[Oct 13](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac39a2f6dbf382c5678bc73#reply-6acdd2d3e5d5c9e441728b07)

Fair correction. TCP already recovers ordinary packet loss, so the real failure is the connection dropping mid-response. The reconnect test you describe is the right one: cut after a complete SSE event, then check whether the client marks the answer incomplete, restarts, or resumes from an event ID. I'd make resume-by-event-ID the target, since it avoids both a visible glitch and regenerating the whole answer.

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Oct 15](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac39a2f6dbf382c5678bc73#reply-6ad13cf41ea769204fa560e8)

Resume-by-event-ID works when the server can replay the same generation, including events produced while the client was disconnected. An event ID alone cannot resume text that was never retained, and starting a fresh generation can diverge from the prefix already displayed.

I would make replay retention and expiry explicit. The reconnect test can first replay a saved suffix without duplicating the last displayed event, then repeat after retention expires and require an incomplete-or-restart outcome rather than silently splicing two different answers together.

[Alrebro](https://hashnode.com/@alrebro)

[Oct 5](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac351f380c519aa00488282)

Great explainer — the distinction between the model being sequential and the transport being chunked is one most people conflate. The part about partial markdown rendering resonated: tracking which structures are still open instead of naively re-parsing after every chunk is exactly the kind of detail that separates polished chat UIs from broken ones. One related wrinkle worth mentioning: token healing at stream boundaries. When a chunk boundary splits a multi-byte character or a token mid-word, naive concatenation can produce subtly wrong text even after all bytes arrive. Same class of problem as your UTF-8 example, just one layer up. Really enjoyed the Eloquent mention too — nice to see research on resumable streams getting attention.

[Nagappan S](https://hashnode.com/@imkarthik03)

[Oct 5](https://hashnode.com/posts/why-ai-replies-stream-word-by-word/6ac34ccf409651402523c315/comment/6ac351f380c519aa00488282#reply-6ac35c71b99a694287ac20f9)

Good addition. One nuance: token healing usually refers to fixing awkward token splits at the prompt/completion boundary, not stream chunking. For streaming, if you buffer raw bytes and only decode complete UTF-8 sequences, the final text matches the non-streamed output exactly.

The nearby problem that does bite is incremental detokenization. With some tokenizers, decoding token by token can differ from decoding the full ID sequence (leading-space handling, byte-fallback tokens), so UIs should decode over the accumulated IDs and emit only the stable prefix. Have you run into that one in practice?
