How to — find out why your AI feature feels slow

Share

You can name the hop where the wait goes, and you know which change will move it — that is the whole job. A slow AI feature is rarely slow because the model is slow; most of the wall clock sits in front of the first token, in the prompt you assembled, the retries you never logged, and the queue you joined without noticing.

The reason to do this properly is that "it feels slow" is not a diagnosis. Teams respond to it by swapping the model, which is expensive, changes your output, and often fixes nothing because the wait was in retrieval or in a 6,000-token prompt nobody looked at. Here is the routine that finds the real cost of the wait before you buy a faster one.

1. Put a clock on every hop, measured from the user's click.

Instrument the turn end to end: request received, prompt built, retrieval done, provider call sent, first token back, last token back, post-processing done, response rendered. Give each hop a timestamp on the same clock and log them together with one request ID. The provider's own dashboard will tell you the model took 1.8 seconds; it will not tell you that the user waited eleven.

Include the network. A developer laptop on office fibre sees a different product than a phone on a train, and the gap is usually larger than any model difference you are about to pay for. If you can only add one thing this week, add the client-side measurement of when the answer first appeared on screen — that number is the one your users are describing.

2. Split the turn into first token and everything after it.

These are two different wait problems with two different fixes. Reading the prompt is prefill: the model processes everything you sent in one pass, and its duration is what providers call time to first token. Writing the answer is decode, measured in tokens per second, and it dominates whenever the output is long. AI 101 — What is tokens per second? lays out the two phases and why a long-document, short-answer job behaves nothing like a short-prompt, long-answer one.

For a chat reply, the reader experiences the first token — after that, text arrives faster than anyone reads. For a structured output, an extraction, or a report, nobody sees anything until the last token lands, so the decode rate is the entire experience. Measure both and label your feature as one shape or the other. Most arguments about speed inside a team are one person talking about first-token latency and another about total time.

3. Hunt the invisible queue before you touch the model.

The gap between what you measured and what the user felt is usually filled by things your client hides: a retry after a timeout, a rate-limit backoff, a cold container, a second call to a smaller model that classifies the request first, three tool calls in sequence that could have run at once. Every one of those adds a wait, and none of them appears in the model's own latency figure.

Read the distribution, not the average. A feature that answers in two seconds at the median and nine at the ninety-fifth percentile is a feature people describe as slow, because the slow cases are the memorable ones. When the tail is fat, look for the request that got a 429 and quietly tried again, the session that hit a cold start, or the user whose input tripped a longer path through your own code. Fixing the tail is usually a retry you can see, a warm path, or a parallel call — cheap work with a visible effect.

4. Weigh what you send before you blame what you get.

Prefill time grows with the prompt, and prompts grow quietly: full conversation history instead of the last few turns, twelve retrieved chunks where three would do, a system prompt that has accumulated every instruction anyone ever added. AI 101 — What is a KV cache? explains why repeated context is both the thing that makes long conversations affordable and the thing that caps how many of them a server can hold at once.

The test is blunt: log the input token count next to the wait for a week. If the slow turns are the big ones, you have found your bottleneck, and the fix is editorial rather than architectural — trim the history, rerank the retrieved pieces and pass the top three, move standing instructions into a shorter form, and cache the stable prefix so it is not re-read on every call.

5. Shrink the answer to the size the job needs.

Output length is the most controllable variable in the whole system and the least controlled. A model asked to "explain" will write four hundred words where sixty would answer the question, and at a reading speed of roughly 30 tokens per second that is thirteen seconds of generation for prose nobody asked for. Ask for the shorter thing explicitly — a table instead of a paragraph, a verdict instead of a discussion, a fixed number of items.

Then decide whether the wait should be visible at all. If the answer streams, the reader starts consuming at the first token and the perceived wait collapses; if it cannot stream because you need to parse it, show progress that reflects real work rather than a spinner that means nothing. Interface feedback does not make the computation faster, but the response-time research behind the one-second and ten-second thresholds (Nielsen Norman Group) is about attention, and attention is what your users are spending.

6. Change the model last, and measure it at your own load.

If the wait is still in the model after all of that, you now know which number you need to improve: first token, decode rate, or the tail under concurrency. Provider speed claims are measured on their hardware, at their batch size, on their prompt length; independent comparisons such as Artificial Analysis are a better starting point because they run the same tests across providers, but neither is your traffic. Run the candidate on your five heaviest real requests at your concurrency and compare the same three numbers. A faster model that costs twice as much per task is a trade worth pricing properly — How to — estimate what an AI feature will cost before you ship it is the arithmetic for that comparison.

Don't do this: don't tune against the average, and don't measure from a warm sandbox. A benchmark run on your laptop, at 3am, with a cached prefix and no other users, produces a number that describes your laptop. The same is true of a chart that shows the mean: an average hides the retry and the cold start, which is exactly where the complaint lives. And do not swap the model as the first move — it is the most expensive change available and the least likely to be the cause.

How you'll know it worked. You can draw the turn as a timeline and name the hop that eats the wait, in seconds, from a real session rather than a demo. You have a ninety-fifth-percentile figure and you know what makes it worse. After your change, the tail moved and the average barely did — which is the signature of a fix that reached the users who were complaining. And when someone says the feature feels slow again next quarter, you check the timeline instead of arguing about models.

Which hop turned out to be the slow one in your stack — the model, the prompt, or something you had instrumented last? Write to us via our contact page.

Get SiliconNoon in your inbox

One email a day with the AI stories that matter — what happened, the numbers, and why it matters. No spam, unsubscribe in one click.

Read more

How to — tell if an AI model has quietly changed

How to — tell if an AI model has quietly changed

The model you call today is not necessarily the model you tested. Providers update the served system in place — a fine-tune, a new safety classifier, a rewritten system prompt, a different route — and your request still returns 200 with a perfectly normal-looking answer. You can catch that on your own inputs, in about an afternoon of setup and a few minutes a week, so a provider update shows up as a dated event in your logs instead of a support ticket three weeks later. The change is not…

How to — stop an agent before it burns your budget

How to — stop an agent before it burns your budget

An agent that runs unattended fails in a way a chat window never does: it fails expensively. The job here is to make the worst case of any run a number you know before you press go — and to have the run stop itself the moment it stops making progress. Most teams discover this the hard way. A task that should take twelve steps takes four hundred, half of them re-asking the same question in slightly different words, and the invoice arrives two days after the incident.

How to — review AI-written code before you merge it

How to — review AI-written code before you merge it

You want to merge AI-written code without reading every line of it — and still be able to say, out loud, what it does and what happens when it breaks. That is a review job, and it is mostly about reading the right parts in the right order. Cockroach Labs ran its codebase like a teaching hospital for five months and reports merging well over a million lines of code with seven total reverts — a run where no agent's plan moved without a human-signed review first (we covered Coding agents as a…

Java4Shell: a five-month-old Java bug, patched only after an exploit

Java4Shell: a five-month-old Java bug, patched only after an exploit

The second "2Shell" in two months is the one running your identity provider, your build server and your artifact store. The interesting part is not how fast AI found it. It is how long everyone already knew. Java4Shell, tracked as CVE-2026-114938, is a heap overflow in the Base64 decoder built into modern OpenJDK, and on an unpatched server it hands an anonymous attacker remote code execution in Keycloak, Atlassian Jira and Confluence, Jenkins, JFrog Artifactory and PingFederate, per Calif…