esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

TTFT vs Tokens per Second vs Latency

What TTFT, tokens per second and total latency each measure, how they add up, and how to measure them in production, for your AI interview.

In short

Time to first token (TTFT) is the wait until the first token arrives. Tokens per second is how fast the rest streams in, and total latency is the time until the last token.

12 min readIntermediateVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Three numbers measure speed. TTFT, time to first token, is the wait before the first word appears. Tokens per second is how fast the rest of the reply keeps coming. Total latency is the time until the last token. For a streamed chat, the first wait and the pace matter most. For a long report, total time grows with the length of the answer, so I track all three and report the 95th percentile, the wait that 95 in 100 requests beat, along with the average.

What are TTFT, tokens per second and total latency, in plain words?

An AI model writes its answer one token at a time. A token is a small piece of text, often a word or part of one. When you call a model, you can time three things: how long until the first token shows up, how fast the rest arrive, and how long until the answer is finished.

Think of a claims adjuster reading a long decision letter to a customer over the phone. TTFT is the pause before she starts reading. Tokens per second is her reading pace. Total latency is the time until she reads the last line. The pause is the first thing the customer notices, so it is often the first thing to fix.

The same picture fits a real system. An insurer's claims triage agent reads a new claim and writes a summary of about 300 tokens for the adjuster. The adjuster's screen waits for that summary, so the three numbers decide whether the screen feels fast.

Key words

Token
A small piece of text the model reads and writes, often a word or part of one.
TTFT
Time to first token: the wait from sending the request to the first token back.
Tokens per second
How fast the tokens keep arriving once the first one has come back.
Total latency
The time from sending the request to the last token arriving.
Streaming
Sending the reply as it is written, so the first words reach the user early.

How do the three numbers add up?

TTFT starts when your app sends the request and stops when the first token comes back. OpenAI defines it in one line, and Microsoft Azure and Amazon Web Services (AWS) use the same idea.

  • “Time to first token (TTFT) measures how long an API request takes to start returning content.”

    OpenAI

  • “TTLT = TTFT + (TBT × Tokens Generated)”

    Microsoft Azure

  • “The time from when a request is sent to when the last token is received.”

    Amazon Bedrock

Total latency runs until the last token. Azure writes it as a sum: the first wait, plus the average gap between tokens times the number of tokens generated. In plain words, total time is the wait plus the time the rest takes.

One request, four stops

Request sent

Your app sends the prompt

First token

The wait: TTFT

Tokens arrive

The pace: tokens per second

Last token

Total latency stops here

  1. 1The wait until the first token is TTFT.
  2. 2The tokens start to stream, at the tokens-per-second pace.
  3. 3The stream ends at the last token, which is total latency.
Your app sends a prompt, waits for the first token, then the tokens stream in until the last one. The first wait is TTFT, the stream's pace is tokens per second, and the last token ends total latency.

Here is a worked example with made-up numbers. The claims agent gets its first token after 0.6 seconds. The 300 tokens after it arrive at 40 tokens per second, which takes 7.5 seconds. The last token lands at 8.1 seconds. Azure's formula gives nearly the same answer. It multiplies the 25 ms gap by all 301 tokens, which comes to about 8.1 seconds.

  • Streamed chat

    Watch TTFT and speed

    The user watches words arrive, so the first wait and the pace shape how the chat feels.

  • Agent step

    Watch total latency

    A step that returns a result for code to read is done only when the last token lands.

Why did total time rise, and is the service at fault?

Two causes move two numbers. A longer prompt delays the first word, because the model reads the input before it writes. OpenAI notes that a long prompt can delay the first token. Azure adds that prompt size affects the overall time when it grows large. A longer reply adds to the total, because each extra token takes more time.

What moves which number

Longer prompt

More text read before writing

Longer reply

More tokens written out

TTFT rises

The first word comes later

Total latency rises

The last word comes later

  1. 1A long prompt can delay the first token.
  2. 2Each extra token adds time before the last one arrives.
A longer prompt pushes the first word later. A longer reply pushes the last word later. Neither one proves the service slowed down, so check which cause moved first.

Azure says a rise in total time is often fully explained by more output tokens. AWS draws the same line: latency can rise because the service slowed, or because the model wrote more. So before you blame the service, check the token counts.

Do not mix this up with tokens per minute. A tokens-per-minute rate limit measures how much traffic you can send across requests, so it is a different number from how fast one answer streams.

Tip

