High-Throughput LLM Inference: Benchmarking Methods and Engineering Practices
This article explains why output speed has become a core metric for high-frequency LLM serving, why tokens-per-second numbers from different sources are not directly comparable, and how to turn high throughput into a practical architecture. It covers measurement variables, reasonable interpretation of community benchmarks, five engineering practices, capacity and cost planning, and a deployment checklist.
1. Why Output Speed Matters for High-Frequency LLM Serving
In LLM services that handle frequent everyday calls, the “speed” users perceive is actually made up of two independent measurements. The first is time to first token (TTFT): the time from sending a request to receiving the first visible token. The second is output rate: the number of tokens generated per unit of time after the first token. TTFT determines whether an interaction feels responsive, while output rate determines whether long-form text, code generation, and similar tasks can finish within an acceptable time.
Discussions in the community about a new model version reaching hundreds or even over a thousand tokens per second reflect a broader trend: inference serving is shifting from “capability first” to “capability and throughput equally important.” For developers, the direct benefit is that the same budget can support more concurrent sessions, and the same interaction design can carry longer generated content. However, any number that has not been measured under standardized conditions should only be treated as directional reference, not as a basis for capacity planning.
2. Measurement Criteria: Why TPS Numbers Are Not Directly Comparable
Many disputes do not come from the model itself but from inconsistent measurement methods. To reach a reproducible conclusion, you need to fix at least the following variables:
- Output length and truncation strategy: average rates for generating 128 tokens versus 2048 tokens differ significantly, and short outputs amplify the weight of TTFT.
- Streaming or not: non-streaming calls only measure total duration and cannot separate TTFT from steady-state rate.
- Concurrency and batching: low latency for a single request and high throughput under heavy concurrency are often two competing ends.
- Input length: long context significantly increases prefill time, which raises TTFT.
- Sampling parameters: temperature, top_p, and maximum output length all affect the actual generation path and timing.
A reproducible illustrative measurement logic is shown below (pseudocode that expresses only the measurement structure):
def measure_stream(prompt, max_tokens=512):t0 = now_ms()first_token_ms = Nonecount = 0for tok in stream_generate(prompt, max_tokens=max_tokens):if first_token_ms is None:first_token_ms = now_ms() - t0count += 1total_ms = now_ms() - t0steady_tps = (count - 1) / ((total_ms - first_token_ms) / 1000)return first_token_ms, steady_tps, count
TTFT and steady-state rate are deliberately tracked separately because they are driven by different factors: TTFT depends more on queuing and prefill, while steady-state rate depends more on decode-stage parallelism and memory bandwidth.
3. How to Reasonably Interpret Community Benchmarks
For combinations such as “TTFT of several thousand milliseconds and output rate of hundreds of tokens per second,” the correct interpretation is that TTFT is in an acceptable but somewhat high range, suggesting the request may have gone through queuing or prefill of a long context, while the high steady-state rate indicates excellent decode-stage efficiency. The two coexisting is not contradictory; instead, it suggests optimization should focus on queuing strategy and context compression rather than the decode kernel.
The observation that “code scenarios show higher rates” also has a reasonable explanation: code snippets have more regular token structures and higher repetition, sampling paths are more concentrated, and cache hits and parallelism in the decode stage are usually better. Rate differences reproduced across different tasks therefore reflect task characteristics more than any sudden change in model “capability.”
4. Turning High Throughput into a Usable Architecture: Five Engineering Practices
- Streaming first. Pushing the generation process to the frontend incrementally can significantly improve perceived experience when TTFT is high, and makes timeout and cancellation mechanisms more precise.
- Batching and concurrency tiers. Separate interactive short requests from offline long tasks into different pools to prevent long tasks from crowding the interactive queue, and set independent quotas for different priorities when necessary.
- Context and cache reuse. Stabilize system prompts and retrieved snippets to improve prefix cache hit rates; introduce semantic caching for repeated questions, but define invalidation and consistency policies.
- Output length governance. Use structured output constraints and segmented generation to avoid tail latency from a single overly long output; an illustrative constraint is shown below:
{"max_output_tokens": 1024,"stop_sequences": ["\n\nEND"],"response_format": "json_schema"}
- An observability loop. Collect at least four metrics: TTFT, steady-state rate, error rate, and queue time, and configure monitoring alerts; use logging and tracing to locate whether the bottleneck is queuing, prefill, or decode.
5. Capacity and Cost: Look Beyond Unit Price
In general-purpose cloud services, model calls are usually billed separately for input and output tokens, with output priced higher than input. The value of a high-throughput model is that it reduces the number of concurrent instances needed to meet the same latency target, thereby lowering overall resource usage. For capacity planning, work backward from three factors: target TTFT, target steady-state rate, and peak concurrency, and reserve headroom for bursts. Validate performance under a real input distribution with load testing rather than relying only on peak numbers under ideal conditions.
6. Deployment Checklist
- Are output length, concurrency, and the streaming switch fixed before comparing data?
- Are TTFT and steady-state rate tracked separately?
- Are resources isolated between long tasks and interactive tasks?
- Are cache hit rates and invalidation policies in place?
- Are dashboards and alert thresholds established?
- Has end-to-end load testing been done with real business samples?
Overall, in discussions around high-throughput inference, what truly deserves developers’ attention is measurement methodology, architectural fit, and cost control, rather than a single peak number. Applying the practices above to capabilities such as general-purpose container platforms, logging services, and monitoring alerts on Baidu AI Cloud can build an LLM call pipeline that can be continuously evaluated and gradually optimized.
