Read page 1 as text
Why does an LLM make me wait?
The question is ready. Why is the answer still arriving piece by piece?
WHAT WE WILL FIGURE OUT
01
What happens before the first token?
02
Why does the answer grow in order?
03
Which speed should we measure?
OUR EXAMPLE
Where did the cat sit? The cat sat on the mat.
Follow the steps. Ask the obvious questions. Check the result.
Part 3 of 18 · Challenge: page 5 · Suggested answers: page 6
Read page 2 as text
What happens before the first token?
1
THE EMPTY SCREEN
BEFORE ANY OUTPUT APPEARS
Queue
Prompt work
First token
queue
→
prefill
→
first token
Is the model doing nothing?
A request may wait in a queue, prepare its input, reuse cached state and process the prompt before the first output appears.
Arrival → queue → prompt work → first token
2
KNOWN INPUT
ALL SIX TOKENS ARE ALREADY KNOWN
Where
·did
·the
·cat
·sit
?
PREFILL: prompt positions together
First answer token selected: The
all prompt tokens
→
prefill
The prompt tokens already exist. Standard causal Transformer prefill can process their positions together, subject to hardware limits.
Where did the cat sit? is already known
3
ORDER IS STILL THERE
CAUSAL VISIBILITY
future masked
Rows = positions; teal = visible
known positions
causal mask
Together means scrambled?
No. Position information and causal attention preserve order. Each position can use itself and permitted earlier positions.
Parallel processing does not remove order
4
FIRST PREDICTION
Prompt
Scores
Select The
Prefill supplies the first prediction
prefill
→
select The
Prefill produces the state and prediction used to select the first answer token. Sampling is the selection step.
Toy first selected token: The
Read page 3 as text
Why does the answer grow in order?
5
UNKNOWN OUTPUT
Question + every token selected so far
›
Predict the next token
The → The cat → The cat sat
all selected tokens
→
next prediction
Can it write the whole answer together?
In ordinary autoregressive generation, the next prediction depends on every token selected so far.
The → The cat → The cat sat
6
DECODE STEP ONE
Earlier context: saved keys and values
NEW: The ID 464
›
SELECT: ·cat ID 3797
The user does not resend the question
The + cached KV
→
·cat
After selecting The, process that new token and reuse earlier KV state to predict the following token. The dot marks a leading space.
Fresh input The; next selection: ·cat
7
DECODE STEP TWO
Earlier context: saved keys and values
NEW: ·cat ID 3797
›
SELECT: ·sat ID 3332
The user does not resend the question
·cat + cached KV
→
·sat
The new answer is now The cat. Processing the newly selected cat token supports the next prediction.
Fresh input ·cat; next selection: ·sat
8
THE USER SUBMITS ONCE
ONE USER REQUEST
Engine loop
Next token
Continue
one request
→
serving loop
The serving loop performs the repeated steps. You do not need to submit your question for every answer token.
One user request, many dependent steps
Read page 4 as text
Which speed should we measure?
9
TIME TO FIRST TOKEN
Arrival
First token
TTFT includes the initial wait
arrival
→
first token
TTFT measures the wait until the first token. Queueing, prompt length, cache hits and system load can all affect it.
A fast stream can still start late
10
GAP BETWEEN TOKENS
token
50 ms
token
1 ÷ 0.050 s = 20 tokens/s
token
→
50 ms
→
next token
Inter-token latency measures the gaps after generation begins. It describes the pace of the stream.
50 milliseconds per token = 20 tokens/second
11
TOTAL OUTPUT
200 output tokens
÷ 20 tokens/s
≈ 10 seconds
200 / 20
→
about 10 s
A longer answer usually needs more generation steps. Streaming shows progress earlier; it does not erase the work.
200 tokens at 20 tokens/second = about 10 seconds
12
MEASURE BOTH
Start delay TTFT
Stream pace token gaps
Whole request total time
Always record workload + settings
TTFT
token gaps
total time
Fast to start, slow to finish?
Track TTFT, inter-token latency and end-to-end duration. Special decoding methods can change the ordinary loop.
Example timings are arithmetic, not a benchmark
Read page 5 as text
Your turn. Can you explain what happens?
Use the same example. Change one detail. What follows?
KEEP THIS EXAMPLE IN MIND
Where did the cat sit? The cat sat on the mat.
Try first. Suggested answers are on the next page.
1
Does a fast time to first token guarantee a fast full answer?
What makes you say that?
2
Why can known prompt positions be processed together?
What makes you say that?
3
At 25 tokens/second, about how long is a 100-token answer after generation starts?
What makes you say that?
Write your answers in the comments.
Read page 6 as text
Suggested answers
Why does an LLM make me wait?
01
Does a fast time to first token guarantee a fast full answer?
No. The stream can begin quickly and then generate slowly.
02
Why can known prompt positions be processed together?
The tokens already exist; positions and causal masking preserve the permitted dependencies.
03
At 25 tokens/second, about how long is a 100-token answer after generation starts?
About four seconds, excluding the initial wait and other overhead.