LLMscore
Latency: TTFT and tokens/s
Time to first token is what users feel; output tokens per second is how long the rest takes.
What it is and why it exists
An LLM response has two phases: prefill (read the whole prompt, then emit the first token) and decode (one token at a time). TTFT grows with prompt length and queueing; total time ≈ TTFT + output tokens ÷ tokens per second. Streaming hides most of the decode time from users.
Quick prototype
Measure wall-clock time of the whole call.
In production, at scale
Track TTFT, inter-token latency and total time as p50/p95 per model and route, cap output length, stream everything user-facing, and cut prompt size (or cache the prefix) to cut TTFT.
Vendors and tools
| Artificial Analysis | Independent TTFT and throughput comparisons across providers |
|---|---|
| Langfuse / LangSmith / Braintrust | Per-span latency on traced calls |
On AWS: CloudWatch for Bedrock exposes InvocationLatency and time-to-first-token style metrics per model.
How it fails
- Optimising average latency while p95 users wait 10 s
- Reasoning models spending seconds thinking before the first visible token
- Long output caps that let one request hog a slot
What the interviewer asks next
A user says the bot is slow. What do you measure first?
Split TTFT from decode time. High TTFT points at prompt size, queueing or retrieval before the call; slow decode points at output length or model choice.
How do you hit an 800 ms budget?
Small model, short prompt with a cached prefix, streaming, parallel retrieval, and no extra sequential LLM calls on the hot path.