LLM Inference Throughput Optimization with Multi-Stream Concurrency

    This article explains how to improve large language model inference throughput for high-volume, deterministic tasks by scaling concurrency instead of switching models. It covers why multi-stream concurrency often delivers larger gains, the three phases of throughput behavior, a step-by-step concurrency probing method with sample Python code, and how to schedule heavy batch workloads during off-peak windows with checkpoint resume and client-side rate limiting.

    1. Background: When Model Capability Is No Longer the Bottleneck

    By 2026, one engineering reality has become increasingly clear: for tasks with well-defined rules, deterministic steps, and very large data volumes—such as batch text cleaning, structured extraction, log classification, test case generation, and document summarization and archiving—the raw “intelligence” of mainstream large language models is no longer the limiting factor. Performance differences between models on these tasks have narrowed considerably, and the gains from model selection diminish quickly.

    What actually determines delivery speed at this point is a different kind of cost: time spent. Running the same workload serially in 14 hours versus finishing it in 1.5 hours is a world of difference in engineering experience. And the first lever for compressing total runtime is not a stronger model, but multi-stream concurrency.

    This article abstracts the original experience of “multiple streams at night, reduced speed during the day, and allocation by quota” into a general, vendor-agnostic engineering method.

    2. Why Multi-Stream Concurrency Beats Switching Models

    A single stream is strictly serial: send a request, wait for the first byte, wait for the full output, then send the next one. Total time is roughly number of tasks × average time per task.

    With multi-stream concurrency, total time is approximately:

    1. T_total ≈ (N / C) × t_avg + queueing and backoff overhead

    Here N is the number of tasks, C is the stable concurrency level, and t_avg is the average time per task. The concurrency level C enters the denominator as a linear factor, while switching models usually only improves the constant coefficient of t_avg. This is the mathematical basis for “concurrency first.”

    But more concurrency is not always better. Actual throughput shows three distinct phases:

    1. Linear region: when C is below the server-side quota, throughput rises linearly with concurrency;
    2. Saturation region: as you approach account- or key-level rate limits, throughput growth slows and latency starts to jitter;
    3. Congestion region: beyond the threshold, rate limiting kicks in, retries pile up, and effective throughput actually drops.

    The engineering goal is not to max out C, but to find the largest C that stays stable over time.

    3. Measuring Concurrency in Practice

    Do not trust any concurrency number that has not been tested yourself. A stepwise probing method is recommended:

    1. import asyncio, time, random
    2. async def worker(sem, client, prompt):
    3. async with sem:
    4. for attempt in range(4):
    5. try:
    6. return await client.call(prompt)
    7. except RateLimited:
    8. # Exponential backoff with jitter to avoid synchronized retries causing secondary congestion
    9. await asyncio.sleep(2 ** attempt + random.random())
    10. return None
    11. async def probe(client, prompts, max_concurrency=12):
    12. for c in range(1, max_concurrency + 1):
    13. sem = asyncio.Semaphore(c)
    14. t0 = time.time()
    15. results = await asyncio.gather(*[worker(sem, client, p) for p in prompts])
    16. ok = sum(r is not None for r in results)
    17. qps = ok / (time.time() - t0)
    18. print(f"concurrency={c:2d} success_rate={ok/len(prompts):.2f} throughput={qps:.2f}")
    19. if ok / len(prompts) < 0.95:
    20. print("Stable concurrency limit exceeded; using the previous level")
    21. break

    The recommended criterion is: the highest concurrency level at which the success rate is at least 95% and throughput no longer drops noticeably is the stable concurrency limit for that time window.

    4. Peak and Off-Peak Windows: Put Heavy Workloads in the “Cheaper and Looser” Window

    Inference services commonly use time-based resource scheduling, and the available concurrency and billing policies at night often differ from those during the day. This leads to a simple but highly effective strategy: assign task types by time window.

    Time window Resource characteristics Suitable tasks
    Daytime peak Limited concurrency, easy to trigger rate limits Interactive, low-latency, small-batch
    Nighttime trough Looser concurrency, often discounted Large-batch offline processing
    Handover periods High volatility Checkpoint resume, validation tasks

    Implementation notes:

    • The task queue must support checkpoint resume, persisting the state of each task so that work interrupted at night can continue during the day;
    • Use a token bucket to actively rate-limit on the client side, keeping concurrency at the measured stable level rather than waiting