High-Throughput LLM Inference: Benchmarking and Engineering Practices
This article breaks down high-throughput LLM inference for interactive applications, covering key metrics such as TTFT and TPS, reproducible load-testing methods, four-stage bottleneck analysis, and general engineering optimizations like streaming, batching, prefix caching, and autoscaling. It also discusses specific considerations for AI coding scenarios. Readers will learn how to measure, locate, and improve inference latency and throughput without relying on vendor-specific components.
1. The Engineering Topic Behind the Hype: From “Absurdly Fast” to Measurable Throughput
A set of community discussions about a new lightweight large model has recently circulated in technical circles: reported output speeds of hundreds to over a thousand tokens per second, with even higher instantaneous rates in AI coding scenarios. Since most of these figures come from community canary tests rather than official benchmarks, with inconsistent measurement criteria and limited samples, they should not be treated as conclusions. Setting the specific numbers aside, they point to a real and important engineering topic: how to deliver high-throughput, low-latency inference for highly interactive applications.
This article does not review or recommend any specific product. Instead, it abstracts the phenomenon into a general technical question: what determines token throughput, how to measure it scientifically, where the bottlenecks are, and how to optimize on the engineering side.
2. Get the Metrics Right: Throughput and Latency Are Not the Same Thing
Many discussions conflate different notions of “fast.” In practice, at least four metrics need to be separated:
- Time to first token (TTFT): the time from sending a request to receiving the first token, which determines whether the interaction feels responsive.
- Output throughput (TPS): the number of tokens produced per second during generation, which determines the wait time for long text or long code.
- End-to-end latency: the total time to complete the entire task.
- Service capacity: the total number of concurrent requests that can be served per second per unit of resource, which determines cost and stability.
A common mistake is looking at TPS alone. When TTFT is high, the interaction still feels laggy even if output is fast; and under high concurrency, poor scheduling can also drag down per-request TPS. Evaluation therefore needs to look at TTFT, TPS, and concurrency capacity together.
Example metric record structure:
request_id, ttft_ms, tps, output_tokens, concurrency, timestampr-001, 4421, 577, 1200, 8, 2026-01-01T10:00:00Zr-002, 3630, 673, 1500, 8, 2026-01-01T10:00:01Z
3. Reproducible Load Testing: Making the Data Stand Up to Scrutiny
Community data is hard to compare across sources because it lacks consistent constraints. A credible evaluation should at least fix the following variables:
- Input and output length: use short, medium, and long prompts, and lock the maximum number of output tokens.
- Streaming vs. non-streaming: only streaming can measure TTFT; non-streaming only shows total elapsed time.
- Concurrency gradient: increase load step by step at 1, 4, 8, 16, and 32, and observe how TPS changes with concurrency.
- Repetition and statistics: repeat each level multiple times and report the median and percentiles, not a single peak value.
- Environment description: network region, client implementation, whether cache reuse is enabled, and so on.
Pseudocode example:
async def bench(client, prompt, max_tokens, concurrency):async def one():t0 = time.perf_counter()first = Nonen = 0async for tok in client.stream(prompt, max_tokens=max_tokens):if first is None:first = time.perf_counter()n += 1total = time.perf_counter() - t0ttft = (first - t0) * 1000tps = n / max(total - (first - t0), 1e-6)return ttft, tpsresults = await gather_limited(concurrency, [one() for _ in range(N)])return summarize(results) # median, P90, etc.
Only when the measurement criteria are clearly defined do numbers like “900+ tps” become comparable.
4. What Determines Throughput: Four-Stage Bottleneck Analysis
A request roughly goes through four stages: queueing → prefill (processing the input) → decode (generating token by token) → post-processing and network transfer. Bottlenecks need to be analyzed stage by stage:
- Queueing and scheduling: when concurrency exceeds capacity, requests wait in the queue and TTFT spikes.
- Prefill: long inputs significantly increase time to first token; this stage is compute-intensive.
- Decode: token-by-token autoregressive generation, most affected by GPU memory bandwidth and batch size, and the main battleground for TPS.
- Transfer and rendering: overly large streaming chunks or inefficient client rendering can make the backend fast but the frontend laggy.
Practical advice: use stage-level instrumentation to confirm the bottleneck stage first, then optimize accordingly, rather than blindly scaling up capacity.
5. General Engineering Optimizations
Without relying on any proprietary interfaces, the industry commonly uses the following methods to improve perceived experience and capacity:
- Streaming output: return the first token as early as possible, combined with incremental rendering, to significantly improve the interactive experience.
- Batching and continuous batching: merge multiple requests for computation to increase throughput per unit of resource.
- Prefix cache reuse: cache invariant prefixes such as system prompts and long documents to reduce repeated prefill overhead.
- Context trimming: keep only necessary history and control input length to lower TTFT.
- Elastic autoscaling: automatically scale up and down based on queue length and utilization, balancing peaks and cost.
- Nearby access and connection reuse: reduce network round trips and keep long-lived connections stable.
Illustration: request construction with prefix caching
[system_prompt(cacheable)] + [retrieved_context(cacheable)] + [user_turn(changes)]
Placing the changing part as late as possible maximizes cache hits.
6. Special Considerations for AI Coding Scenarios
Code-related tasks are especially sensitive to throughput: code completion and refactoring require low TTFT, while whole-file generation requires stable high TPS. Engineering options include:
- Structurally trimming repository retrieval results to compress the input;
- Using segmented generation that produces the skeleton first and details later, reducing the output length of a single pass;
- Observing percentile latency under container platforms, log services, and monitoring and alerting systems to locate slow requests.
If an organization wants to build similar capabilities in its own environment, it can typically rely on general cloud categories such as container platforms, object storage, message queues, and monitoring and alerting for deployment and observability, without binding to vendor-specific proprietary components.
7. Conclusion
The value of community data showing “abnormally fast” performance lies not in any peak number, but in reminding us that high throughput is the result of system design, not an accidental single-point parameter. Only by clearly defining metrics, unifying load-testing criteria, analyzing bottlenecks stage by stage, and combining general techniques such as streaming, batching, caching, and autoscaling can we reliably deliver a low-latency, high-throughput inference experience in high-frequency interaction scenarios.
