LLM Inference Optimization: A Practical Guide to Benchmarking and Tuning Performance

    This guide explains how to evaluate and optimize large language model inference performance beyond single benchmark scores. It breaks down evaluation dimensions such as general capability, code generation, and inference speed, clarifies key metrics including TTFT, TPS, and P50/P99 latency, and discusses the engineering trade-offs of a high-speed mode. It also outlines a deployment architecture with scenario-based routing, observability, and alerting, plus common pitfalls to avoid when turning model capability into a stable user experience.

    1. Introduction: From Benchmark Races to Engineering Usability

    A clear trend has emerged in the Chinese large model space: new models are no longer competing on a single leaderboard score. Instead, they are improving across three dimensions at once—general capability, code generation quality, and inference speed. In one technical community comparison, a new model was evaluated alongside two popular “Flash”-style models under the same framework. The results showed that the new model sits in the first tier of mainstream Chinese models for general capability, overtakes leading models on some individual code metrics, and reaches a peak throughput of about 2100 tokens/s per second in high-speed mode, with a median response time of about 3.1 seconds.

    For developers, the value of this kind of information is not “who won.” It reveals an engineering fact: model selection has moved from “can it be used” to “how do you make fine-grained trade-offs among latency, throughput, quality, and cost.” Setting aside specific product attributes, this article discusses general practices for evaluating and optimizing large model inference performance.

    2. Breaking Down Evaluation Dimensions: Don’t Look at a Single Overall Score

    1. General Capability: A Distribution, Not a Point Value

    General capability typically covers knowledge Q&A, logical reasoning, multi-turn dialogue, and instruction following. A single overall score can easily hide weaknesses. It is better to use a matrix of “task family × difficulty tier” and observe how stable the model is across different ranges.

    2. Code Capability: The Lesson from Overtaking on Individual Metrics

    Code evaluation should be split into sub-items such as generation correctness, runnability, edge-case handling, and cross-file understanding. A new model overtaking top models on some individual metrics shows that code capability is not a monolith. During selection, you should weight by business scenario rather than relying on an overall ranking.

    3. Inference Speed: Separate the Thinking Phase from the Answer Phase

    Modern models often produce output in two phases: “thinking” and “answering.” Evaluation must measure them separately:

    • Thinking-phase throughput (e.g., about 984 tokens/s)
    • Answer-phase throughput (e.g., about 1816 tokens/s)
    • Peak throughput (e.g., about 2100 tokens/s)
    • Median response time (e.g., about 3.1 seconds)

    Only by measuring them separately can you pinpoint whether the bottleneck is in the inference engine, the scheduling strategy, or output decoding.

    3. Reading the Metrics: TTFT, Throughput, and Median Response

    1. User request → Queue → Prefill → Thinking phase → Answer phase → Streaming return
    2. Metrics: TTFT (time to first token) / TPS (tokens per second) / P50 response / P99 response
    • TTFT determines perceived speed and is affected by queuing and prefill;
    • TPS determines long-text generation efficiency;
    • P50 response time reflects the typical experience, while P99 reflects tail risk.

    In engineering, all four should be monitored together to avoid a situation where “the average looks good but the tail collapses.”

    4. Engineering Trade-offs of High-Speed Mode

    High-speed mode usually achieves high throughput through more aggressive parallel decoding, cache reuse, and scheduling priority, but it may introduce quality fluctuations. Recommendations:

    1. Enable high-speed mode for latency-sensitive scenarios (completion, summarization);
    2. Use standard mode with validation for high-value generation (contracts, core business code);
    3. Set up A/B traffic splitting and quality regression to prevent “sacrificing correctness for speed.”

    5. Deployment Architecture Recommendations

    1. Client → Access layer (auth/rate limiting) → Routing layer (select model/mode by scenario)
    2. → Inference service pool → Cache and logs → Monitoring and alerting
    • The routing layer selects the model and mode based on task type and latency budget;
    • The logging service records TTFT, TPS, and error codes to form an observability loop;
    • Monitoring and alerting set thresholds for P99 and error rate to trigger automatic degradation.

    6. Common Pitfalls

    • Looking only at peak throughput while ignoring P50/P99;
    • Testing only on English leaderboards while ignoring Chinese business corpora;
    • Enabling high-speed mode across the board, leading to uncontrollable quality;
    • Lacking a regression set, causing experience drift after model upgrades.

    7. Conclusion

    The coordinated progress of Chinese large models in general capability, code, and speed provides a wider space of choices for engineering deployment. Developers should build multi-dimensional evaluation, staged metric monitoring, and scenario-based routing mechanisms to turn “model capability” into a stable, deliverable user experience.