What is AI latency?
Latency is the time between sending a request and the answer reaching the user; for language models, time to first token and total response time are measured separately.
It differs from throughput in perspective: latency measures how fast one request is answered, while throughput measures how much work the system does per unit of time. Latency does not come only from model compute; queueing, network and data processing add to it.
- Topic
- Inference and performance
- Also known as
- Response time
How AI latency works
- The request reaches the server over the network and waits in a queue; that wait is part of latency.
- Prefill processes the whole prompt in parallel; a long prompt lengthens time to first token.
- In decoding, tokens are produced one by one; total time is roughly time to first token plus tokens times inter-token latency. Decoding a 500-token answer at 25 ms per token takes 12.5 seconds (500 × 0.025).
- Model size, context length, concurrent requests and GPU memory bandwidth are the main drivers.
In more detail
Compute-bound prefill versus memory-bound decode
In LLM serving, the prefill phase is compute-bound (saturated by matrix multiplications across all prompt tokens in parallel), whereas the decode phase is memory-bandwidth-bound because each generated token has to read the entire model weights and KV cache from GPU HBM. This hardware bottleneck asymmetry explains why high-bandwidth memory (HBM3/HBM3e) determines decoding speed while FLOPS govern TTFT on long contexts.
Current latency reduction techniques
Modern inference engines such as vLLM and SGLang reduce latency through continuous batching, prefix caching (reusing KV cache for shared system prompts or RAG templates), speculative decoding (verifying multiple draft tokens in parallel) and disaggregated prefill/decode serving so that a heavy prompt does not stall inter-token latency for active streams.
End-to-end latency budgets in RAG and agent systems
A single prompt's latency is only one piece of user-perceived delay in agentic and RAG systems. End-to-end latency equals the sum of query embedding, vector/hybrid retrieval, reranking, guardrail checks, LLM TTFT, generation and any multi-step tool calls. Engineering teams track each hop separately to identify the true bottleneck.
Commonly confused terms
| Term | How it differs |
|---|---|
| Time to first token versus inter-token latency | TTFT measures how long the user waits before the very first generated token appears (driven by queueing and prompt prefill), whereas ITL (or TPOT) measures the average interval between consecutive output tokens during decoding. |
| SLA and SLO | Latency is an observed runtime metric, whereas an SLA/SLO is a contractual or operational threshold (e.g., p95 E2E latency < 3 s) that the infrastructure commits to meeting. |
Why AI latency matters for on-premises AI
User experience and service level targets are defined by latency; in-house capacity is planned on percentiles, such as the time within which 95 per cent of requests finish, not on averages. As concurrency grows, batching raises throughput but can increase per-request latency; this trade-off is weighed against the organisation's accepted ceiling. Streaming does not shorten total time but shows the answer sooner.
A bank monitors latency on its customer service assistant continuously; when the 95th percentile response time passes a set threshold, traffic is routed to a second inference server.
Common questions
Are latency and throughput the same measure?
No. Latency measures how quickly one request is answered; throughput measures how many requests or tokens the system handles per unit of time. Both are assessed together.
What raises latency most in a language model?
Long prompts raise time to first token and long answers raise total time. Large models, heavy concurrent load and queueing add to it too.
Related terms
- Time to first token (TTFT)
- Inter-token latency
- AI end-to-end latency
- AI throughput
- Tokens per second (TPS)
- AI prefill
- AI streaming response
- Speculative decoding
Sources
- Efficiently Scaling Transformer Inference, 2022
- Efficient Memory Management for Large Language Model Serving with PagedAttention, SOSP 2023
Related page on this site: Related FAQ · In the glossary: Glossary, E to L