Evaluating LLM Output Speed: Measurement and Engineering Practice
Token-per-second peaks are easy to quote and hard to trust. This article explains how to treat LLM output speed as a reproducible engineering metric: time-to-first-token versus decode throughput, why informal benchmarks fail, how coding tasks couple speed with quality, common acceleration techniques, and how applications should absorb fast streams without confusing model speed with tools, queues, or UI work.
Developers often pick a chat or coding assistant by how many tokens it can emit per second. Speed affects perceived wait, completion cadence, and batch throughput, but a single peak can confuse gray-release environments, short prompts, cache hits, or nonstandard timing with a model’s stable capability. A more reliable approach is to treat speed as a reproducible engineering metric: what you measure, under what load, whether quality still holds after it is faster, and whether the application can absorb a high-rate stream.
What speed actually solves
LLM inference usually has two user-facing phases. The first is from request to the first valid token—time to first token (TTFT). It answers whether the system has started working. The second is the rate of later tokens, often reported as tokens/s. It determines how long long answers, code, and documents take to finish.
The two phases are driven by different factors. TTFT is more sensitive to queuing, cold start, prompt length, retrieval concatenation, and the first compute step. Output throughput is more sensitive to decoding strategy, batching, cache, and hardware utilization. A model can be slow to first token and fast thereafter, or fast on the first packet and slower on long outputs. Citing only one number does not describe real interaction.
For high-frequency calls, speed also ties to cost and capacity. Under the same concurrency, the less time a request occupies the decoder, the more sessions you can serve. That does not mean unbounded concurrency: oversized batches, long contexts, or many tool calls can queue work and raise TTFT again. Evaluation must cover idle, typical concurrency, and peak queueing—not only single-user feel.
Why informal speed tests are hard to compare
Community screenshots sometimes show throughput far above public benchmarks. Treat them as leads, not selection conclusions. Common biases include:
- Inconsistent timing start: click-to-send, HTTP response headers, or excluding server-side queueing.
- Different token accounting: tokenizer, whether whitespace and punctuation count, or character-based estimates converted to tokens/s.
- Different prompts and stop conditions: short prompts, strong cache, and early stop are not the same load as long context and multi-turn tool results in real coding work.
- Non-reproducible environments: gray routing, region, quotas, speculative decoding, prefix cache—often invisible on the client.
- Peaks without distributions: one spike is not P50 or P95. Production cares about the stable band and the tail.
When comparing a current high-speed model with a supposedly faster new version, at least fix the same prompt set, target output length, concurrency, and tokenizer accounting, and repeat for median and tail latency. Without those conditions, “several times faster” has marketing value, not engineering value.
A schematic client timer can be simple; the point is a documented definition, not an absolute number:
import timedef measure_stream(chunks):t0 = time.perf_counter()first = Nonetext = []for chunk in chunks:if not chunk:continueif first is None:first = time.perf_counter()text.append(chunk)t1 = time.perf_counter()ttft_ms = None if first is None else (first - t0) * 1000# In production, count tokens from server-side usage; do not treat characters as tokenselapsed = max(t1 - (first or t0), 1e-6)return {"ttft_ms": ttft_ms, "chars": sum(len(x) for x in text), "gen_s": elapsed}
This only shows the measurement structure: record first packet and subsequent generation separately, and take token counts from server usage. Character counts are a rough check, not a publishable performance claim.
Why coding feels faster—and more demanding
Coding is often used to demo high-speed models because the model streams functions, comments, and tests and the screen scrolls. The benefit is real: completions and explanations can keep up with thought, and long-file rewrites need less idle waiting. Code tasks also amplify quality issues.
A screenshot of terrain, a character camera, or a UI that “looks runnable” only shows plausible structure. Compile success, consistent state, correct edges and collisions, and real dependencies require running tests. If fast decoding brings repetition, truncation, invented APIs, or inconsistent names, higher tokens/s can mean faster rework and negative net gain.
A better acceptance bar binds speed and quality on the same tasks: generate a module from an interface spec that passes existing unit tests, or apply small edits in a fixed repo and record first-pass rate, lines of human fix, and total wait. Wait time should include failed retries, not only the first stream finishing.
Common industry acceleration approaches
Without tying to a specific product, high-speed inference usually comes from stacked techniques, not a single mysterious switch.
- Model: distillation or a smaller decoder drafts frequent tokens; a stronger model verifies—speculative decoding and similar ideas. Accurate drafts accept more tokens and cut wall-clock time; poor drafts fall back and the speed gain vanishes.
- Compute: quantization, operator fusion, paged cache, and continuous batching raise memory use and cut per-decode-step cost. These affect numerics and long-context stability and need business-set regression, not throughput alone.
- Serving: prefix cache fits system prompts and repeated repo context; dynamic batching fits many short requests sharing an accelerator. Low cache hit rates mean advertised peak speed will not appear.
- Interaction: streaming, incremental render, and interruptible generation let users see partial results earlier and stop a wrong answer. That does not add model FLOPs, but it improves feel.
Combined effect depends on task length, concurrency, and hit rate. Treating a lab single-request peak as a capacity-planning number is a common selection mistake.
How applications absorb a fast stream
When output outruns the UI and downstream work, the bottleneck moves from the model to the client. Logs, diffs, syntax highlighting, and autosave on every token can stutter and make the model feel slower. Merge increments by time window or by line, show plain text first, and highlight and statically check when idle.
Tool calls need a separate view. The model can emit tool arguments quickly, while compile, retrieval, and tests are slower. Folding all of that wait into model throughput mis-blames or mis-rewards the model. Observe at least queue, first token, decode, tool execution, and return. Only the decode segment is well described by tokens/s.
When you deploy inference or business services in a cloud environment such as Baidu AI Cloud, split these stages into independent metrics and pair them with rate limits, timeouts, and degradation. Degradation can mean shorter max output, turning off optional retrieval, or making long jobs asynchronous at peak. Do not assume a high-speed SKU keeps the same curve under every quota and region.
Looking at quality, cost, and stability together
High-speed models usually put usable intelligence into daily high-frequency calls rather than replacing stronger, slower models on every hard problem. A practical split: simple rewrites, boilerplate, log explanation, and drafts on the fast model; complex reasoning, large refactors, or high-risk change on a stronger model—or a fast draft plus a strong review.
Cost is not only list price. Long, fast output raises spend and log volume together. Set max tokens, stop sequences, and “stop when good enough” prompts so completeness does not become idle generation. Stability means failure rate under rate limits, whether retries amplify load, and whether latency cliffs when cache misses.
A small acceptance checklist before you scale:
- Build a prompt set covering short Q&A, long code, multi-turn edits, and tool results, with length close to real traffic.
- Fix accounting; record TTFT, output tokens, generation time, and failure rate, at least median and tail.
- Run at 1 concurrent and at target concurrency; see whether queuing eats the speed gain.
- For code, run tests or compile; record first-pass rate and rework time.
- Spot-check factuality, API consistency, and truncation; confirm acceleration options did not clearly hurt quality.
- Split observation into queue, decode, and tools before calling anything “unusually fast.”
Conclusion
Output speed is a first-class LLM engineering metric, not a standalone one. TTFT drives responsiveness, decode throughput drives long-text efficiency, and concurrency plus cache decide whether those numbers reproduce in production. Fast scrolling in the editor is intuitive and must be constrained by runnable results. Informal peaks as release copy, or brand-level fast/slow comparisons, do not guide capacity or cost. Unify measurement first, then put streaming UX, tool time, and quality regression on one acceptance sheet so speed is a deliverable capability rather than a screenshot that cannot be audited.
