YBX.

Research · · 简体中文

LLM streaming latency: calculate TTFT, token gaps and end-to-end time

In a four-token trace, 400 ms to first token and 100 ms per subsequent token produce a 700 ms response. Streaming chunks can change the visible gaps even if the first and last timestamps stay fixed.

Reconstruct one request

Take a synthetic request sent at 0 ms with four one-token outputs at 400, 500, 600 and 700 ms. TTFT is 400 ms. The three gaps are each 100 ms. End-to-end time through the last token is 700 ms. Per-request time per output token after the first (TPOT) is (700 − 400)/(4 − 1) = 100 ms.

What a bundled chunk changes

Now stream one token at 400 ms and a chunk of three at 700 ms. The client observes one inter-output gap of 300 ms. The per-request TPOT remains 100 ms because the total token count is four. The client trace cannot reveal when each token inside the second chunk became ready.

Read the dashboard with its measurement boundary

vLLM distinguishes elapsed time between streamed outputs from per-request TPOT. For a one-token response there are no post-first-token intervals; vLLM’s server metric records zero for that case while its serving benchmark excludes it from TPOT statistics. Record the instrument, output lengths and whether you timed the client or the server before comparing averages.

Sources

Related reading