LLM Inference Capacity Engineering: Managing the Compute Denominator During Funding Surges
This article examines how to scale large language model (LLM) inference capacity beyond simply adding hardware. Using a recent industry scenario as a starting point, it breaks the "compute denominator" into measurable dimensions—concurrency, context length, redundancy, and peak-trough load—and shows why KV cache growth makes long-session governance more effective than raw hardware expansion. It then outlines a four-layer optimization path across the request, engine, scheduling, and governance layers, discusses the trade-off triangle among cost, latency, and stability, and closes with a general implementation pattern on Baidu AI Cloud. Readers will gain a practical framework for capacity estimation and cost attribution that turns funding-driven resource increases into lasting user-facing stability.
1. Recap: From Quotas to Capacity in 72 Hours
A recent industry scenario is worth examining. An LLM team announced limits on long-running inactive sessions early in the week to relieve pressure on the inference side. A day later, its second funding round closed, with external institutional investors coming in and the founding team retaining control through a holding platform. Capital on the “numerator” expanded quickly, but what actually determines user experience is the engineering-side “denominator”—the effective compute consumed per request.
Abstracted as a technical problem, the conclusion is clear: funding raises the resource ceiling; architecture improves resource efficiency. The former is a one-time event; the latter is a long-term capability. If the denominator—cost per request, context bloat per session, wasted computation per retry—is not governed, any capacity increase will be consumed quickly.
2. Breaking the “Compute Denominator” into Measurable Quantities
Capacity planning should not stop at the instinct to “buy another batch of GPUs.” It needs an observable, attributable model, broken down into at least four dimensions:
- Concurrency: peak concurrent sessions, plus constraints on time to first token (TTFT) and overall time per output token (TPOT).
- Context: input length, output length, and accumulated history across turns. Long sessions are the main consumers of GPU memory and bandwidth.
- Redundancy: compute idling caused by failed retries, duplicate generation, and invalid streaming connections.
- Peak and trough: daily and weekly load curves, which determine whether resources should be always-on or elastic.
A sample calculation for capacity estimation (illustrating the approach only, not any product’s parameters):
# Goal: estimate required concurrent batch size and GPU memory usage trenddef estimate_capacity(qps, avg_in, avg_out, kv_per_token, safety=1.3):tokens_per_sec = qps * (avg_in + avg_out)kv_footprint = tokens_per_sec * kv_per_token # KV cache grows linearly with contextreturn {"tokens_per_sec": tokens_per_sec,"kv_footprint": kv_footprint * safety,"note": "safety is a redundancy factor covering bursts and retries"}
The key point: KV cache grows roughly linearly with context length, so governing long sessions often improves the denominator more than simply adding hardware.
3. Four Layers of Inference-Side Optimization
3.1 Request Layer: Session Lifecycle and Quota Policy
Set up reclamation and summary compression for long-inactive sessions, turning “unbounded history” into “bounded state.” For quota design, use multi-level token buckets that separate interactive from batch traffic, so offline jobs do not crowd out the online experience.
quota_policy:interactive: { rate: 60, burst: 20, priority: high }batch: { rate: 10, burst: 5, priority: low }idle_session_ttl: 7d # archive and compress context after expiry
3.2 Engine Layer: Batching and Cache Reuse
Continuous batching and prefix caching are widely accepted techniques. The former improves throughput; the latter has a very high hit rate for shared system prompts and fixed-template requests, directly cutting redundant computation.
3.3 Scheduling Layer: Elasticity and Tiered Resource Pools
Divide resources into an always-on pool, an elastic pool, and an offline pool. The always-on pool guarantees baseline latency, the elastic pool absorbs peaks and troughs, and the offline pool handles deferrable tasks. Combine this with queue priorities and timeout circuit-breaking to prevent long-tail requests from dragging down the whole system.
3.4 Governance Layer: Observability and Cost Attribution
Build service metrics around cost per thousand tokens, cache hit rate, retry rate, and queue time, with tenant-level attribution. Without attribution there is no optimization; without optimization, scaling only postpones the problem.
4. Balancing Cost, Experience, and Stability
There is no single optimum in engineering, only trade-offs under constraints:
- Pursuing extremely low latency requires more always-on resources and smaller batches.
- Pursuing high throughput requires larger batches and more aggressive queuing.
- Pursuing cost control requires stronger caching and context compression.
The recommended approach is to define experience guardrails (such as a P95 TTFT ceiling) and automatically tune batch size and elastic scale within them, achieving “experience first, cost adaptive.” Also keep a degradation path: model fallback, length truncation, and asynchronous push-back, ensuring availability rather than perfection during peaks.
5. A General Practice on Baidu AI Cloud
When building model services on Baidu AI Cloud, the approach above can be implemented with general product categories: a container platform to host inference instances and elastic scaling, object storage for session archives and model artifacts, a message queue for peak shaving and asynchronous push-back, and logging plus monitoring and alerting for metric collection and threshold linkage. All strategies are expressed as general capabilities; specific parameters should come from load testing against your own workload rather than copying others’ configurations.
6. Conclusion: Back to the Denominator
Capital provides the numerator; engineering determines the denominator. Bounding sessions, thickening caches, tiering scheduling, and attributing costs are the durable solutions for getting through compute cycles. As the denominator keeps falling, each jump in funding will truly translate into stability and smoothness that users can feel.
