Model latency vs end-to-end latency
We need to distinguish between these key measurements:
- Model inference latency: The time associated with processing an input and generating a response.
- Time to first token (TTFT): How long the user waits before the first part of the response arrives.
- Token generation speed: How quickly the model generates tokens.
- Time to last token (TTLT): How long it takes until the final response token reaches the user.
- End-to-end latency: How long the complete application takes to deliver the response.
- Workflow latency: How long the complete AI operation takes, including retrieval, model calls, tool execution, and validation.
These measurements answer different questions. A model may start responding quickly but take longer to complete the answer. Equally, a fast model may sit inside a slow application because retrieval or tool execution takes too long.
Where does the time go?
Consider a typical enterprise AI request:
User request → Authentication → Retrieval → Model inference → Tool execution → Response
Not every application uses every step, and some operations can run in parallel. However, each component can affect overall performance.
For a retrieval augmented generation (RAG) application, slow document retrieval or unnecessary context can increase response time.
For an agentic workflow, multiple sequential model calls and tool executions can add significant delay.
This is why measuring the model alone is not enough.
What affects AI latency?
Several factors influence performance:
- Model choice: Different models have different inference characteristics.
- Context length: More input tokens can increase processing time.
- Reasoning: Additional reasoning may improve some results but increase latency.
- Output length: Generating more tokens generally takes longer.
- Infrastructure and workload: Queueing, concurrency, network conditions and serving capacity all matter.
- Architecture: Retrieval, orchestration, external APIs and retries contribute to the total response time.
The important point is that latency does not depend on the model alone.
How should we measure it?
Start by measuring the complete request, then break it down into individual stages.
Track end-to-end latency, time to first token where streaming is used, model request duration, retrieval time, tool execution time and error rates.
Also look beyond averages. The p95 and p99 latency help reveal slower requests that an average can hide.
Establish a baseline using realistic workloads, then test different context sizes, output lengths and concurrency levels.
Latency is only one part of production readiness
Making an AI system faster should not come at the expense of response quality, reliability or security.
A smaller model may reduce latency and cost, but it still needs to meet the required quality level. Caching may improve performance, but it introduces data freshness and access control considerations.
The right choice depends on the business use case and its requirements.
Detailed guidance on measuring end-to-end Performance