LLM Inference: The Litmus Test and Core Challenge for AI Infrastructure

    This article explains why LLM inference, rather than training, becomes the dominant ongoing cost and operational challenge for AI infrastructure. It examines four key workload characteristics—high concurrency, strict latency budgets, traffic volatility, and memory/bandwidth constraints—and reviews essential techniques such as resource pooling, autoscaling, cold-start control, inference-engine optimization, and observability. It also outlines a practical path from baseline load testing to cost attribution and tiered service operations.

    LLM Inference: The Litmus Test and Core Challenge for AI Infrastructure

    I. Training Is Capital Expenditure; Inference Is Operating Cost

    When teams discuss the budget for a large model project, many first think of training: massive datasets, expensive clusters, and jobs that run for weeks or even months. Training is certainly important, but it is closer to one-time capital expenditure. A job has a beginning and an end, and once the model converges, training costs stop accumulating.

    Inference is completely different. The moment a model goes live, the real “ongoing operation” begins. Every user request and every generated token consumes real-time compute and creates costs for electricity, bandwidth, resource occupancy, and operations. As long as the service is running, costs continue to accumulate.

    Over a one-year full lifecycle, industry estimates commonly put inference at 70%–90% of total large-model costs, with training accounting for only 10%–30%. More intuitively, the single training run for a leading large model may cost tens of millions of dollars, while daily inference costs after launch can exceed several million dollars. In roughly two weeks, inference can cover the total investment of the training phase. This shows that inference is not an “auxiliary step” after training is complete. It is the core cost item that determines whether a large model can keep running over the long term.

    At the same time, inference directly faces users. In some business observations, if an e-commerce customer service chatbot has a peak response delay above 300 ms, user consultation conversion may drop by about 20%. For mobile on-device conversation, if response time exceeds 1 second, user retention may decline noticeably. The dual pressure of experience and cost makes inference a harder deployment hurdle than training.

    II. Four Key Characteristics of Inference Workloads

    1. High Concurrency and Fine-Grained Requests

    Training is a large job that can read data in batches and schedule resources uniformly, with the goal of completing the entire workload. Inference is more like “retail”: each request is independent and fine-grained, and after a user asks a question, the model must process it immediately. Requests may come from web pages, apps, APIs, and internal systems, and multiple business lines may reuse the same model at the same time, creating very high concurrency.

    High concurrency does not mean simply adding more machines. Each request has a different input length, output length, and context size. How to organize these requests efficiently is the first problem that inference infrastructure must solve.

    2. Strict Latency Budgets

    Online inference is extremely sensitive to latency. Users are not waiting for “whether the model has finished processing”; they care about how quickly the first character appears. The industry typically focuses on two key metrics:

    • Time to first token (TTFT): the time from when a request enters the system to when the first token is output. It shapes the user’s first impression.
    • Per-token generation latency: the generation speed of each subsequent token. It determines how fluent the full answer feels.

    Training jobs can tolerate queuing for minutes or even hours. Inference cannot. A second-level latency jitter during peak hours can directly cause user loss or lower business conversion. Therefore, inference infrastructure must plan capacity around SLOs rather than pursuing only average throughput.

    3. Significant Traffic Fluctuations

    Inference traffic often has strong peak and trough patterns. Daytime differs from nighttime, weekdays differ from weekends, and promotional events may generate several times the usual traffic. If capacity is reserved for peak demand over the long term, costs will be very high. If capacity is configured for average traffic, the experience during peak periods will become uncontrollable.

    This requires infrastructure to support elastic scaling: rapidly add inference instances when traffic rises and reclaim resources promptly when traffic falls. The real challenge is speed. Not only must scale-out be fast, but model loading, warm-up, and registration with the load balancer must also be fast. Otherwise, capacity may be added but still fail to handle incoming traffic.

    4. GPU Memory and Memory Bandwidth Bottlenecks

    Many people assume that inference bottlenecks are mainly about compute. In reality, generative tasks are more likely to be constrained by GPU memory and bandwidth. Model parameters must reside in accelerator memory, and during generation, the KV cache for each request must also be stored. As concurrency increases and context length grows, the KV cache consumes a large amount of GPU memory.

    When GPU memory is insufficient, requests can only queue or be processed with a smaller batch, which ultimately appears as lower throughput and higher latency. Therefore, inference infrastructure should focus not only on peak compute but also on GPU memory capacity, memory management efficiency, data movement bandwidth, and the benefits of model compression.

    III. Key Technologies Built for Inference in AI Infrastructure

    1. Compute Resource Pooling and Scheduling

    Multiple models and business lines usually do not each buy a separate set of machines. Instead, they share the same compute resource pool. After pooling, the scheduling system must address several issues:

    • Different models have different resource requirements: small models need less GPU memory, while large models need large-scale multi-GPU parallelism.
    • Some requests have high priority and need to preempt resources, while others can wait in a queue.
    • Model replicas should not be too dispersed; otherwise, multi-GPU communication overhead will increase.
    • The resource pool must serve training, fine-tuning, batch inference, and online inference tasks at the same time.

    A reasonable scheduling system needs to keep inference instances as close as possible to data and model weights while avoiding resource fragmentation. It also needs to support resource quotas, priorities, and overcommit control so that high-priority scenarios are not crowded out by low-priority tasks.

    A rough capacity estimation model can help with initial planning:

    1. # Simplified capacity estimate: for initial budgeting only; calibrate with load-test data
    2. def estimate_cards(qps, input_tokens, output_tokens,
    3. per_card_tokens_per_sec, target_util=0.6):
    4. total_tokens_per_sec = qps * (input_tokens + output_tokens)
    5. cards = total_tokens_per_sec / (per_card_tokens_per_sec * target_util)
    6. return ceil(cards)

    This example does not distinguish between the prefill and decode phases. In production, it must be corrected with real traffic replay and load-test results. However, it illustrates a basic logic: inference capacity should not be estimated by “model size” but by “the total number of tokens that need to be processed per second.”

    2. Elastic Scaling and Cold-Start Management

    Elastic scaling is a standard capability of inference infrastructure. It needs to make comprehensive judgments based on multiple metrics such as request queue length, GPU utilization, P99 latency, and requests per second, rather than looking only at CPU utilization.

    The difficulty of scaling out lies in cold starts. Large model weights can range from tens of gigabytes to hundreds of gigabytes, and loading them from storage into accelerator memory takes time. If every scale-out starts from zero, peak traffic periods simply cannot wait. Common practices include:

    • Maintaining a “warm instance pool” with model weights preloaded.
    • Warming up new instances with a small amount of traffic before gradually increasing traffic.
    • Gracefully scaling in when traffic drops, releasing resources only after in-flight requests are completed.
    • Using distributed caches or local caches to reduce repeated loading.

    Elastic scaling is not simply automatic scaling. It is a complete chain that includes capacity prediction, resource requests, model loading, traffic onboarding, health checks, and scale-in reclamation.

    3. Inference Engine-Level Optimization

    Training frameworks and inference frameworks have different goals. Training pursues correctness of gradient computation and throughput, while inference pursues low latency per request and high overall throughput. Inference engines need extensive optimization in operator fusion, memory management, dynamic batching, and KV cache management.

    Dynamic batching is especially critical. Traditional batching waits for a batch of requests to accumulate before computing them together, which can cause earlier requests to be slowed down by later ones. A better approach is to dynamically organize multiple requests into the same batch during the decoding phase, adding requests as they arrive and removing them immediately after they finish, so that compute is always used efficiently.

    For long-context scenarios, prefix KV caching is also valuable. If multiple requests share the same system prompt or historical context, the already-computed KV cache can be reused to avoid redundant computation and reduce time to first token.

    Model-level optimization is equally important. Quantization, pruning, and distillation can reduce GPU memory usage and computation, but accuracy loss must be balanced. A more practical approach is tiered routing: simple requests are sent to a small model for fast processing, while complex requests are routed to a large model, controlling cost while maintaining quality.

    4. Storage, Networking, and Observability

    Inference infrastructure should not focus only on compute nodes. The storage system must support high-throughput model loading and log collection. The network must support parameter synchronization and communication across multiple GPUs and nodes. The monitoring system must trace the full path from client to gateway, to inference instances, and down to model kernels.

    Observability should cover at least the following metrics:

    • Requests per second and generated tokens per second.
    • Time to first token, per-token latency, and P50/P95/P99 latency.
    • Request queue length and KV cache hit rate.
    • Accelerator utilization, GPU memory usage, and memory bandwidth.
    • Cost per thousand tokens, cost per request, and costs broken down by business line or model version.

    Only when costs are broken down to the granularity of “every thousand tokens” can teams truly judge whether a business case is worth using a large model for, whether it should switch to a smaller model, and whether caching is needed.

    IV. Implementation Path: From Baseline to Fine-Grained Operations

    1. Start with Baseline Load Testing

    Do not estimate capacity by guesswork. Use real business traffic replay or construct typical request distributions, run load tests under different concurrency levels, record latency and throughput curves, and find the “performance knee.”

    Baseline load testing should cover different input lengths, output lengths, and context sizes, and preferably include traffic samples from both peak and off-peak periods. Only with a real baseline can teams determine whether the current bottleneck is in model computation, memory bandwidth, network communication, or scheduling queues.

    2. Establish a Clear Optimization Order

    A common optimization priority is:

    • Model side first: Can a smaller model be used? Can quantization be applied? Can prompt tokens be reduced?
    • Inference engine side next: Dynamic batching, KV cache reuse, and operator fusion.
    • Infrastructure side next: Resource scheduling, network topology, storage reads, and elastic scaling policies.
    • Business side last: Semantic caching, request merging, and handling simple questions first with rules or small models.

    Buying more machines immediately often addresses “not enough resources” rather than “resources are not used well.”

    3. Make Costs Attributable

    Cost governance is not only a finance department issue; it is a shared responsibility of engineering and operations. Every inference service should have a clear cost model: model version, number of instances, unit token cost, and cost per request.

    After a cost dashboard is established, teams can regularly review which requests consume the most resources, which models have redundant performance, whether workloads can be downgraded to smaller models, and which traffic can be served by semantic cache hits. These decisions directly affect compute budgets.

    4. Tiered Services and Dynamic Trade-offs

    Not every business needs the same high quality of service. Businesses can be divided into several tiers:

    • Tier 1: user-facing real-time interaction, requiring low latency and high availability.
    • Tier 2: internal assistant tools that can tolerate second-level latency.
    • Tier 3: offline batch analysis that can run overnight.

    Different tiers use different resource specifications, elasticity policies, and models. During peak periods, Tier 1 is prioritized; during off-peak periods, idle resources are left for batch tasks. This can significantly reduce overall costs.

    V. Conclusion: Inference Is a Continuous Stress Test for Infrastructure

    Training determines whether a model can be built. Inference determines whether it can be used, used for a long time, and used affordably. Inference is not a one-time deployment task but a 7×24 continuously running business system. It places infrastructure under a “continuous stress test”: compute must be elastic, latency must be controllable, costs must be calculable, failures must be recoverable, and optimization must be iterative.

    For enterprises, inference should not be treated as wrap-up work after training. It should be included in infrastructure planning from day one. Choosing full-stack cloud infrastructure such as Baidu AI Cloud can lower the initial build barrier, but the ultimate competitiveness still comes from a deep understanding of one’s own business workloads, continuous optimization of the inference path, and a fine-grained operating mechanism that turns compute into business value.