

Latency in AI systems is unforgiving in a way that latency in traditional systems is not. When a web page takes an extra second to load, users grumble. When an AI assistant takes an extra second to start responding, users abandon. The threshold of what feels responsive is set by human attention, and the human attention budget is shorter than most engineers initially assume.
I have spent a lot of time over the last few years measuring, modelling, and optimising latency in production AI systems. What I have learned is that AI latency is not a single number to be minimised. It is a profile to be shaped. Time to first token matters more than total completion time for chat interfaces. Tail latency matters more than median latency for retention. Streaming the right amount of content at the right moment matters more than absolute throughput.
In this article, I want to walk through the latency patterns I have shipped to production. I will cover the metrics that actually matter, latency budgets for different use cases, streaming and prompt caching as the foundational tools, semantic caching, speculative decoding, response pre-fetching, edge inference, and the monitoring discipline that lets you defend the experience over time. The goal is to give you a complete picture of how to think about AI latency, with the specifics to act on it.
AI latency is fundamentally different from traditional service latency. A web service responds within tens or hundreds of milliseconds for almost every request. An AI service may take from a few hundred milliseconds to tens of seconds, with high variance, and the user experiences this duration interactively.
Three properties shape the AI latency discipline:
These properties mean that traditional latency thinking, which optimises a single end-to-end metric, leaves significant user experience on the table.
The right mental model for AI latency: shape the response timeline so that the user has a satisfying experience at every moment, not just at the end.
That shaping is what the patterns in this article are about.
The latency metrics that matter for AI systems are not the ones I default to from web infrastructure work. The ones I track:
| Metric | What It Measures | Why It Matters |
| TTFT | Time to first token | User perception of responsiveness |
| TPS or TPOT | Tokens per second after first token | Pace of streaming |
| Total completion time | End to end | Total time the user spent waiting |
| Time to useful content | First semantically meaningful tokens | Practical responsiveness |
| End-to-end transaction time | Full workflow including retrieval and post-processing | Real user experience |
TTFT is the most important metric for interactive AI. A response that starts in 300ms feels instant even if it takes 10 seconds total. A response that starts in 3 seconds feels slow even if it completes in 5.
TPS matters because the user is reading as the response streams. If TPS is too low, the user finishes reading what is on screen and waits. If TPS is too high, it actually does not help, because reading is the bottleneck.
I track these metrics at P50, P95, and P99. The tail matters disproportionately because it is the experience that drives complaints and churn.
Different AI use cases have different latency budgets. The budget I work with for common patterns:
The latency budget should be set before the architecture is designed, not discovered after launch. I have seen too many systems that work technically but feel slow because no one explicitly budgeted the latency.
A useful exercise: instrument an existing system the user finds fast and measure its actual latency profile. That gives you a concrete target rather than an abstract one.
Streaming should be the default for any user-facing AI interface in 2026. Non-streaming responses make the system feel slower than it actually is.
The architectural implications of streaming:
A pattern I have shipped: the streaming pipeline starts at the model provider, runs through a thin gateway that adds observability without buffering, and arrives at the client where the rendering layer paints tokens incrementally.
Streaming also enables UX patterns that improve perceived responsiveness. A typing indicator that animates as tokens arrive. A “thinking” skeleton that displays before the first token. Progressive disclosure of structured content as sections complete.
The model is generating, the user is reading, and the design job is to keep both pleasantly occupied.
Streaming is not optional for serious user-facing AI. Teams that ship non-streaming responses are leaving major perceptual responsiveness on the table.
Prompt caching reduces both cost and latency by reusing pre-computed model state for stable prefixes. In 2026, Anthropic, OpenAI, and Google all offer prompt caching with different cache durations and pricing models.
The latency benefit is significant. A cached prefix can drop TTFT by 30 to 70 percent because the model does not have to re-process the prefix tokens. For systems with long stable contexts, retrieved documents, system instructions, examples, this is transformational.
The architectural pattern I use:
I have shipped systems where the cache hit rate exceeded 90 percent, with corresponding latency improvements on most requests. The discipline is designing for cache reuse from the start, not retrofitting it later.
The trap to avoid is treating caching as a magic switch. Caches expire, and prompts that change frequently never warm up. The architecture has to be designed around the cache semantics of your chosen provider.
When prompt caching reduces the cost and latency of model calls, semantic caching eliminates the model call entirely for repeat queries. A semantic cache that hits returns a response in tens of milliseconds rather than seconds.
The pattern:
The latency impact is dramatic when cache hits are common. A customer support system with 40 percent cache hit rate has a TTFT distribution that is bimodal: very fast for hits, normal for misses.
I deploy semantic caches behind a thin routing layer that can flag certain queries as uncacheable, for example queries that depend on real-time data or personal user context. The cache lookup itself should be fast, typically under 50ms, to make the optimisation worthwhile.
The architectural caveats:
When done well, semantic caching is one of the largest perceived-latency wins available.
Speculative decoding is a technique where a small, fast model generates draft tokens and a larger model verifies them in parallel. When verification succeeds, the system accepts multiple tokens per forward pass, dramatically increasing tokens per second.
In 2026, speculative decoding is increasingly available as a provider-side optimisation rather than something you implement yourself. The user-visible effect is higher TPS without sacrificing quality.
When speculative decoding is available, I evaluate it explicitly. The TPS uplift is typically 2 to 4x for many workloads, which materially improves the streaming experience.
Related patterns I have used:
These techniques shift the latency profile by exploiting structure in the workload. They are not free, they require additional infrastructure or model calls, but the TPS improvements can be substantial.
When the next user action is predictable, you can begin generating the response before it is requested. This pattern, response pre-fetching, eliminates latency entirely for the pre-fetched action.
Cases where pre-fetching pays off:
The architectural pattern: a predictor identifies likely next actions, the system starts generating speculatively, and the result is cached for instant delivery when the user actually requests it.
The cost is real, because you pay for generations the user may never request. The trade-off is justified when the prediction accuracy is high enough that the perceived latency benefit exceeds the cost of wasted generations.
I have shipped pre-fetching in two patterns. In one, the system pre-fetches a small set of high-probability follow-ups and discards them if not used. In the other, the system generates an initial summary speculatively while the user is still reading the original content. Both improved perceived responsiveness significantly.
Network latency from the client to the model provider is a real component of total latency, particularly for global products. A user in Sydney calling a US-hosted model adds 150 to 200ms of round-trip time before the model even starts working.
Edge inference patterns mitigate this:
The trade-offs are real. Edge inference adds operational complexity, and on-device models have capability limits. But for global products where geographic latency is a meaningful share of the total budget, edge patterns are worth the complexity.
I have shipped systems where a small classifier runs at the edge to handle simple queries instantly, with escalation to a centralised frontier model for complex ones. The user experience for the majority of queries is essentially zero perceived latency.
Many AI workflows are sequential by default. They can often be restructured to run in parallel, with significant latency benefits.
Patterns I use:
The architectural pattern is to identify the dependency graph of the workflow and parallelise everything that does not have a strict dependency. The latency reduction can be substantial for workflows with many independent steps.
The cost is increased complexity in error handling and result aggregation. Parallel paths introduce more failure modes, and the orchestration layer needs to handle partial failures gracefully.
The cheapest millisecond is one you would have spent waiting for something that was not blocking the next step.
I treat parallelisation as the default for any multi-step workflow, and only fall back to sequential when there is a genuine dependency.
The single most impactful latency optimisation is reducing time to first token. Users perceive responsiveness almost entirely through this metric, and most other improvements have smaller perceptual impact.
The techniques I deploy to attack TTFT:
I treat TTFT as a P99 metric, not a P50 metric. The median TTFT is rarely the problem. The tail is where the bad experiences live, and reducing tail TTFT is what users notice.
A practical exercise: instrument your TTFT distribution and look for the long tail. The causes are usually identifiable: cold caches, queueing delays, network spikes, particularly long prompts. Each cause has a corresponding mitigation.
The teams that solve TTFT well typically do so by treating it as a top-three engineering metric, not a footnote. Once it is a measured target, the architecture follows.
The latency that defines user experience is not the median, it is the P95 and P99. A system with great median latency and terrible tail latency has unhappy users.
Sources of tail latency in AI systems:
The mitigations are mostly architectural:
I track P99 TTFT and P99 total completion time as primary metrics. P50 is necessary but not sufficient. The P99 metric tells you what the worst-experienced users feel.
Latency SLOs are how you make latency a sustained discipline rather than a one-time tuning exercise. The SLOs I set for production AI systems:
Each SLO has a corresponding error budget, and exceeding the error budget triggers a freeze on non-essential changes. This is the standard SRE discipline applied to AI workloads.
The dashboards I maintain:
The monitoring discipline is what keeps latency under control as the system evolves. New features, new prompts, and new providers all change the latency profile, and without monitoring the regressions go unnoticed until users complain.
A catalogue of latency mistakes I encounter often.
The common thread is treating latency as a system property rather than an architectural design constraint. Teams that design for latency from the start avoid most of these patterns. Teams that retrofit latency later end up rebuilding more than they expected.
Devansh is an AI Systems Strategist and Founder of YUGNOVA, helping B2B businesses accelerate growth through AI adoption and automation. Creator of the 3-Step AI Adoption Framework, he enables organizations to streamline workflows, improve productivity, and scale efficiently. His practical approach empowers founders to save time, gain operational clarity, and build AI-driven businesses that grow sustainably.
QUICK FACTS
Time to first token. Users perceive responsiveness almost entirely through this metric. A fast TTFT with a slow TPS feels much better than the reverse.