How to Speed Up Batch LLM API Calls with Concurrency
This article explains why throughput engineering matters more than model selection for large batch inference workloads. It covers the linear gains from multi-way concurrency, server-side rate limits and time-of-day differences, quota planning, the real cost structure behind cache discounts, local memory and thermal bottlenecks, and a minimal client-side concurrency skeleton with rate limiting, backoff, idempotency, and observability. A final checklist helps you apply the approach to any standard HTTP-compatible LLM service.
1. Background: When Model Quality Levels Off, the Bottleneck Becomes Time
By the second half of 2026, one engineering reality has become increasingly clear: for batch tasks with well-defined rules and deterministic steps that still require massive repeated computation, mainstream large models have reached a “good enough” quality range. The differences between vendors on these tasks are shrinking fast, so comparing quality metrics alone yields diminishing returns during selection.
What actually determines delivery speed is no longer the quality of a single call, but three things: how many requests you can launch per unit of time, the average latency of each request, and how long you can keep running under a budget constraint. In other words, the focus of engineering optimization has shifted from “model selection” to “throughput engineering.”
Note that this article does not discuss any specific vendor or product. Instead, it abstracts the original experience into a general methodology for speeding up batch inference, applicable to any LLM service that exposes a standard HTTP interface.
2. Core Conclusion: Concurrency Offers the Best Speed-to-Cost Ratio
With total workload fixed, total time is approximately:
total time ≈ total tasks × average latency per task / effective concurrency
This formula explains a frequently overlooked fact: the gains from higher concurrency are linear, while the gains from a lower unit price are often only local. Raising concurrency from 1 to 6 cuts total duration to one sixth, while total token consumption and total cost stay roughly unchanged (affected only by retries and failed-call overhead).
The priority should therefore be: exhaust concurrency first, then discuss unit price and caching optimizations.
3. Real Constraints on Concurrency: Server Rate Limits and Time-of-Day Differences
The concurrency ceiling is not decided by the client alone; it is the outcome of a three-way interaction: server-side quotas and rate-limiting policies, client hardware resources, and the latency distribution of the tasks themselves.
The patterns commonly observed in practice are:
- Concurrency allowances are looser at night, where a high number of parallel streams can be sustained stably;
- During daytime peak hours, requests are gradually throttled, and stable concurrency falls back to a lower level, though still several times faster than a single stream;
- Peak and off-peak pricing policies vary widely across providers; some bill by time of day, while others charge a flat rate around the clock.
From this, a practical scheduling strategy follows: pack deferrable batch tasks into off-peak windows, and run interactive, latency-sensitive tasks at peak hours with lower concurrency. This is not a trick but a reallocation of resources and cost.
4. Quota Planning: Maximizing Effective Daily Machine Hours
A reusable approach is a “dual-track” setup: during the day, use a flat-rate channel with moderate but stable concurrency for online demand; at night, switch to a channel with a higher concurrency allowance and periodic discounts to run offline batch jobs.
An illustrative capacity calculation looks like this:
# Pseudocode: derive daily effective machine hours from available quotadaily_budget_tokens = 2.5e9 # daytime channel weekly quota converted to dailynight_budget_tokens = 4.2e9 # nighttime channel weekly quota converted to dailydef plan(avg_tokens_per_task, day_hours, night_hours):day_tasks = daily_budget_tokens / avg_tokens_per_tasknight_tasks = night_budget_tokens / avg_tokens_per_taskreturn {"day_capacity_tasks": int(day_tasks),"night_capacity_tasks": int(night_tasks),"effective_machine_hours": day_hours + night_hours,}
The specific numbers are not the point; the method is: first measure average token consumption per task, then divide the quota by it to get the task ceiling, and finally use concurrency to check whether there is enough time. Quota determines “how much can be done,” and concurrency determines “how fast it gets done”; both must be validated together.
5. Cost Structure: Cache Hits Are Not a Cure-All
A conclusion repeatedly confirmed on large samples is that once total spending reaches a substantial scale, the cost shares of uncached input, cached input, and output can end up close to evenly split. This means optimizations centered too heavily on “raising the cache hit rate” tend to have their benefits overestimated.
More notably, after the output unit price increases, total cost can still be higher than before the change even when input-side cache discounts are considerable. So when building a cost model, weight by the real distribution rather than looking at a single discount:
total cost = cached input volume × price₁ + uncached input volume × price₂ + output volume × price₃ + retry overhead
Engineering recommendation: prioritize shrinking output length (structured output, trimmed fields, avoiding lengthy explanations), and only then optimize input reuse. Output-side optimization usually delivers linear and predictable gains.
6. The Underrated Bottleneck: Local Memory and Cooling
Under high-concurrency load testing, the real ceiling is often not on the server side but locally. The typical pattern: memory usage spikes first, then CPU utilization enters a fully loaded range, the fan runs at high speed continuously, and thermal throttling eventually reduces overall throughput.
An empirical capacity correspondence (for order-of-magnitude reference only; measure your own):
| Local memory | Recommended stable concurrency | Peak concurrency |
|---|---|---|
| 64 GB | ~50 streams | ~60 streams |
| 96 GB | ~80 streams | ~90 streams |
Another counterintuitive observation: raising memory frequency generates more heat under high concurrency, which can trigger more severe throttling and lower overall speed. This shows the tuning goal is not a single-point peak but sustained stable throughput over long periods.
7. Implementation: A Minimal Client-Side Concurrency Skeleton
Multi-way concurrency is not just throwing a loop into a thread pool; it needs rate limiting, backoff, idempotency, and observability:
import asyncio, randomsem = asyncio.Semaphore(50) # safe concurrency determined by local measurementasync def call_one(client, payload, max_retry=3):async with sem:for i in range(max_retry):try:return await client.post(payload)except Exception:# exponential backoff + jitter to avoid a retry stormawait asyncio.sleep(2 ** i + random.random())raise RuntimeError("task failed after retries")async def run_all(client, tasks):return await asyncio.gather(*(call_one(client, t) for t in tasks))
Four supporting engineering constraints:
- Adaptive slowdown: lower global concurrency in response to 429/503 responses, rather than retrying individual tasks;
- Idempotency keys: generate a stable identifier for each task to avoid duplicate billing and duplicate writes caused by retries;
- Checkpoint resume: persist completed tasks so an interrupted run can recover from a checkpoint;
- Metrics collection: record per-stream latency, failure rate, and token distribution, and tune with data rather than intuition.
8. Deployment Checklist
- Can the tasks be split into independent items with no ordering dependencies? This is the prerequisite for concurrency;
- Have you measured the sustainable concurrency ceiling for local memory and cooling, with a safety margin?
- Have you built a cost model based on the real token distribution, rather than focusing only on cache discounts?
- Have you scheduled offline batch jobs in windows with more generous concurrency allowances?
- Do you have all four capabilities: backoff, idempotency, resume, and monitoring?
In short, in a stage where model quality is converging, the competitiveness of batch tasks comes from throughput engineering: trade concurrency for time, trade time windows for quota, trade output compression for cost, and trade measurement for stability. This approach is independent of any specific provider and can be applied directly to batch inference on any standard interface.
