# 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.

AI and LLM interview question Q316, Inference, performance and cost. Intermediate, very common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/ttft-vs-tokens-per-second-vs-latency

## Say it in 30 seconds

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.

## Say it in 2 minutes

Speed in an AI app has three parts, and each answers a different question. TTFT, which stands for time to first token, is how long the user waits before any text appears. Tokens per second is how fast the text keeps arriving once it starts. Total latency is how long until the whole answer is finished. Total latency is roughly the wait plus the time the rest takes.

Which one matters depends on the product. In a streamed chat, the user watches the words arrive, so TTFT and tokens per second shape how it feels. In an agent step that returns a result for code to read, nobody sees the words, so total latency is the number that counts. Long answers push total time up even when the service is healthy, so I check output token counts before I blame the service.

To measure, I log three timestamps for each request: when it was sent, when the first token came back, and when the last one arrived. I report the median and the 95th percentile on real traffic, because averages hide the slow requests that users complain about. I also note which clock I am on. A model's TTFT can look healthy while the screen stays blank, because retrieval, tool calls and rendering happen outside the model call.

## 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.

- **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.

*Diagram, One request, four stops: 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.*
1. The wait until the first token is TTFT.
2. The tokens start to stream, at the tokens-per-second pace.
3. The stream ends at the last token, which is 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.

*Diagram, What moves which number: 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.*
1. A long prompt can delay the first token.
2. Each extra token adds time before the last one arrives.

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. **Stamp the request:** Save the time your app sends the request.
2. **Stamp the first token:** Save the time the first piece of visible text arrives.
3. **Stamp the last token:** Save the time the final piece arrives, and count the tokens received.
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. **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:

```text
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. **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. **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. **Stream the reply:** The adjuster sees the first words early, so the screen feels responsive even when the full summary takes longer.
4. **Cut the round trips:** Combine sequential model calls where one request has what it needs. Each extra call adds another wait.
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." Better: It 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." Better: Total 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." Better: Averages 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?

A. Total latency up from 6 s to 11 s, and average reply length up from 180 to 420 tokens.
B. Median TTFT steady at 0.7 s, with the same prompt sizes as last month.
C. 95th percentile TTFT up from 1.1 s to 9.5 s, with prompt and reply sizes unchanged from last week.
D. Total latency up from 6 s to 7 s, and average reply length up from 180 to 260 tokens.

**Answer:** C. The prompt and reply sizes did not change, but the wait for the first token grew from 1.1 s to 9.5 s. Azure's guide says that if Time to Response rises while prompt size stays flat, you check deployment utilization and concurrent request volume. The first and last options both show longer replies, so they do not point at the service.

**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?

A. Total latency for the whole reply
B. TTFT, the wait until the first token
C. Tokens per second across all users
D. The tokens-per-minute rate limit

**Answer:** B. Users watching a stream feel the first wait, so TTFT matches the complaint. Total time, average speed across users and rate limits each measure something else.

## Can you answer these from memory?

**Flash cards**

- **What is TTFT?** The wait from sending the request to the first token back. The pause the user feels.
- **What are tokens per second?** How fast the tokens keep arriving after the first one, for one reply.
- **What is total latency?** The time until the last token. It is the wait plus the time the rest takes.
- **Which number for streamed chat?** TTFT and tokens per second, because users watch the text arrive.
- **Why report the 95th percentile?** It shows the slow tail real users hit. An average can look fine while some wait far longer.
- **Total latency rose. What first?** Check output token counts. Longer answers often explain the rise.

## Likely follow-up questions

- Q315 Why stream tokens? https://designervenkat.online/interview/ai/why-stream-tokens
- Q317 The latency vs throughput trade-off? (full answer coming)
- Q318 How do you diagnose a slow LLM pipeline? https://designervenkat.online/interview/ai/how-to-diagnose-a-slow-llm-pipeline
- Q314 Static vs continuous batching? https://designervenkat.online/interview/ai/static-vs-continuous-batching
- Q325 What is semantic caching? (full answer coming)

## Learn it in depth

- [Watching cost and speed](https://designervenkat.online/learn/ai-engineering/cost-latency-monitoring)
