LLM Batch Inference: Concurrency and Cost Practices

    This article explains how to improve throughput and control spending in large-scale LLM batch inference. It covers why effective concurrency matters more than raw model quality, how to schedule workloads across peak and off-peak windows, how local hardware limits real throughput, how to estimate total token costs, and how to combine quota-based and pay-as-you-go billing. A practical checklist is included for production rollouts.

    1. Background: As Model Quality Converges, Throughput Becomes the Differentiator

    A clear engineering trend has emerged in 2026: for tasks that are rule-driven, involve simple single-step judgments, and run at very large sample volumes—such as batch text classification, structured extraction, format conversion, batch scoring, and batch validation—the per-item output quality of mainstream LLMs has become highly comparable. The remaining differences show up mainly in stability, rate-limiting policies, and billing models rather than in capability gaps.

    This shifts the selection logic. We used to ask “which model is smarter”; now we ask “given the same budget and the same machine, which one finishes the full dataset faster.” Two accounts have to be balanced at the same time:

    • Quality account: whether each result meets the business threshold, and whether a second validation pass is needed.
    • Time account: whether the full workload can finish within an acceptable time window.

    When the quality account is a wash, the time account becomes decisive. And the first lever for shortening total runtime is not a stronger model—it is higher effective concurrency.

    2. Why Concurrency Is the First Lever

    Assume an average single request takes t, the total number of tasks is N, and serial execution takes roughly N×t. With a stable concurrency of C, the ideal total runtime is approximately N×t/C. The key word here is “stable”: not how many requests you can fire in a burst, but how many you can sustain across the entire task window without being throttled or forced to back off by a rising error rate.

    A practical definition of effective concurrency:

    1. Effective concurrency C_eff = stable concurrency × success rate × (1 - retry amplification factor)

    Many teams only look at the first term. During peak hours, a large share of requests come back throttled or time out, retries amplify the load, and measured throughput ends up far below the theoretical value. Capacity evaluation must therefore be based on peak-hour measurements, not on the peak experience of an idle overnight window.

    3. Time-of-Day Differences and Scheduling Strategy

    Inference services commonly apply differentiated peak/off-peak policies: concurrency and quotas are relaxed during idle overnight hours and tightened during daytime peaks. This directly shapes scheduling design:

    1. Tiered queues: split tasks by deadline and business value into real-time, near-real-time, and offline queues. Large offline batches should be scheduled into overnight windows first.
    2. Day/night relay: during the day, use a channel that is not peak-sensitive—medium concurrency but stable—for online and near-real-time work; at night, switch to a high-concurrency channel to drain the offline backlog, rotating machines and budget across 24 hours.
    3. Token-bucket rate limiting: throttle proactively on the client side instead of treating server-side throttling as a feedback signal, which reduces wasted retries.

    A sketch of the client-side scheduler:

    1. # Pseudocode: dual day/night channels + proactive rate limiting
    2. def pick_channel(now, queue):
    3. if queue.kind == "offline" and is_night(now):
    4. return high_concurrency_channel # high concurrency at night
    5. return stable_channel # stable channel during the day
    6. async def run_batch(tasks):
    7. sem = asyncio.Semaphore(pick_limit(tasks))
    8. async def one(t):
    9. async with sem:
    10. return await call_with_retry(t, max_retry=2, backoff="jitter")
    11. return await asyncio.gather(*[one(t) for t in tasks])

    One point deserves emphasis: retries must use exponential backoff with jitter. Otherwise, throttling scenarios produce synchronized bursts that push usable throughput even lower.

    4. Local Hardware Is the Real Ceiling

    An often-overlooked fact: the bottleneck in high-concurrency batch inference is frequently not server-side quota but local resources on the client. Taking a single machine with multiple processes or coroutines as an example, there are three main constraints:

    • Memory: every concurrent context holds request bodies, response buffers, and intermediate serialization state. Memory often saturates before CPU does, and once swapping kicks in, throughput drops off a cliff.
    • CPU: JSON encoding/decoding, TLS handshakes, logging, and metrics collection all consume cores. Sustained high CPU load at high concurrency causes scheduling jitter.
    • Heat and throttling: laptops and thin devices throttle under sustained load, creating a “slower the longer it runs” feedback loop. Raising memory frequency only adds heat and further compresses sustainable concurrency.

    Capacity planning should therefore produce an empirical range rather than a single number: for example, keeping concurrency around 50 on a 64GB machine is reasonably safe, while a 96GB machine can push toward roughly 80, with 15%–20% headroom reserved for the OS and monitoring processes. The check is simple: if memory usage stays above 85% for long stretches, CPU is pinned at the top for extended periods, or the device is continuously hot and throttling, lower the concurrency.

    5. Cost Model: Don’t Fixate on Cache Hits

    Batch workloads usually contain many repeated prefixes (the same system prompt, the same specification document), so the price of cached input looks extremely low and tends to attract disproportionate attention. In real measurements at large sample sizes, however, a bill typically has three parts: cached input, uncached input, and output. When output volume is large, the output price often contributes as much to total cost as the input side, sometimes more.

    A more robust estimate:

    1. Total cost ≈ cached input × P_hit + uncached input × P_miss + output × P_out + retry overhead

    Practical recommendations:

    • Calibrate on a small sample first: run 1%–2% of the data to get the real token distribution, then extrapolate to the full volume; the error is usually manageable.
    • Budget for retry overhead; during heavy throttling, actual cost runs higher than the theoretical figure.
    • Compressing output length (structured output, field trimming, limiting explanatory text) usually saves more than optimizing input.
    • Normalize and sort stable prefixes to improve prefix reuse, but don’t sacrifice readability and maintainability for it.

    6. Hybrid Orchestration of Quota-Based and Pay-As-You-Go Billing

    When an organization already holds a recurring subscription quota, the most economical approach is to orchestrate different billing models into the same pipeline rather than choosing one:

    1. Consume the recurring quota first, placing large offline batches on the channel with ample quota.
    2. When quota runs low or peak-hour throttling appears, automatically fall back to the pay-as-you-go channel as a safety net.
    3. Put a unified abstraction layer in front of the channels so business code stays unaware of the specific backend.
    1. Tasks -> routing layer -> [quota channel | pay-as-you-go channel | local small-model preprocessing]
    2. ↑ decisions based on remaining quota, time of day, throttling state

    The routing layer needs to expose three observable metrics: remaining quota, current throttling state, and effective throughput per unit time. Only when all three feed into monitoring and alerting can the scheduling policy converge automatically.

    7. Production Checklist

    • Calibrate stable concurrency with peak-hour data, not overnight data.
    • Define separate day and night concurrency limits, and put them in configuration rather than hard-coding them.
    • Combine proactive client-side rate limiting with exponential-backoff retries to avoid retry storms.
    • Monitor local memory, CPU, and temperature; lower concurrency as soon as any threshold trips.
    • Calibrate the three token cost categories on a small sample, and optimize the output side first.
    • Build automatic routing between quota and pay-as-you-go to avoid wasted quota or overspending.
    • Keep result validation and sampled review in place so throughput gains don’t mask quality regressions.

    8. Conclusion

    As model capabilities flatten out, competitiveness in batch inference comes from engineering: stable concurrency, time-of-day scheduling, local capacity planning, and hybrid billing orchestration. Treating effective concurrency as the core metric, with output cost and local resource headroom as constraints, is what delivers the shortest task completion time under real limits on both budget and hardware.