Guide

Latency and throughput

"Is it fast?" has several answers. A user cares about their own wait; the server cares about how much it makes for everyone.

Time to first token

Time to first token (TTFT) runs from sending the request to the first token arriving. It is mostly time in the queue, waiting for the server to start, plus prefill, which reads the whole prompt. Long prompts and busy servers both raise it.

Time between tokens

Once text starts, it streams. The gap between two tokens is inter-token latency (ITL). Its average over one answer is time per output token (TPOT). Decode speed sets both. A token every 20 ms is 50 tokens a second, faster than people read.

End-to-end latency

End-to-end latency runs from sending the request to the last token. It is about TTFT + (output tokens × TPOT). With a TTFT of 1 s and 100 tokens at 20 ms each, that's 1 + 2 = 3 seconds. For long answers, TPOT matters most, because you pay it once per token.

Throughput

Throughput is the server's view: total tokens per second, across every user at once. If 20 users each get 50 tokens a second, throughput is 1,000 tokens a second. Latency is one user's view; throughput is everyone's.

Batch size trade-off

A GPU can run many users' decode steps together, as one batch. A bigger batch makes more tokens per second in total. But each step does more work, so each user's tokens come a bit slower. For example, 1 user might get 60 tokens a second alone, and 32 users 30 each: throughput goes from 60 to 960. Live chat wants smaller batches for speed; nightly jobs can use big batches to make more for the same cost.

Remember

  • TTFT: queue plus prefill.
  • TPOT: the gap between tokens, set by decode.
  • End-to-end ≈ TTFT + tokens × TPOT.
  • Throughput is tokens per second for everyone.
  • Bigger batches: more throughput, slower for each user.