Large-Scale LLM Batch Processing: Balancing Concurrency, Token Costs, and Local Resources
When lightweight models are capable enough for repetitive, well-defined workloads, choosing a batch-processing setup comes down to more than model quality. This guide explains how to estimate token costs, find a sustainable concurrency level, schedule work around peak and off-peak pricing, and account for the limits of your local machine.
1. The Real Decision Once Model Capabilities Converge
By 2026, the capabilities of many mainstream lightweight models—often grouped into a “Flash” tier—have become similar for well-defined, repetitive, high-volume tasks. For batch classification, structured extraction, bulk code rewrites, and structured data generation, many lightweight models are already good enough.
When quality no longer determines the choice, the calculation shifts to the combined cost of time and money. This article does not recommend a specific provider. Instead, it presents a general approach that can be applied to different APIs and subscription services.
2. Use Concurrency to Reduce Total Runtime
Running requests sequentially is one of the biggest sources of wasted time in batch processing. Suppose a job requires 30,000 results and each request takes an average of 30 seconds. Processing them one at a time would take 250 hours. At a steady concurrency of 50, the theoretical runtime falls to about five hours.
That is the core idea behind parallel processing: the price per request stays the same, while concurrency can reduce total runtime roughly in proportion to the number of requests running at once.
Concurrency is not free, however. It is constrained by three factors:
- Provider limits: Maximum concurrency and rate-limiting policies.
- Pricing: Peak and off-peak rates, discounts for cached inputs, and output-token prices.
- Local resources: The memory, CPU, and network capacity required to schedule requests.
3. Provider Limits: Sustainable Concurrency Matters
Rate limits vary considerably between providers. In practice, pay attention to three indicators:
- Advertised concurrency: The limit shown in documentation may be much higher than the level you can sustain in real workloads.
- Peak-hour throttling: During busy periods, the stable concurrency available to you may fall to 60–70% of the advertised limit. Dynamic throttling is common.
- Operational stability: A stable concurrency level is one that can run for an extended period without repeated 429 errors or timeout-driven retry storms.
A useful general rule is not to push all the way to the advertised limit. Leaving roughly 20% headroom can increase overall throughput because failures and retries may consume more time than running at slightly lower concurrency.
4. Understand the Full Token Cost
When estimating costs, it is easy to focus too much on discounts for cached input tokens. For large batches with mostly unique inputs, cache hit rates are naturally low, and the cost distribution can look quite different.
In large-scale tests, the costs of cached input, uncached input, and output can be close to a 1
1 ratio. This means output tokens may account for far more of the bill than expected. Output tokens are also the part that providers almost never discount.
Two principles follow:
- Compare the effective total cost, not just the most attractive discount on one component.
- When pricing changes, check whether output-token prices have also fallen. If the output price remains unchanged—for example, at a rate of several currency units per million tokens—lower input prices alone may not reduce the overall cost and could amount to a price increase in practice.
A simple estimate is:
Estimated total cost ≈ N × (P_hit × T_hit + P_miss × T_miss + P_out × T_out)Where:N = number of requestsP_* = unit price for each token categoryT_* = average number of tokens in each category per request
Before launching the full job, run a sample of 100 requests and measure the actual token distribution across the three categories. Extrapolating from those results can help prevent unexpected budget overruns.
5. Plan Around Peak and Off-Peak Pricing
Some providers offer lower prices or more generous concurrency limits during off-peak hours. This can be especially useful for subscription users. One practical approach is to split work between two service tiers:
- During the day: Use tier A, which is not subject to peak/off-peak pricing changes and offers moderate but stable concurrency. Run batches while continuing development work.
- At night: Switch to tier B, with lower off-peak pricing and higher concurrency, for unattended processing.
- In the morning: Review the overnight results and continue with tier A during the day.
A schedule of eight hours on tier A and 14 hours on tier B can bring weekly token usage close to the allowance of some high-end subscriptions, which may be in the billions of tokens. The exact figures are less important than the method: measure your average daily token consumption, then choose an allowance that you can use efficiently without regularly leaving a large amount unused.
For pay-as-you-go API access, consider reserving it for situations where a subscription allowance has run out and the job is extremely time-sensitive. A high-concurrency run—for example, 50 concurrent requests for 12 hours to produce more than 30,000 results—can generate a four-figure bill for a single day. That makes pay-as-you-go access better suited to emergency use than as a default channel.
6. Local Hardware Can Be the Bottleneck
Even when a provider advertises concurrency in the thousands, your local machine may be the actual limit. Every in-flight request uses resources:
- Memory: Connection buffers, response streams, and temporarily stored results. Dozens of concurrent requests can consume tens of gigabytes.
- CPU: TLS handshakes, JSON serialization, retry handling, and result validation can all be CPU-intensive.
- Network: The number of long-lived connections is constrained by the file descriptor limit.
As a rough reference, on a thin-and-light laptop with 64 GB of memory, 50 concurrent requests may push memory usage close to 90%, while CPU usage fluctuates between 70% and 100% and the cooling fans run at full speed. A practical guideline is around 50 concurrent requests on a 64 GB machine, with an upper limit of about 60. A 96 GB machine may handle roughly 80.
One counterintuitive point: higher-frequency memory can produce more heat. Under sustained, high-concurrency workloads, the resulting system heat may cause throttling and reduce throughput. For this kind of workload, memory capacity is more important than memory frequency.
Engineering measures that can help include using asynchronous I/O instead of synchronous blocking calls, limiting the number of connections per process, writing results to disk in batches, and moving the scheduler to a desktop or cloud host with more memory when necessary. The local machine can then be used just to start jobs and inspect results.
7. A Practical Selection Checklist
Use this decision sequence to choose a setup:
- Identify the workload: For well-defined, repetitive, high-volume tasks, a lightweight model may be sufficient.
- Measure the effective cost: Use a small sample to estimate the costs of cached inputs, uncached inputs, and output. Watch for pricing changes that reduce input prices but leave output prices unchanged.
- Choose a schedule: If peak and off-peak pricing is available, split work between daytime and overnight runs. Otherwise, use the available tier as your main option.
- Set concurrency based on local resources: Memory and thermal limits determine how many requests your machine can handle. Leave roughly 20% headroom.
- Prefer subscriptions, with pay-as-you-go as a backup: Reserve usage-based API access for times when subscription limits are exhausted and deadlines are tight.
As model capabilities converge, the practical advantage comes from balancing concurrency, billing, and hardware. This approach is not tied to a particular provider and can be applied to batch workloads across different APIs.
