Module 7 · Lesson 4 of 4

Why the first token is slow

A slow start, then a stream

The first token waits for the queue and for the whole prompt to be read; every token after it comes at a steady pace.

Scene 1 of 4 · Wait in the queue

The request waits 0.8 s in a busy queue before the GPU can start on it.

One request, from sending to answer

Request

  1. Request sent at 0 s, sent
  2. Prompt read starts at 0.8 s, reading starts

Answer

    Time to first token
    not shown yet
    Tokens a second after that
    not shown yet
    1. Wait in the queue. The request waits 0.8 s in a busy queue before the GPU can start on it.
    2. Read the prompt. Prefill then reads the 3,000-token prompt in one pass, which takes about 0.12 s.
    3. The first token. One 49 ms step later, the first token arrives at 0.97 s: the time to first token.
    4. Then a steady stream. After that, a token arrives every 49 ms, using the saved work, so token 21 lands at 1.95 s.
    5. Now you try. Change how long the request waits in the queue. For example: First token at 1.77 s; token 21 at 2.75 s, about 20 tokens a second either way. The queue only delays the start; once writing begins, tokens arrive at the same steady pace.

    Scene 1 of 4: Wait in the queue. The request waits 0.8 s in a busy queue before the GPU can start on it.

    Key points

    1. The first token waits for the queue, then for prefill.
    2. This wait is the time to first token.
    3. Later tokens each wait for one short step only.
    4. A busy queue delays the start, not the pace after it.

    The first of an answer is often the slowest. It waits in the behind other requests, then waits for , the pass that reads the whole before any token is written.

    Every later token is much faster. Each one only waits for a single step, since the prompt was already read and its saved work is already in the .

    Two numbers describe this. is the wait for the first piece of the answer. Tokens per second is the speed of every token after that.

    Example. Illustrative: when the queue is busy, a long prompt's first token can take about a second, for queueing plus prefill together. After that, tokens can arrive at roughly 20 a second.

    In system design: Time to first token and tokens per second are the two numbers users feel. One is the first wait; the other is how fast the rest streams in.

    Check yourself

    Users wait 2 s for the first word, then the text streams in fast. What is most likely slow?