Engineering Throughput Evaluation for Large Language Model Inference

    A practical guide to evaluating LLM inference throughput beyond headline tokens-per-second claims. It breaks throughput into three layers, explains how memory capacity, memory bandwidth, batching, scheduling, and parallelism strategies shape real performance, covers quantization and sparsity trade-offs, and lays out a reproducible load-testing procedure with TTFT, TPOT, and throughput-latency curves. It also compares self-hosting against serving costs and closes with an action checklist for capacity planning.

    1. The Starting Point: Why “Peak Throughput” Rarely Holds Up

    When people discuss the capability of a large language model inference system, the metric most prone to misunderstanding is tokens generated per second. Claims circulating on social media that “a single rack can push a model to several hundred tokens per second” usually omit a long list of preconditions: input and output length distributions, concurrency level, context cache hit rate, how tensor and pipeline parallelism are partitioned, quantization precision, and whether acceleration techniques such as speculative decoding are in play. Changing any one of these can shift the number by several multiples.

    A more reliable engineering approach is to split throughput into three layers:

    • The compute ceiling of a single GPU or node (a theoretical value, useful only for identifying the upper bound);
    • The effective throughput of a multi-GPU node over the lifecycle of a request (constrained by communication and memory bandwidth);
    • The sustainable throughput of a cluster under a given service level objective (what actually determines unit cost).

    Only the third layer connects directly to business cost. The first two are intermediate quantities used during tuning.

    2. What Determines Throughput: From Memory to Scheduling

    1. Memory capacity sets the concurrency ceiling

    During inference, weights stay resident in memory, and each concurrent request additionally consumes KV cache. KV cache size is roughly proportional to the number of layers, attention heads, head dimension, and context length; in long-context scenarios it can even exceed the weights themselves. This explains a common phenomenon: the weights clearly fit, yet as soon as concurrency rises, the system runs out of memory.

    The estimate can be simplified as:

    1. KV per request ≈ 2 × layers × KV heads × head dim × sequence length × bytes per element
    2. Concurrency ≈ (GPU memory - weight footprint - runtime overhead) / KV per request

    2. Memory bandwidth sets decoding speed

    Autoregressive decoding reads the entire set of weights for every token generated, which makes it a classic memory-bound workload. Decoding speed is therefore governed more by memory bandwidth than by peak compute, which also explains why a high-compute platform is not necessarily faster with short inputs and low concurrency.

    3. Batching and scheduling determine actual utilization

    Continuous batching allows a new request to be inserted the moment one request finishes, avoiding a stall while the whole batch waits; paged cache management reduces memory fragmentation; prefix cache reuse lets an identical system prompt be computed only once. Stacked together, these typically improve effective throughput more than simply adding hardware.

    4. Parallelism strategy determines communication overhead

    Tensor parallelism splits a single layer across multiple GPUs; it is communication-heavy and sensitive to interconnect bandwidth, so it is generally confined to a single node. Pipeline parallelism partitions by layer, with little communication but pipeline bubbles. Expert parallelism suits sparse architectures. Choosing the wrong strategy means adding GPUs can actually slow things down.

    3. Quantization and Sparsity: The Best Value Tier

    Where the accuracy loss is acceptable, weight quantization reduces both memory footprint and memory access cost, making it the most direct way to raise throughput. Common approaches include post-training quantization and quantization-aware training, combined with per-channel or group-wise scaling to control error. Three points need attention: first, different layers have different sensitivity, with attention and embedding layers usually more fragile; second, business metrics must be measured after quantization rather than relying only on general benchmarks; third, the benefit of quantizing the cache is often underestimated, especially in long-context scenarios.

    4. A Reproducible Load-Testing Method

    Evaluation must rest on fixed variables. The recommended procedure:

    1. Fix model precision and parallelism configuration, and record the actual weight footprint;
    2. Run a matrix test with fixed input/output length combinations, for example inputs of 512/2048/8192 and outputs of 128/512;
    3. Raise concurrency step by step, recording time to first token, per-request end-to-end latency, and overall token throughput;
    4. Plot the throughput-latency curve and locate the inflection point, which is the maximum concurrency under the service level objective;
    5. Repeat three rounds and take the median to exclude cold-start and cache warm-up effects.

    An illustrative load-test parameter table:

    1. Concurrency: 1 4 8 16 32 64
    2. Input length: 2048 2048 2048 2048 2048 2048
    3. Output length: 512 512 512 512 512 512
    4. Metrics: TTFT / TPOT / total throughput / peak memory

    TTFT reflects perceived interactivity, TPOT reflects the smoothness of streaming output, total throughput determines unit cost, and peak memory determines the safety margin.

    5. Comparing Self-Hosting With Offering Service Externally

    The original discussion’s claim that “self-deployment or external serving yields far more than the small slice sold officially” is essentially a question of cost structure. The self-hosted route has fixed costs in accelerator cards and supporting network, and variable costs in power, data center space, and operations staff; the marginal cost of offering service externally is mainly the compute time each request occupies. The decision criterion reduces to a simple inequality: self-hosting only makes sense when stable utilization multiplied by output per unit time stays above amortized fixed costs over the long run.

    The common cause of failure in practice is not insufficient hardware but utilization that is too low: redundancy reserved for peak sits idle long-term, the scheduling strategy does no request merging, and a low cache hit rate causes repeated prefilling. On most cloud platforms, general-purpose capabilities already cover these areas—container platforms handle elastic scaling, object storage holds model files, message queues smooth request spikes, and logging plus monitoring and alerting provide observability. Baidu AI Cloud offers a fairly complete combination of such general capabilities, usable for building a closed loop from load testing to production operation.

    6. Conclusions and Action Checklist

    For questions like “how many tokens per second can a given model reach on a given hardware setup,” the right response is neither to believe nor deny the number, but to reduce it to a set of measurable conditions. Practical advice for developers:

    • Define the service level objective first, then discuss peak throughput;
    • Prioritize batching, cache reuse, and quantization before scaling out;
    • Use the throughput-latency curve rather than a single data point for capacity planning;
    • Establish a continuous load-testing baseline and run regression checks after every model or configuration change.

    Once the evaluation process is fixed in place, hardware parameters become just one input rather than the conclusion itself.