Ultra-Low-Latency LLM Inference Performance: Metrics, Benchmarking, and Reproducibility

    This article breaks down ultra-low-latency, high-throughput LLM inference into measurable metrics, explains why community-reported token-per-second numbers are hard to compare, and outlines a reproducible benchmarking approach. You will learn how to define TTFT, per-request TPS, global throughput, and end-to-end latency; how to design concurrency and input/output length sweeps; and which general techniques such as speculative decoding, continuous batching, paged KV cache, prefix caching, quantization, and MoE drive throughput. It also covers why coding workloads often hit peak TPS and how to treat P95 latency, capacity planning, and cost estimation in production.

    1. Starting From “Suspiciously Fast”: A Performance Claim to Verify

    A set of high-throughput measurements for a new lightweight large model has been circulating in technical communities: output speed reported in the hundreds to over a thousand tokens per second, with even higher peaks on coding tasks. Because these figures come from community testing rather than an official announcement, they should be treated only as informal observations, not as a basis for model selection. What matters is not any specific number, but the evaluation methodology problems it exposes: inconsistent measurement definitions, small sample sizes, unclear concurrency conditions, and unknown cache or speculative decoding settings.

    This article therefore strips away product-specific attributes and frames the topic as a general engineering problem: how to scientifically measure and reproduce high-throughput inference performance.

    2. Breaking “Fast” Into Measurable Metrics

    In everyday usage, “fast” covers at least four dimensions, and mixing them together inevitably distorts the picture:

    • Time to first token (TTFT): the time from request submission to receiving the first token. It determines perceived responsiveness and is mainly affected by queuing, prefill length, and scheduling policy.
    • Output throughput (TPS per request): the token generation rate during decoding, affected by batch size, memory bandwidth, and KV cache strategy.
    • System throughput (tokens/s, global): total output produced across the service per unit time, which is the baseline for capacity planning and cost accounting.
    • End-to-end latency: TTFT + output length / TPS, the value users actually perceive.

    A typical mistake is using single-request peak TPS to estimate service capacity. High single-request throughput often comes from the most favorable conditions—small batches, short contexts, cache hits—and can differ severalfold from stable throughput under concurrency.

    3. A Reproducible Benchmarking Plan

    To make data credible, variables must be fixed and measurement definitions disclosed. A minimal experimental design:

    1. Fix input/output length buckets, for example input 512 / 2048 / 8192 and output 128 / 512.
    2. Sweep concurrency levels: 1, 4, 16, 64, and observe the inflection points in throughput and latency.
    3. Disable or explicitly declare acceleration features such as caching, speculative decoding, and quantization.
    4. Repeat each bucket over multiple rounds, and report the median and P95 rather than the single best run.

    Illustrative benchmarking script (pseudocode, expressing measurement logic only):

    1. # Pseudocode: measure TTFT and output TPS
    2. def bench(client, prompt, max_tokens, concurrency):
    3. results = []
    4. for _ in range(concurrency):
    5. t0 = now_ms()
    6. stream = client.stream(prompt, max_tokens=max_tokens)
    7. first = next(stream)
    8. ttft = now_ms() - t0
    9. n, t_start = 1, now_ms()
    10. for _ in stream:
    11. n += 1
    12. tps = n / ((now_ms() - t_start) / 1000.0)
    13. results.append((ttft, tps))
    14. return {
    15. "ttft_p50": percentile(results, 0.5, key=0),
    16. "tps_p50": percentile(results, 0.5, key=1),
    17. }

    Note that this code only defines “how to measure” and contains no vendor-specific interface. In practice, replace it with your project’s unified model invocation wrapper.

    4. Where High Throughput Comes From: General Technical Paths

    The high TPS observed in communities is usually not a single trick but a stack of mature techniques:

    • Speculative decoding: a small draft model plus large-model verification, increasing decoding parallelism while preserving the output distribution.
    • Continuous batching: request-level dynamic batching that significantly improves GPU utilization and global throughput.
    • Paged KV cache management: reducing memory fragmentation to support longer contexts and higher concurrency.
    • Prefix cache reuse: repeated prefixes such as system prompts and code context hit the cache, directly lowering TTFT.
    • Quantization and operator fusion: reducing bandwidth pressure within acceptable accuracy ranges.
    • MoE sparse activation: trading lower activated parameter counts for throughput, at the cost of higher memory usage and scheduling complexity.

    The engineering implication is clear: throughput optimization is essentially a trade-off between memory bandwidth and scheduling efficiency, and any benchmark should state these feature settings; otherwise the numbers are not comparable.

    5. Why Coding Scenarios Hit Peaks More Easily

    Code generation features strong structure, heavy prefix reuse, and predictable output fragments, which naturally align with prefix caching and speculative decoding, so it often shows higher TPS than general conversation. At the same time, coding tasks are more sensitive to TTFT—developers notice stalls once the wait for the first screen exceeds a few hundred milliseconds. Practical recommendations:

    • Make repository context and type definitions a stable prefix to maximize cache hits;
    • Use streaming output with incremental rendering, showing structure first and details later;
    • Split long tasks into segmented generation with result validation, avoiding one-off超长 output that raises tail latency.

    6. Deployment Recommendations: Treat Peaks as the Ceiling and P95 as the Commitment

    • Model selection: decide based on a matrix of “input length buckets × concurrency levels” rather than a single peak point.
    • Capacity planning: derive instance counts from global tokens/s and P95 latency, with headroom for bursts.
    • Cost evaluation: estimate per-request cost from the input/output token mix; cost grows faster as outputs get longer.
    • Observability: integrate logging services, monitoring and alerting, and distributed tracing to continuously collect TTFT, TPS, and error rates.
    • Architectural elasticity: use container platforms and message queues for peak shaving and asynchronous processing, moving non-real-time tasks off the critical path.

    For managed hosting, a common industry pattern combines model serving, object storage, logging, and monitoring/alerting. On Baidu AI Cloud, these capabilities are offered as general cloud product categories, making it convenient to run end-to-end validation against the metrics above.

    7. Conclusion

    Faced with claims of being “suspiciously fast,” the rational approach is to return to measurement itself: define metrics clearly, fix experimental variables, disclose acceleration settings, and report medians and tail latency. Only reproducible data can support real decisions on model selection, capacity planning, and cost control.