Own Weights

Building low-latency LLM features

Building low latency LLM features: what latency measures, where the wait comes from, and how to test the time to first token on your own prompts.

Updated

A low latency LLM feature is one where a person waits less between sending a request and seeing a useful result. In autocomplete, reply suggestions, or a form that fills itself in, that wait is most of the product, so the design has to start there. The usual approach is a short prompt, a short answer, and streaming so the first words appear early.

What latency actually measures

Two numbers matter. Time to first token is how long the user waits before anything appears. Total time is how long until the full answer is done. A streamed answer can feel fast even with a long total time, because the reader starts on the first words while the rest arrives. A batch job cares about total time and throughput instead.

Measure both on your own requests. A single tokens-per-second figure hides the first-token wait, which is why it is a weak guide to how a feature will feel. See tokens per second, explained for what that number leaves out.

Where the wait comes from

The wait has three parts: the network trip, the work of reading your prompt, and the work of writing each output token. For most features the output is the largest part. Tokens come out one after another, so a 200-word reply takes far longer than a five-word label, whichever model writes it.

Long prompts add to the first-token wait, because the model reads the whole input before it writes. Take an inbox reply suggestion as an example. If the prompt carries the full thread of earlier messages, the model reads every one of them before the first suggested word. If the prompt carries only the latest customer message, the reply rules and the last two turns, the same feature answers sooner and usually with the same quality. Cut any instruction that does not change the answer, and any context the model does not need for this step.

Choose a smaller model trained for the task

A general model is built to handle everything, and that breadth costs time on every call. A smaller model trained on one job often gets the answer right with less work per token, but it can lose accuracy, so measure that before you switch.

On a public contract benchmark, our Standard model, trained for clause extraction, scored 0.650 against 0.584 for a general Claude model that got one prompt and no examples. That gap is the point: a model trained on the task can beat a general one on that task. Full results are on the benchmark page.

To test a switch, run the same real requests through the current model and the candidate. Score the answers against labels you trust, and log the time to first token for each. Keep the model that clears your accuracy bar at the shorter wait.

Keep output short and stream it

Ask for the shortest answer that still works. A label, a score or a short JSON object takes less time than a paragraph. Use structured output so the model stops where the data ends, and parse the result in code rather than asking the model to explain it. Set an output limit as a safety net, and treat a cut-off answer as an error your code handles. Do not treat the limit as a speed setting. The details are in structured JSON output without slowing down.

Streaming sends tokens as the model produces them, so the first words reach the screen while the rest is still being written. Use it for any text a person reads. Do not stream when your code needs the whole answer before it can act, such as a single JSON parse or a database write. In that case keep the output short, and run the call in the background if the user does not need to wait for it.

Keep the call path short

Every hop adds time, and the hops stack. The usual culprits are a retry that waits out a long timeout before it tries again, a fallback provider that only starts after the first one has failed completely, and a queue in front of the model that holds requests while earlier ones finish.

Set explicit timeouts that are shorter than your user’s patience. Retry only on errors that can succeed on a second try, with a short backoff. Put the inference endpoint in the same region as your users and your data, since the network trip is paid on every call. A batch job returns on its own schedule, so it fits background work and not a live feature. See batch APIs vs real-time calls. Rate limits can also turn a fast call into a slow one at peak hours.

Measure before you ship

Build the test from requests your product actually sends, not from short sample prompts. Record time to first token and total time for each one. Look at the 95th percentile, not the average, because the slow calls are the ones users remember.

Run the test at the concurrency you expect in production. Waits rise when many requests share one serving setup, so a result from one request at a time can overstate how fast the feature will feel at peak. The trade between how many requests you handle and how fast each one returns is covered in throughput vs latency in LLM serving.

Common mistakes to avoid:

  • Judging speed from a demo prompt a vendor picked.
  • Reporting an average, which hides the slow tail.
  • Testing one request at a time, then launching into peak traffic.
  • Adding a retry with no timeout on the first attempt, so one stuck call holds the user for the full window.

A short checklist before launch:

  1. Write down the wait each feature can accept, in seconds.
  2. Log time to first token and total time on real requests.
  3. Remove prompt context that does not change the output.
  4. Set an output limit and a structured format.
  5. Set timeouts and a retry policy with backoff.
  6. Re-run the test at peak concurrency and compare against step 1.

If one call in your product feels slow and you want to know whether a trained model can replace it, Own Weights can help. Book a free audit and we map your AI spend by task, then test a fine-tuned model against the one you use now on your own data before anything is deployed.

Questions

What is a good time to first token for a chat feature?

There is no universal target. Decide what the user will accept for that feature, since autocomplete needs a faster first word than a long report. Then measure against that number on your own prompts.

Is a smaller model always faster?

Usually it produces tokens faster, but speed also depends on prompt length, output length and how the model is served. A small model that writes a long answer can still finish later than a larger one that writes a short answer. Compare total time on your own requests.

Does streaming make an LLM faster?

Streaming does not shorten the full answer. It shortens the wait before the first words appear, which is what people notice in a chat window or a suggestion box. It does not help code that needs the complete answer before it can act.