Name the clock you are on. TTFT stops when the first token reaches your app. OpenAI's end-to-end latency runs until the user gets the complete result. If TTFT looks good but the screen stays blank, time the work before the model call and check when the client shows the first text.

How do you measure them in production?

  1. 1

    Stamp the request

    Save the time your app sends the request.

  2. 2

    Stamp the first token

    Save the time the first piece of visible text arrives.

  3. 3

    Stamp the last token

    Save the time the final piece arrives, and count the tokens received.

  4. 4

    Work out the three numbers

    TTFT is the first stamp minus the request time. Tokens per second is the tokens after the first, divided by the time from first to last.

  5. 5

    Report the spread

    Take the median (the middle value) and the 95th percentile over real traffic, split by model and task.

Here it is in Python, using the made-up stream from the example. It uses only the standard library, so you can run it anywhere.

Python
# A made-up stream from a claims triage agent: one token every 25 ms after a 0.6 s wait.
# Each event is (seconds since the request was sent, tokens that arrived in that event).
events = [(round(0.60 + 0.025 * i, 3), 1) for i in range(301)]
ttft = events[0][0]
total = events[-1][0]
after_first = sum(n for _, n in events[1:])
speed = after_first / (total - ttft)
print("TTFT (first token):", ttft, "s")
print("Tokens per second:", round(speed, 1))
print("Total latency (last token):", total, "s")

Output

TTFT (first token): 0.6 s
Tokens per second: 40.0
Total latency (last token): 8.1 s

The 95th percentile is the time that 95 in every 100 requests come in under. The slowest 5 in 100 sit above it. That tail is what users remember, which is why an average can look fine while people still complain. OpenAI suggests comparing the median and the 95th percentile on representative traffic.

How would you cut the wait for a claims triage agent?

Start with the number the user feels. If the complaint is the wait for the first word, shorten the input, and check whether reasoning or tool calls run before the answer, because that work also delays the first word. If the complaint is the total, shorten the output. Most fixes do one of these two things.

  1. 1

    Trim the input

    Send the claim fields and the policy clause that matter, not the whole file. Use fewer input tokens, because a long prompt can delay the first word.

  2. 2

    Ask for a shorter output

    A fixed summary with five fields, not an essay. Generate fewer tokens, and the total time falls with them.

  3. 3

    Stream the reply

    The adjuster sees the first words early, so the screen feels responsive even when the full summary takes longer.

  4. 4

    Cut the round trips

    Combine sequential model calls where one request has what it needs. Each extra call adds another wait.

  5. 5

    Measure before and after

    Compare the 95th percentile on the same kind of claims, so a faster number is a real gain.

Tip

The trade-off to say out loud: a shorter summary or a cheaper setup can cut the wait, but the adjuster may lose detail they need. Test the summaries on real claims before you cut anything.

What does the interviewer want to hear?

A strong answer covers

  • The three terms, each in one plain sentence: TTFT, tokens per second, total latency.
  • Which one matters depends on streaming: a user watching the words, or code waiting for the last token.
  • Total time grows with output length, so check token counts before you blame the service.
  • Report the median and the 95th percentile from real traffic, which one test call cannot show.
  • Say which clock you use: the model call, or the whole path to the screen.
  • Tokens per second for one reply is a different number from a rate limit across requests.

Common traps

  • Trap"Tokens per second is how fast the model thinks."

    BetterIt is how fast the text streams out after the first token. Measure it from the first token to the last.

  • Trap"Total latency is the same as TTFT."

    BetterTotal latency includes the whole reply. A long answer makes it far larger than the wait for the first word.

  • Trap"The average latency is fine, so we can ship."

    BetterAverages hide the slow tail. Report the 95th percentile from real traffic before you call it fine.

Can you spot the real slowdown?

Spot the real slowdown

Which weekly report line points to a real service slowdown, not longer answers?

Quick check

A claims team's chat widget streams each reply, and users say the first word takes too long to appear. Which number do you look at first?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q315Why stream tokens?12 min
  2. Q317The latency vs throughput trade-off?Coming soon
  3. Q318How do you diagnose a slow LLM pipeline?13 min
  4. Q314Static vs continuous batching?12 min
  5. Q325What is semantic caching?Coming soon

Learn it in depth

Last updated on 26 November 2026

Building a chat or agent that people wait on?

I design and build AI products and agents, including the screen and the system behind them. Book a short call and tell me where the wait hurts.