LLM Batch Processing: Concurrency Strategies and Cost Optimization

    Efficient LLM batch processing depends on more than model capability. This article examines time-based concurrency scheduling, token billing and cache costs, local hardware constraints, and multi-provider routing. It explains how to balance throughput, resource usage, and API spending while preserving capacity for both large batch workloads and occasional interactive tasks.

    As large language models become more capable, leading models increasingly deliver comparable results on batch tasks that combine simple rules with large volumes of work. Once several models meet the business requirements, differences in baseline capability become less important than the cost of completing the workload.

    Time is a major part of that calculation. Long processing runs affect delivery schedules and overall project costs, even when token prices appear attractive.

    This article explores four practical areas of optimization: concurrent request scheduling, token billing, local hardware bottlenecks, and routing across multiple providers.

    1. Concurrent Request Scheduling: The Main Lever for Reducing Processing Time

    For large volumes of rule-based data, sending requests sequentially can make processing unnecessarily slow. Running multiple requests concurrently is often the most direct way to reduce total execution time.

    However, usable concurrency depends on each provider’s server-side scheduling and rate limits. It may also vary by time of day.

    Peak and Off-Peak Concurrency

    Many cloud providers impose explicit or implicit limits on concurrent API requests. During overnight periods with lower demand, spare capacity may allow some lightweight, Flash-class models to sustain around 10 concurrent requests. During daytime peaks, platform-wide limits may reduce that figure to six or seven.

    Under comparable per-request processing conditions, six or seven concurrent requests can still provide roughly six to seven times the throughput of sequential execution. These figures are workload- and provider-specific examples, not guaranteed service levels.

    Designing a Hybrid Schedule

    A hybrid scheduling strategy can take advantage of differences between providers and operating hours.

    For example, during the working day, a batch system might use an API that reliably supports about five concurrent requests and has no peak versus off-peak pricing difference. After working hours, it could switch to another service with stronger overnight concurrency or an applicable off-peak capacity allowance.

    With task queues and scheduled switching, a processing plan could combine an eight-hour daytime window with a 14-hour overnight window. This approach makes better use of available subscription quotas and reduces the risk of exhausting a single provider’s allocation too early.

    Any off-peak pricing or additional capacity should be treated as a provider-specific offering rather than a generally available API feature.

    2. Understanding Token Billing: Cache Hits and Output Costs

    API cost optimization often focuses heavily on cached input tokens. Caching can reduce spending, but it does not necessarily dominate the economics of a large batch workload.

    LLM API billing commonly separates usage into three categories:

    • Uncached input tokens
    • Cached input tokens
    • Output tokens

    In the illustrative large-scale test or production workload described here, total spending of approximately RMB 1,800 could break down into roughly equal costs across these three categories—a ratio close to 1:1:1. This is an example of a workload’s billing composition, not a universal pattern.

    The reason is that output tokens can cost substantially more than input tokens. An illustrative output price might be RMB 4 per million tokens. Even when caching significantly reduces input charges, generating long responses or detailed structured output can leave output tokens responsible for a substantial share of the bill.

    The practical implication is to examine the full billing breakdown rather than optimizing cache hits in isolation.

    Instead of sacrificing prompt flexibility simply to accommodate caching, focus on reducing unnecessary output. Strict JSON Schema constraints or system instructions that limit response length can help remove redundant text while retaining the information the task requires.

    3. Local Hardware Bottlenecks: The Hidden Ceiling on Concurrency

    A provider’s API gateway may theoretically support a very large number of simultaneous connections—for example, 2,500—but that does not mean a local client can handle the same workload efficiently.

    At 50 concurrent requests or more, the machine running the batch process may become the limiting factor.

    Memory and CPU Pressure

    Maintaining concurrent connections, parsing streamed responses, and tracking request context all consume local resources.

    In the workload example described here, a portable development machine with 64 GB of LPDDR5x memory could reach approximately 88% memory utilization while running 50 concurrent requests. CPU utilization could fluctuate between 70% and 100%, with fans running at full speed and little resource headroom remaining.

    For that setup, around 50 concurrent requests was considered a practical operating threshold, with approximately 60 representing an upper limit. Stable operation at 80–90 concurrent requests called for a 96 GB memory configuration.

    These observations should be understood as characteristics of the particular client workload and hardware environment, not fixed concurrency limits for every machine with the same amount of RAM.

    Memory Speed Versus Cooling

    Increasing memory speed—for example, from 7,467 MHz to 9,600 MHz—may improve available memory bandwidth. However, higher-speed memory can also increase heat under sustained concurrent workloads.

    If the system responds by thermally throttling, the higher nominal speed may not translate into better sustained performance or stability. For a batch-processing environment, effective cooling can therefore matter more than memory frequency alone.

    The following Python pseudocode illustrates resource monitoring and an intended dynamic concurrency adjustment:

    1. import psutil
    2. import asyncio
    3. import time
    4. class DynamicConcurrencyManager:
    5. def __init__(self, max_concurrency=50):
    6. self.max_concurrency = max_concurrency
    7. self.semaphore = asyncio.Semaphore(self.max_concurrency)
    8. async def monitor_and_adjust(self):
    9. """Monitor memory and CPU usage and adjust concurrency."""
    10. while True:
    11. mem = psutil.virtual_memory()
    12. cpu = psutil.cpu_percent(interval=1)
    13. # Reduce concurrency when memory exceeds 85% or CPU exceeds 90%.
    14. if mem.percent > 85 or cpu > 90:
    15. if self.max_concurrency > 10:
    16. self.max_concurrency -= 5
    17. print(f"Resource pressure: concurrency reduced to {self.max_concurrency}")
    18. elif mem.percent < 60 and cpu < 70:
    19. if self.max_concurrency < 50:
    20. self.max_concurrency += 2
    21. print(f"Resources available: concurrency increased to {self.max_concurrency}")
    22. self.semaphore = asyncio.Semaphore(self.max_concurrency)
    23. await asyncio.sleep(10) # Check every 10 seconds.
    24. async def process_task(self, task_id):
    25. async with self.semaphore:
    26. # Execute the API request.
    27. print(f"Processing task {task_id}")
    28. await asyncio.sleep(1)

    This example is conceptual pseudocode rather than a production-ready concurrency controller.

    4. Overall Cost Control: Subscriptions and Multi-Provider Routing

    A single access channel may not provide the best combination of cost, throughput, and quota availability for every task. Routing workloads across multiple providers or service channels can offer more flexibility.

    Combining High-Quota Subscription Plans

    For organizations or individuals with recurring batch workloads, a high-tier subscription can be more economical than usage-based billing, where the subscription explicitly covers the required API workload.

    Some plans may provide weekly allowances measured in billions of tokens. Such quotas are specific to the provider and plan and should not be assumed to be available in every market.

    When two providers offer suitable subscriptions, tasks can be distributed between them according to workload characteristics and remaining allowances. The objective is to maintain useful throughput without prematurely exhausting either subscription.

    The cost advantage depends on how much of the included capacity is actually used and whether the plan supports the intended batch-processing access.

    Using Lightweight Channels for Occasional Tasks

    Once a large concurrent batch has finished, the workload may shift to occasional single-request tasks, such as interactive development or small-sample validation.

    In that situation, using the primary high-concurrency allocation may be less economical. An alternative access channel, such as a bundled membership or third-party API intermediary, may be suitable where available and permitted.

    Some service ecosystems offer annual bundles with a low effective monthly cost. Dedicated access through these channels may still provide responsive Flash-model inference without consuming the primary API quota.

    These arrangements are provider- and region-dependent. They should be evaluated as specific options, not assumed to be globally available or equivalent to direct API access.

    Conclusion

    Optimizing LLM batch processing is increasingly a systems-engineering and cost-management problem, not simply a matter of choosing the most capable model.

    Time-based concurrency scheduling can reduce processing duration. A clear understanding of uncached input, cached input, and output charges helps identify meaningful cost savings. Local resource monitoring keeps concurrency within the client’s practical limits, while multi-provider routing can improve the use of subscriptions and available quotas.

    Together, these practices help reduce the time and financial cost of large-scale batch workloads while supporting more efficient deployment of LLM capabilities in business applications.