Latency is the total time delay between submitting an inference request to a system and receiving the complete response, measured in milliseconds (ms) or seconds. In autoregressive models like large language models, this is often decomposed into Time to First Token (TTFT), covering prompt processing, and Time Per Output Token (TPOT), covering incremental generation. It is a critical user-facing metric directly impacting application responsiveness and experience.
Glossary
Latency

What is Latency?
In machine learning inference, latency is the fundamental performance metric quantifying the delay between a request and its response.
For performance benchmarking, latency is analyzed as a distribution, not a single value. Key metrics include percentile latency (P50, P90, P99) and tail latency, which captures the slowest requests. Latency is inversely related to throughput; as request load increases, latency typically rises due to resource contention and queueing, a relationship visualized on a throughput-latency curve. Optimizations like continuous batching, KV cache management, and model quantization directly target latency reduction.
Key Latency Metrics in AI Inference
Latency is the primary measure of responsiveness in AI systems. These metrics break down the total delay into specific, actionable components for engineers to optimize.
Time to First Token (TTFT)
Time to First Token measures the duration from request submission until the first output token is generated by an autoregressive model. This initial delay encompasses the entire prefill stage, including:
- Prompt encoding and processing
- Loading the model's KV cache
- Executing the initial forward pass through all layers
TTFT is highly sensitive to prompt length and model size. For long-context models, this can be the dominant component of total latency.
Time per Output Token (TPOT)
Time per Output Token is the average latency to generate each subsequent token after the first. This metric represents the incremental cost of the decoding stage in autoregressive generation. Key factors influencing TPOT include:
- Model architecture and size
- Efficiency of the KV cache lookup
- Hardware memory bandwidth (often the bottleneck)
Optimizations like speculative decoding target TPOT directly, using smaller draft models to propose multiple tokens for verification in a single pass of the large model.
Tail Latency (P90/P95/P99)
Tail latency refers to the high-percentile latencies (e.g., P95, P99) in a request distribution. While average latency is useful, tail latency determines user-perceived performance. The slowest 1% of requests (P99) often dictates Service Level Objectives (SLOs).
Causes of high tail latency include:
- Resource contention from concurrent requests
- Garbage collection pauses or other system noise
- Cold starts for infrequently used models
- Variable input/output lengths causing uneven processing times
End-to-End Latency
End-to-End Latency is the total elapsed time from the client's perspective, encompassing all system components beyond just model execution. This holistic metric includes:
- Network transmission (client to server and back)
- Request queuing and scheduling time
- Pre/post-processing (tokenization, detokenization, formatting)
- Model inference time (TTFT + TPOT * output length)
For real-time applications like chatbots, end-to-end latency must typically be under 200-300 milliseconds to feel instantaneous.
Inter-Token Latency
Inter-Token Latency measures the time gap between consecutive tokens as they are streamed to a client. In streaming response scenarios, consistent inter-token latency is critical for user experience. High variance can make output feel "jerky."
This metric is influenced by:
- The underlying TPOT of the model
- Network buffering and transmission protocols
- Server-side batching strategies, where a single batch processes tokens for multiple requests, potentially delaying individual token delivery
Cold Start vs. Steady-State
Latency is measured in two distinct operational phases:
Cold Start Latency: The significant delay on the first request to a newly initialized service or model. This includes:
- Loading model weights from disk into GPU memory
- Just-in-Time (JIT) compilation of kernels (e.g., with PyTorch or TensorRT)
- Warm-up inference passes to stabilize performance
Steady-State Latency: The consistent performance achieved after caches are populated, kernels are compiled, and the system has reached equilibrium. Performance benchmarks and SLOs are typically defined for steady-state operation.
What Factors Affect Inference Latency?
Inference latency is determined by the complex interplay of computational, memory, and system-level bottlenecks during model execution.
Inference latency is the total time to process a request and is primarily governed by compute intensity, memory bandwidth, and system overhead. A workload is compute-bound when limited by processor FLOPs, common in dense matrix operations. Conversely, it is memory-bound when constrained by data movement, typical in attention mechanisms accessing the KV cache. System factors like cold starts, resource contention from concurrent requests, and network I/O introduce additional delays before steady-state performance is achieved.
The model architecture dictates fundamental latency characteristics. Autoregressive models exhibit distinct Time to First Token (TTFT) for prompt processing and Time per Output Token (TPOT) for generation. Optimization techniques directly target these phases: quantization reduces compute per operation, continuous batching improves GPU utilization, and speculative decoding reduces sequential steps. Ultimately, latency is a function of the slowest component in the pipeline, identified through bottleneck analysis and performance profiling against established performance baselines.
Latency vs. Throughput: The Fundamental Trade-off
A comparison of the two primary performance metrics in inference systems, illustrating their inverse relationship and the engineering trade-offs required to optimize for one versus the other.
| Performance Dimension | Latency-Optimized System | Throughput-Optimized System | Balanced System |
|---|---|---|---|
Primary Goal | Minimize response time for individual requests | Maximize total requests processed per unit time | Maintain acceptable latency while maximizing throughput |
Key Metric | P99 Latency (e.g., < 200ms) | Tokens Per Second (TPS) or Queries Per Second (QPS) | Throughput at a defined latency SLO (e.g., QPS @ P99<500ms) |
Typical Architecture | Low-batch or batch size of 1, dedicated resources per request | Large, static batching, aggressive request queueing | Dynamic/continuous batching with adaptive queue limits |
Resource Utilization | Often lower, as resources may be idle between requests | Very high, maximizing GPU/CPU usage at all times | High, but managed to prevent tail latency spikes |
Scheduling Priority | First-in, first-out (FIFO) or priority queues for fairness | Maximum batch size formation, potentially starving small requests | Hybrid: prioritizes batch efficiency while respecting latency bounds |
User Experience Impact | Predictable, fast response for interactive applications (e.g., chat) | High capacity for batch processing (e.g., document summarization) | Good for mixed workloads with both interactive and batch tasks |
Cost Efficiency | Lower (higher cost per request) due to potential resource under-utilization | Higher (lower cost per request) due to maximal resource amortization | Moderate, optimized for total cost of ownership at target performance |
Failure Mode Under Load | Latency increases linearly, then requests fail or timeout to protect SLO | Throughput plateaus, latency increases exponentially due to queueing | Graceful degradation: throughput stabilizes as latency approaches SLO limit |
Frequently Asked Questions
Latency is the primary metric for user-perceived responsiveness in AI inference systems. These questions address its measurement, optimization, and impact on production deployments.
Latency is the total time delay between submitting a request to an inference system and receiving the complete response, measured end-to-end in milliseconds. In machine learning, it encompasses the time for data pre-processing, model execution (forward pass), and result post-processing. For autoregressive models like LLMs, latency is often broken into Time to First Token (TTFT) and Time per Output Token (TPOT). It is the critical metric for interactive applications, directly impacting user experience, with lower latency correlating to higher perceived system quality and responsiveness.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Latency is a core metric for inference performance, but it must be analyzed alongside other key measurements to fully understand system behavior and user experience.
Throughput
Throughput measures the rate at which a system processes work, typically expressed in Queries Per Second (QPS) or Tokens Per Second (TPS). It represents the system's overall capacity, while latency measures the experience of a single request.
- Key Relationship: Systems often face a trade-off between latency and throughput. Increasing load to maximize throughput typically increases average latency due to queuing.
- Example: A GPU server might achieve 1000 TPS but have a P99 latency of 500ms under that load. Reducing the load to 500 TPS might lower P99 latency to 100ms.
Time to First Token (TTFT)
Time to First Token is a critical latency metric for autoregressive language models (like LLMs). It measures the delay from request submission until the first output token is generated.
- What it Captures: This metric includes the initial processing overhead: prompt encoding, loading the model's KV cache, and executing the first forward pass through the entire model.
- User Impact: TTFT directly affects perceived responsiveness. A high TTFT makes a chat interface feel sluggish, even if subsequent tokens arrive quickly.
- Optimization Target: Techniques like continuous batching and prefetching aim to reduce TTFT.
Time per Output Token (TPOT)
Time per Output Token measures the average latency for generating each subsequent token after the first in an autoregressive sequence. It represents the incremental cost of generation.
- Mechanism: After TTFT, generating the next token primarily involves a much smaller forward pass focused on the new token and updating the KV cache. TPOT is typically much lower than TTFT.
- Determinants: TPOT is influenced by model size, memory bandwidth (for cache access), and the efficiency of the sampling algorithm.
- System Design: For long, streaming responses (e.g., story generation), optimizing TPOT is crucial for a smooth user experience.
Tail Latency (P90/P99)
Tail latency refers to the high-percentile latencies in a request distribution, such as the P90 (90th percentile) or P99 (99th percentile). It measures the experience of the slowest requests.
- Why it Matters: User perception and Service Level Objectives (SLOs) are often defined by tail latency, not averages. A few very slow requests can degrade the overall experience.
- Common Causes: Garbage collection, resource contention, network variability, cold starts, and unpredictable OS scheduling can cause tail latency spikes.
- Mitigation: Techniques include efficient load balancing, request hedging, and over-provisioning resources to handle variance.
Service Level Objective (SLO)
A Service Level Objective is a target for system reliability or performance that is agreed upon with users or stakeholders. For latency, an SLO is typically a percentile-based target.
- Structure: A latency SLO is often defined as "P99 latency shall be less than 200ms for 99.9% of requests over a 30-day window."
- Purpose: SLOs provide a clear, measurable goal for engineering teams, guiding capacity planning, optimization efforts, and release criteria.
- Related Concept: Service Level Indicators (SLIs) are the actual measured metrics (like P99 latency) used to evaluate compliance with the SLO.
Hardware Utilization
Hardware utilization measures how effectively computational resources (GPU, CPU, memory bandwidth) are used during inference. It is a key efficiency metric that indirectly impacts latency and cost.
- Compute-Bound vs. Memory-Bound: A compute-bound workload saturates the processor's FLOPs, while a memory-bound workload is limited by data movement. Inference is often memory-bound due to attention mechanisms.
- The Roofline Model: This analytical model plots attainable performance against operational intensity, showing whether a kernel is limited by compute peak or memory bandwidth.
- Latency Connection: Low utilization can indicate inefficiency but may also allow for lower latency due to lack of contention. High utilization is cost-effective but can increase queuing delay.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us