All glossary terms

Serving

Token streaming

Partial output is sent to the client token by token as the model writes it, so the user starts reading seconds before the full reply exists.

A model writes a reply one token at a time, but an interface can either wait until the reply is complete or forward each token the moment it exists. Streaming takes the second path: the server pushes partial output over a socket or a long-lived connection, and the client renders the words as they land.

Streaming changes nothing about what the model computes, so the total time and total cost are identical. What it changes is when the waiting happens: the long silent wait is replaced by a shorter wait for the first token followed by live output the user is already reading. Interfaces that buffer the whole reply, whether in the proxy, the client library, or the product code, quietly give up all of that, which makes them feel several times slower than they are.

The engineering notes: streaming should be measured at the client edge, because proxies add buffering of their own; the two metrics to pair are time to first token (when reading can start) and inter-token latency (how steady the typing looks). And some workloads - code execution, structured outputs - may prefer collecting the whole reply first, which is a product decision to make on purpose rather than by default.

A worked example

A 500-token reply from a model decoding at 24 tokens per second, with a first token arriving 0.5 s after the request.

  1. Full reply finish time: 0.5 s + 500 / 24 = 21.3 s after the request.
  2. Buffered: everything arrives at 21.3 s, and the user has read nothing until then.
  3. Streamed: the first words land at about 0.5 s, and reading at 5 words per second keeps pace with the tokens arriving.
  4. Same compute, same cost, but the wait before the user starts drops from 21 s to under 1 s.

Streaming does not make the model faster; it moves the wait to before the first token, where users can start reading.

Where this shows up

Test yourself

Related terms