Maximizing GPU Utilization for LLM Serving Under Compute Constraints: A Multi-Dimensional Optimization Practice
Large language model serving consumes GPU memory and compute on every request, so as usage and context length grow, compute capacity can become the primary bottleneck. This article explains why long conversations and long contexts are especially expensive, then outlines optimization levers across inference engines, scheduling and capacity management, monitoring and feedback, and business models. It also offers practical guidance for developers on context control, graceful degradation, and capacity planning.
1. Phenomenon: Why Compute Becomes the First Bottleneck for LLM Serving
LLM serving differs fundamentally from traditional internet services. For traditional services, marginal cost mainly grows linearly with the number of users. For LLM serving, every request consumes GPU memory and compute. The more users there are and the longer the context is, the higher the cost becomes. This means that after service scale reaches a certain point, compute supply will inevitably fall short of demand.
A typical recent industry phenomenon is that a leading LLM service, due to a surge in users, began limiting long-conversation features through three types of measures:
- No longer supporting long conversations that remain inactive beyond a certain number of days (historical conversation data is cleaned up or archived);
- Shortening the single-input text limit to the order of tens of thousands of characters;
- Limiting the daily conversation quota, with a server-busy message shown after the quota is exceeded.
These measures do not reflect a degradation of product capabilities. Rather, they reflect a common engineering problem: under long-term shortages of high-end compute supply, how to maximize the utilization of existing compute through technical and operational means. This is also a challenge that every LLM service provider must face. The following analysis covers both technical and management dimensions.
2. Why Long Conversations and Long Contexts Are Especially Compute-Intensive
To understand the rationality of these quota measures, we first need to understand the resource consumption model of long conversations.
2.1 KV Cache Is the Main Memory Overhead
During LLM inference, in addition to the model weights themselves, KV Cache (key-value cache) must be maintained for each request. The size of KV Cache is proportional to context length:
KV Cache memory ≈ 2 × layers × attention heads × head dimension × sequence length × bytes per element × batch size
For a model of a common scale, when the context expands from 4K to 64K, the KV Cache for a single request may grow more than tenfold. This means:
- Long-context requests significantly reduce concurrency capacity, and the same amount of GPU memory can serve far fewer requests simultaneously;
- If long-inactive sessions continue to retain cache or context state, they create “zombie occupancy” and waste valuable resources.
2.2 Long Inputs Also Increase Computation and First-Token Latency
The computation in the prefill stage is approximately linear with input length. Long inputs not only consume GPU memory but also lengthen first-token latency, affecting the experience of other queued requests. Therefore, setting a reasonable upper limit on single-input length essentially controls the impact of “extreme long-tail requests” on overall service quality.
3. Four Technical Dimensions for Improving Compute Utilization
3.1 Inference Engine Layer: Make Every GPU Work More Fully
- Continuous batching: Compared with static batching, dynamically inserting new requests into batches that are already generating eliminates the idle time spent waiting for an entire batch to finish. This is a mainstream approach for improving throughput today.
- Paged memory management: Manage KV Cache in fixed-size blocks, allocating and reclaiming them on demand. This significantly reduces memory fragmentation and raises the concurrency ceiling.
- Quantization and operator optimization: Apply low-bit quantization to weights and caches (such as INT8/FP8) to reduce both memory usage and memory-access overhead within an acceptable accuracy range.
- Speculative decoding: Use a smaller model to draft and a larger model to verify, reducing the number of serial calls to the large model while maintaining the same generation quality.
3.2 Scheduling and Capacity Layer: Reserve Resources for the Requests That Need Them Most
An example of a practical tiered scheduling strategy:
def route_request(req):if req.user_quota_exceeded():return REJECT("Usage quota reached. Please try again tomorrow.")if req.is_idle_session(over_days=7):archive_to_cold_storage(req) # Archive inactive sessionsreturn REJECT("Long conversation archived. You can start a new one.")if req.context_len > MAX_INPUT:return REJECT("Single input exceeds limit. Please shorten the content.")if req.priority == HIGH:return SCHEDULE(gpu_pool="dedicated")return SCHEDULE(gpu_pool="shared", batch="continuous")
This can be combined with the following mechanisms:
- Hot/cold session separation: Serialize the context of inactive sessions to disk (for example, object storage), load it on demand when the session becomes active again, and free resident GPU memory;
- Tiered rate limiting by input length: Route extra-long inputs to a separate queue so that long requests do not block short requests;
- Peak shaving and valley filling: Run offline batch tasks (such as evaluation and fine-tuning) during off-peak hours to improve overall utilization throughout the day.
3.3 Monitoring and Feedback Layer: Use Data to Drive Quota Policies
Compute quotas should not be decided by guesswork. They should be continuously adjusted based on key metrics:
- Actual per-GPU throughput (tokens/s), concurrency utilization, and queue length;
- P99 first-token latency and generation speed;
- Share of extra-long requests and cache hit rate.
By building a closed loop of “metric—threshold—action” through monitoring and alerting systems, quota rules can dynamically adapt to load changes.
3.4 Business Model Layer: The Ultimate Destination of Technical Optimization
Technical measures can only mitigate the cost problem, not solve it at the root. The “asset-heavy” nature of AI services means that free models are difficult to sustain over the long term. Paths commonly explored in the industry include:
- Enterprise-oriented vertical services: Deep customization for scenarios such as finance, manufacturing, and the public sector to form stable paid offerings;
- API billing and subscriptions: Differentiated quotas based on usage or membership tier, so that heavy users bear the corresponding costs;
- Content ecosystem loops: For example, in currently popular AI-generated content platforms, the platform provides compute and traffic, creators produce content, users contribute attention, and advertisers pay, forming a sustainable business cycle.
4. Implications for Developers
- Control context length when building applications: Design RAG retrieval strategies reasonably and avoid stuffing irrelevant content into prompts. This saves money and improves speed.
- Design degradation logic: When calling LLM services, handle exceptions such as rate limiting and quota overruns, and implement local caching and retries.
- Plan capacity with headroom in mind: Tight compute supply is a long-term issue. Architecture design should reserve elasticity, such as horizontal scaling on container platforms and multi-level caching.
5. Conclusion
Long-conversation quotas, input truncation, and quota controls may look like “service tightening”, but they are in essence rational engineering decisions under compute constraints. The real solution is multi-dimensional: squeeze hardware performance at the inference layer, allocate resources precisely at the scheduling layer, and ensure reasonable cost recovery at the business model layer. High-end compute supply constraints are likely to remain a long-term reality. Only those who maximize compute utilization and validate a viable business model can survive this long race.
