High-Throughput LLM Inference: How to Benchmark and Evaluate Real-World Speed
Community tests of a new lightweight large language model report output speeds around 900 tokens per second, with peaks above 1100 tokens/s in code generation. This article explains how to interpret such unofficial numbers: separating time to first token (TTFT) from output rate (TPS), building a reference frame for comparison, understanding why code scenarios often show higher TPS, running reproducible load tests, and turning high throughput into business value through streaming consumption, caching, and observability. It also warns that speed must be validated separately from correctness, especially for code tasks.
1. Background: A “Speed Anomaly” in Community Testing
A set of high-throughput benchmark results for a new generation of lightweight large language models has recently circulated in technical communities. What drew attention was not a jump in capability metrics, but an output rate that reached a range rarely seen before: some testers recorded generation speeds of roughly 900 tokens per second, with peaks approaching or exceeding 1100 tokens/s in code generation scenarios.
A clarification is needed first: these figures come from self-conducted tests by community members, not from an official vendor release. They are unofficial observations made in a gray, non-production environment. Test methodology, concurrency conditions, network paths, and client implementations were not standardized, so the data is better treated as a clue that a higher performance ceiling may exist rather than as a service metric that can be committed to.
2. Split Speed into Two Metrics: TTFT and Output Rate
Discussing whether an LLM is “fast” requires breaking the experience into two distinct metrics.
- Time to first token (TTFT): the time from sending a request to receiving the first token, which determines “how long until something happens after I click.”
- Output rate (TPS): the number of tokens generated per second after the first token, which determines “how smoothly the text streams out.”
- End-to-end duration: roughly TTFT plus total output length divided by output rate, which is the total time users actually perceive.
A typical pattern in the community data is that TTFT fluctuated between 3.6 and 7.5 seconds while output rate fluctuated between 570 and 930 tokens/s, and the two were not in sync. This matches common knowledge about inference systems: TTFT is mainly affected by queue wait time, input length, and prefill computation; output rate is mainly affected by memory bandwidth during decoding, batching strategy, and parallelism.
This leads to a practical conclusion: if your workload is short Q&A, classification, or extraction with very short outputs, TTFT accounts for nearly the entire experience and a high TPS matters little; if it is long-form generation, code completion, or batch rewriting where outputs often run to thousands of tokens, output rate is amplified into the dominant cost factor.
The estimation relationship can be expressed with illustrative pseudocode:
def estimate_latency(ttft_ms, output_tokens, tps):decode_ms = output_tokens / tps * 1000return (ttft_ms + decode_ms) / 1000 # unit: seconds# Scenario A: short output, dominated by TTFTprint(estimate_latency(6850, 120, 900)) # ~6.98s# Scenario B: long output, dominated by output rateprint(estimate_latency(3630, 4000, 900)) # ~8.07s
The same set of model metrics produces completely different bottlenecks in the two scenarios, which is exactly where model selection is most easily misjudged.
3. Reference Frame: How to Judge Whether “Several Times Faster” Holds Up
An isolated number means nothing; a reference frame must be established. Lightweight models are typically positioned as “frontier capability with speed as the priority,” meaning they retain usable capability while tuning latency, cost, and availability to suit high-frequency invocation. Output rates for comparable models reported by third-party industry evaluation organizations are generally on the order of a hundred-plus tokens per second.
If the community-measured several hundred tokens per second can be reproduced, the difference relative to the reference frame is on the order of several times, not a minor optimization. But rigor is required here: community tests often use non-standard clients, may enable different sampling parameters and streaming parsing methods, and may even differ in statistical methodology (for example, whether retries and chunk concatenation are counted). The correct phrasing is therefore “a significantly higher output rate was observed under certain paths and conditions,” not “the model’s speed is a fixed N times faster.”
4. Why Code Scenarios More Easily Produce High TPS
Code generation often shows higher numbers for three reasons:
- Output structure is highly predictable, with high density of abbreviations and symbols, so output per unit time after tokenization is more easily pushed up.
- Completion requests have moderate output length and repetitive patterns, leading to high batching efficiency.
- Testers often use coding assistant tools that support streaming rendering, so client-side parsing overhead is low and measurements are closer to the server’s actual decoding speed.
It must be emphasized that high TPS does not equal high accuracy. The metrics that truly matter in code scenarios are pass@1 rate, unit test pass rate, cross-file dependency understanding, and reference accuracy in long contexts. Speed only improves interactive feel; it cannot replace evaluation on a benchmark set.
5. A Reproducible Load Testing Plan
Turning a “suspected leak” into a credible conclusion requires a standardized process:
- Fixed inputs: prepare short, medium, and long prompts of roughly 200, 2000, and 8000 tokens, and record the actual token counts.
- Fixed parameters: standardize temperature, maximum output length, and whether streaming is used, to avoid sampling differences contaminating results.
- Tiered concurrency: test at concurrency 1, 4, and 16, and observe whether TPS degrades as concurrency rises.
- Multiple samples: run at least 5 times per tier, and report the median and P90 rather than a single peak.
- Dual-end timing: compare client-side timing with server-side log timing to locate the share of network and queue time.
An illustrative load testing skeleton:
import time, statisticsdef bench(call, prompts, repeats=5):ttft, tps = [], []for p in prompts:for _ in range(repeats):t0 = time.perf_counter()first, total = call(p) # returns first-token time and total token countt1 = time.perf_counter()ttft.append((first - t0) * 1000)tps.append(total / max(t1 - first, 1e-6))return {"ttft_p50_ms": statistics.median(ttft),"tps_p50": statistics.median(tps),"tps_p90": sorted(tps)[int(len(tps) * 0.9) - 1],}
6. Engineering Implementation: Turning High Throughput into Real Gains
Converting a high output rate into business value requires three supporting changes.
First, the calling side must truly consume the stream. If it still waits for the complete response in one shot, the high TPS is entirely wasted. Server-side rendering, incremental logging, and line-by-line completion should all be based on incremental chunks.
Second, capacity and cost must be accounted for in both directions by token. Input and output are usually billed separately, and in long-context scenarios input-side cost may exceed output-side cost. It is advisable to introduce cache reuse (identical prefixes go through cache), context trimming, and summary compression to reduce input size.
Third, stability is backed by observability. At minimum, collect four categories of metrics: TTFT, output rate, error rate, and truncation rate, and configure monitoring and alerting; apply exponential backoff retries for timeouts and rate limiting to prevent transient jitter from amplifying into an avalanche.
For cloud implementation, general-purpose capabilities can be combined: a container platform hosts the inference gateway and load testing client, object storage holds evaluation sets and results, a message queue smooths peaks and fills valleys, and logging plus monitoring and alerting close the loop. In such scenarios, Baidu AI Cloud typically also handles this with the general combination of “container platform + object storage + logging + monitoring and alerting”; for specific specifications, refer to the official documentation.
7. Conclusion and Recommendations
The high-throughput data circulating in the community is valuable because it points to room for optimization in the decoding efficiency of lightweight models, not because it provides a service level that can be committed to directly. The rational approach is to first use standardized load testing to confirm the metrics are reproducible, then judge whether the bottleneck lies in TTFT or output rate based on business output length, and finally use streaming consumption, cache reuse, and observability to turn paper speed into real experience. For code scenarios, always validate speed metrics separately from correctness evaluation, and avoid overlooking pass@1 rate—the core metric—because of “fast token output.”
