Large Model Serving: GPU Utilization and Resource Management Practices

    This article examines why long-context inference places disproportionate pressure on GPU memory, latency, and concurrency. It explains the role of KV cache, session lifecycle management, token-based quotas, and priority scheduling, then discusses the commercial and infrastructure challenges of operating compute-intensive AI services. It concludes with practical guidance for developers on context optimization, rate limiting, cost monitoring, and elastic workload management.

    1. The Problem: Resource Bottlenecks Under Heavy Workloads

    Large model services differ fundamentally from traditional internet applications: every inference request consumes real GPU compute. Traditional web services typically have very low marginal costs, allowing a single server to handle thousands of lightweight concurrent requests. Large model inference, by contrast, is compute-intensive, especially when requests contain long contexts. As the context grows, so does KV cache usage, while the computation required for each forward pass also increases.

    Recently, a well-known large model service introduced several restrictions for long-conversation scenarios:

    1. Conversations that had been inactive for longer than a specified period were no longer supported.
    2. The maximum size of a single text input was reduced to approximately 40,000 Chinese characters.
    3. Daily conversation quotas were introduced, with users receiving a “server busy” message after reaching the limit.

    These measures may appear to be user restrictions, but they are essentially attempts to balance available compute capacity with user demand. They also provide a representative example of how large model services manage limited resources.

    2. Why Long Contexts Consume So Many Resources

    To understand the rationale behind these restrictions, it is important to examine how long contexts affect inference resources.

    2.1 GPU Memory Pressure from the KV Cache

    During inference, a large model caches the Key and Value vectors for each token at every layer to avoid redundant computation. KV cache memory usage can be approximated as:

    1. KV cache memory ≈ 2 × number of layers × context length × hidden dimension × bytes per value × batch size

    This shows that KV cache usage increases linearly with context length. When a user includes tens of thousands of characters from previous conversations in a request, a single cache entry may consume several gigabytes of GPU memory. This directly reduces the number of concurrent requests that one GPU can serve.

    2.2 The “Dormant Cost” of Long Conversations

    Multi-turn conversations also create a session-state management challenge. If a service retains the complete context for every active session—whether in GPU memory or through periodic persistence—large numbers of low-frequency but technically “active” long conversations continue to consume storage and scheduling resources.

    A rule that removes sessions after several days of inactivity is essentially a session lifecycle management strategy. It is similar to an LRU eviction policy in operating systems: sacrificing continuity for a small number of infrequent users in exchange for better overall resource turnover.

    2.3 Input Length and Inference Latency

    Input length affects not only memory usage but also time to first token and throughput. The computation required during the prefill stage generally increases with input length and may become more than proportionally expensive in some implementations. Extremely long inputs can create long-tail requests during peak periods, occupying inference instances and increasing queueing delays for other users.

    Keeping single-request inputs within a reasonable range is therefore a common way to protect the experience of the majority of users.

    3. Quotas and Rate Limiting: From Implementation to Fair Scheduling

    Daily conversation quotas are a typical example of multidimensional rate limiting and quota management. Common implementation approaches include:

    • Token bucket or leaky bucket algorithms: Maintain a bucket for each user to control request frequency.
    • Quota accounting: Measure usage by the number of tokens consumed rather than by request count. This more closely reflects actual compute costs and is commonly implemented with distributed counters:
    1. # Example: daily quota check using a distributed cache
    2. def check_quota(user_id, tokens_requested):
    3. key = f"quota:{user_id}:{today()}"
    4. used = cache.incrby(key, tokens_requested, ttl=86400)
    5. if used > DAILY_TOKEN_LIMIT:
    6. raise QuotaExceededError("Daily usage quota has been reached")
    • Tiered priority scheduling: Assign different quotas to free and paid users. During peak periods, lower-priority requests can be downgraded or queued to prevent a broader service overload.

    The main challenge in quota design is balancing fairness and user experience. Quotas that are too restrictive frustrate heavy users, while quotas that are too generous provide insufficient protection. A common industry approach is to establish initial thresholds based on P95 and P99 usage profiles, then adjust them dynamically according to system load. Clear messages that indicate when access will be restored or how users can obtain additional capacity can also reduce frustration.

    4. The Deeper Conflict: Asset-Heavy Operations and Commercial Sustainability

    The visible problem of compute scarcity reflects a broader structural challenge in the business model of large model services.

    4.1 AI Services Are Asset-Heavy Businesses

    Traditional internet services mainly incur bandwidth and server costs. Once those costs are spread across a sufficiently large user base, marginal costs can remain relatively low, making a “free user acquisition followed by monetization” strategy feasible.

    Large model services are different. Every additional active user creates real costs for GPU purchases or rentals, electricity, and operations. As the user base grows, losses can increase rapidly, significantly shortening the period during which a company can offer free access before establishing a sustainable revenue model.

    4.2 Possible Paths to a Commercial Model

    Industry practice suggests several broad approaches to building a sustainable business loop:

    • API billing: Charge developers by token usage, directly linking revenue to compute consumption.
    • Industry-specific markets: Provide solutions for sectors such as finance, manufacturing, and government, generating revenue through project-based engagements or subscriptions.
    • Integration with the attention economy: AI-generated short-form drama is one example that has attracted attention. In this model, a platform provides compute and distribution, creators produce content, users contribute attention, and advertisers pay for that attention—similar to the business model of traditional content platforms. Whether such models can fully cover inference costs remains to be demonstrated.

    4.3 Long-Term Constraints on High-End Compute Supply

    Because of supply constraints, high-end AI compute may remain tightly balanced against demand for an extended period. Service providers therefore cannot solve every capacity problem simply by adding more machines. Improving compute utilization must become a long-term priority.

    Key areas include operator optimization and quantized deployment in inference engines, request batching and continuous batching, separate handling for short and long requests, and off-peak pricing or other mechanisms that guide demand.

    5. Lessons for Developers

    1. Respect context boundaries when designing applications: When calling a large model API, compress or summarize conversation history instead of continuously appending the entire transcript.
    2. Implement rate-limit and backoff handling: Client applications should use exponential backoff retries and fallback strategies when they encounter quota errors or service-busy responses.
    3. Consider costs early: Estimate token costs during the architecture phase, and include usage monitoring and alerting in the observability system.
    4. Use elastic resource scheduling: Container platforms, monitoring and alerting systems, message queues, and other cloud capabilities can help scale inference workloads elastically while smoothing traffic peaks.

    Conclusion

    Limits on long conversations, reductions in input size, and daily usage quotas may appear to reduce service availability. In practice, they are rational responses to the compute constraints facing large model services.

    For the industry, the long-term solution is not unlimited subsidies. It is to use technical methods to make every unit of compute more productive while building a commercial model that matches the capital intensity of AI infrastructure. The competition to improve compute utilization has only just begun.