llm latency is the time between sending a request to a language model and receiving the response you need. Reduce it by measuring the whole request path first, then addressing the actual bottleneck: prompt processing, token generation, queueing, network calls, or downstream validation. For a routing task, a smaller classifier may be a better fit than a generative model, but only if it meets the same accuracy and failure-handling requirements.
Start with the clock your user experiences
There is no single useful latency number for every application. A streaming chat interface cares about time to first token: how long the user waits before output begins. A system that needs a complete JSON object cares about time to last token, plus the time required to parse and validate the result.
Measure llm latency at the client boundary as well as inside your service. A request can spend time in a load balancer, a provider queue, retrieval, prompt assembly, model inference, and a retry before the application has a usable answer. Timing only the model call can hide delays your users still experience.
Use a monotonic clock and record timestamps at meaningful boundaries: request received, retrieval complete, model call started, first token received, final token received, and validated decision available. For a non-streaming API, you may not have a first-token timestamp; don't infer one from the completed response.
Report the median and tail, such as p95 and p99, alongside error and timeout rates. A low median with frequent timeouts is not a fast system. Include failed requests in the operational picture rather than silently dropping them from the results.
What makes llm latency increase?
Prompt processing, often called prefill, happens before generation. Longer input generally means more work, though the cost depends on the model and serving setup. A retrieval pipeline that adds many documents can spend more time processing context than making the final decision.
Generation then produces output tokens sequentially in a standard autoregressive model. Asking for a short label instead of a paragraph usually reduces generation work. It does not eliminate prompt processing, network overhead, or queueing.

Concurrency changes the picture too. A server that responds quickly to one request may queue requests under load. Batching can improve throughput while changing individual request latency; the result depends on the scheduler and workload. Measure both rather than assuming a throughput improvement makes every request faster.
Hardware and deployment matter. GPU memory, CPU capacity, model size, quantization, context length, and serving configuration can all affect results. So can cold starts, a distant API endpoint, or a tool call that waits on another service. Do not compare two systems without recording those conditions.
Build a benchmark around a decision
Suppose the product must route support messages to billing, technical support, or a human reviewer. Give each candidate the same representative inputs and require the same usable output: a label, an optional confidence value, and a valid response format. Include ambiguous messages, long threads, empty inputs, and examples outside the supported categories.
Here is an illustrative case, not a measured result: the input is “I was charged after canceling, and I can't sign in.” A reasonable system might return billing or request human review, depending on the routing policy. The important point is to define that policy before timing the response. Otherwise, a fast answer may simply be the wrong decision delivered quickly.
For each run, record input and output token counts where available, the model and version, serving location, concurrency, timeout, and whether the request was cold or warm. Keep the dataset and configuration fixed when comparing changes. Run enough requests to make the tail meaningful, and repeat the test under the traffic pattern you expect in production.
Measure llm latency together with decision quality. Compare labels against reviewed examples, track invalid outputs and abstentions, and inspect errors by category. If one system returns a confidence score, check calibration on held-out data before using a threshold to automate a decision. A score of 0.9 is not, by itself, evidence that nine out of ten such decisions are correct.

Reduce the work before changing models
Start with the prompt. Remove duplicated instructions, stale conversation history, and retrieved passages that do not affect the decision. Preserve the context required for accuracy, then rerun the same quality checks. A shorter prompt is only an improvement if the system still makes acceptable decisions.
Set an output limit appropriate to the task and request a compact schema. For a classifier, a label and a reason code may be enough; an essay adds tokens and parsing opportunities. Make sure the limit is not so tight that it truncates valid JSON or omits a necessary field.
Next, inspect the request path. Cache stable retrieval results or repeated answers only where freshness and privacy rules allow it. Parallelize independent operations when doing so does not change their meaning. Set explicit timeouts and a fallback route; an unlimited wait is not a reliability strategy.
If queueing dominates llm latency, evaluate capacity, concurrency limits, and batching settings under realistic load. If generation dominates, test shorter outputs or a smaller model. If network time dominates, investigate deployment location and extra service calls. Each change should have a before-and-after measurement, including errors and decision quality.
When a decision model is the better tool
For a fixed set of labels, compare the generative system with a conventional classifier or a decision-oriented model. A non-autoregressive model can produce a decision without generating a sequence of explanation tokens, but that architectural distinction alone does not guarantee lower end-to-end latency. Tokenization, hosting, input length, and load still count.
Laya's decision-model approach is relevant to that comparison, but architecture is not a benchmark. Before selecting it or any alternative, verify its supported inputs and outputs, deployment requirements, confidence semantics, and performance on your own labeled cases. The same goes for a small classifier built with a library such as Hugging Face Transformers: measure the deployed pipeline, not just a model card.
I would ship the simpler system only after it meets the task's quality target, handles uncertain cases safely, and stays within the latency budget at expected load. Show me the decision, not just the demo.