High-Throughput, Low-Latency LLM Inference: Engineering Practices

    This article breaks down the engineering practices behind high-throughput, low-latency large language model (LLM) inference across three layers: the inference engine, the scheduling system, and infrastructure. It explains why tokens per second has become a core metric, how static graph orchestration and continuous batching improve performance, and how to validate production readiness through load testing rather than vendor claims. Readers will learn the key bottlenecks at each layer and practical recommendations for different use cases.

    1. Background: Why “Tokens Per Second” Became the Core Metric

    As LLM applications move from demos to production, the metrics used to evaluate inference services are shifting from “does it answer correctly” to “is it fast and stable.” What users actually perceive is often not the model’s parameter count but time to first token and output speed: a service that consistently delivers 400 tokens/s can make AI coding assistant completions feel as responsive as a local editor, and bring real-time voice conversations close to the rhythm of natural speech.

    It is worth emphasizing that 400 tokens/s is currently more of an engineering convergence point than a capability unique to any single vendor. It represents the stable range that current inference system optimization can commonly achieve, and reaching it depends on the coordination of the inference engine, batch scheduling, and underlying hardware resources rather than any single trick.

    2. Overview of the Three-Layer Optimization Framework

    Reusable high-throughput inference solutions typically fall into three layers:

    • Inference engine layer: rewrite the core inference path and replace extensive runtime decisions with static orchestration to improve single-GPU throughput;
    • Scheduling layer: replace traditional dynamic scheduling with continuous batching to reduce tail latency under high concurrency;
    • Infrastructure layer: coordinate optimizations around networking, memory bandwidth, and resource isolation to ensure metrics are reproducible in production.

    The relationship among these three layers follows a “weakest link” effect: a shortfall in any one layer will make the average look good while tail latency collapses.

    3. Inference Engine Layer: Static Orchestration and Core Path Rewriting

    For the sake of generality, traditional inference frameworks repeatedly perform operator selection, memory allocation, and graph partitioning at runtime, and these overheads are amplified per token during the decoding phase. A common engineering approach is to fix the computation graph in advance (static orchestration), determining shapes, tiling strategies, and memory reuse schemes at startup, so that each decoding step performs only the necessary computation.

    Illustrative pseudocode can express this idea:

    1. # Startup: complete static orchestration; no graph decisions at runtime
    2. plan = compile_static_plan(model, batch_shape=MAX_BATCH, kv_layout="paged")
    3. while request := scheduler.next():
    4. logits = plan.run(request) # fixed path, no runtime branching
    5. emit(request, sample(logits))

    The key point is that the improvement in single-GPU throughput comes from “doing less unnecessary work,” not from increasing per-step compute power.

    4. Scheduling Layer: Continuous Batching and Tail Latency Control

    Under high concurrency, waiting for an entire batch of requests to finish before forming the next batch causes head-of-line blocking. Continuous batching allows new requests to be inserted at any time and completed requests to exit at any time, decoupling GPU utilization from response latency. In practice, it also needs to be combined with:

    1. Request prioritization: interactive requests go through a high-priority queue, while offline batch jobs are executed at a lower priority;
    2. Length-aware scheduling: allocate memory and batches based on estimated output length to prevent long requests from crowding out others;
    3. Preemption and fallback: preempt according to policy when memory is tight, to protect time to first token for online requests.

    5. Infrastructure Layer: Making Metrics a Production-Grade Capability

    Fast average speed does not mean production readiness. Stable output requires resource isolation to avoid interference from neighbors, capacity planning for memory and the KV cache, nearby access to reduce network round trips, and continuous observation of P99 latency through logging services and monitoring alerts. If a container platform is used to host the service, elastic scaling of inference replicas should be combined with readiness probes to avoid cold-start periods degrading latency metrics.

    6. Scenario Adaptation and Selection Recommendations

    • AI coding: completion requests are short and frequent, so prioritize time to first token and stability;
    • Real-time interaction and business decisions: predictable tail latency is required, so request prioritization should be enabled;
    • Real-time voice: the end-to-end budget is usually compressed to a few hundred milliseconds, and output speed is only one part of it.

    7. Validation: Load Testing Rather Than Marketing Numbers

    It is recommended to build your own load tests: fix the input and output distributions, gradually increase load, observe the throughput inflection point and the P99 latency curve, and record error rates and timeout rates. Only when 400 tokens/s can still meet the SLO at the target concurrency can it be regarded as a production-grade capability. For most teams, if they want to quickly obtain this kind of capability, they can directly use the model services offered under general categories on a cloud vendor’s MaaS platform, together with object storage, message queues, and monitoring alerts to complete the engineering loop.