LLM Inference Compute Is Running Short: The Engineering Logic Behind Long-Context Limits

    This article examines why a major LLM service recently imposed long-conversation limits and recorded roughly ten incidents between early October and mid-November, and traces both to inference-side compute and GPU memory pressure. It explains why KV cache is so expensive, how the memory formula scales with sequence length and batch size, and the three design motives behind expiring inactive sessions, capping input length, and setting daily quotas. It then covers general remedies—prefix reuse and tiered caching, eviction and reclamation, rate limiting with graceful degradation, and observability-driven capacity planning—plus practical steps for application teams.

    1. What Happened: Limits and Outages Under Compute Pressure

    A major LLM service recently imposed limits on long conversations in both its app and web clients. Sessions inactive for more than seven days can no longer keep their existing context, single inputs are compressed to roughly 40,000 characters, and daily conversation counts are capped, after which users see a “server busy, quota reached” message. As of the related reporting, the provider had published no standalone explanation of the change and given no timeline for restoring or loosening the quotas.

    Over roughly the same window, public records show about ten incidents from early October through mid-November, with some dates seeing two in a single day. They fall into two categories. The first is performance degradation: slower responses, higher generation latency, and occasional failed requests, though users still had a chance of submitting successfully. The second is partial disruption of the web client or APIs. The largest single incident lasted more than four hours, with web, mobile chat, and multiple model APIs constrained at the same time; afterward the provider offered credit compensation to API users and promised to prevent a repeat. Most other incidents lasted minutes to tens of minutes, and some affected only search-related add-on tools.

    Taken together, the two point to the same conclusion: compute and GPU memory on the inference side have become the main bottleneck for service availability, and the provider is using limits as a “demand-side regulator” to buy stability.

    2. Root Cause: Why KV Cache Is So Expensive

    Autoregressive generation is fundamentally token-by-token prediction. For every new token, the model must look back at the representations of all previous tokens to compute attention. Recomputing everything each round makes the work grow quadratically with context length. The standard engineering fix is to cache the Key and Value vectors of historical tokens—the KV cache—and read them directly on the next round instead of recomputing.

    The cost is GPU memory. KV cache usage can be approximated as:

    1. cache_bytes ≈ 2 × layers × kv_heads × head_dim × seq_len × batch × dtype_bytes

    The factor of 2 accounts for the two tensors, Key and Value. With a common multi-layer, multi-head configuration using half-precision floats, a single session of tens of thousands of tokens can occupy hundreds of MB to several GB of GPU memory; a few dozen concurrent long sessions fill it up quickly. More importantly, GPU memory is a rigid resource that cannot be swapped out freely like disk. Once it fragments or fills, new requests can only queue or fail.

    This explains the three design motives behind the limits:

    1. Expiring sessions inactive for seven days is essentially reclaiming “zombie cache.” A session stays resident in GPU memory after the user leaves but no longer produces any value.
    2. Capping single-input length directly lowers the per-request GPU memory peak and attention computation, reducing tail latency.
    3. Daily quotas flatten peak concurrency and keep burst traffic from pushing the cluster into an avalanche zone.

    3. General Solutions: From Cache Governance to Capacity Planning

    3.1 Prefix Reuse and Tiered Caching

    For shared prefixes such as system prompts and long documents, prefix sharing lets multiple sessions reuse the same cached segment. Cold data can be pushed down to host memory or local storage, forming a GPU memory–memory–storage hierarchy and swapping in on demand.

    3.2 Eviction and Reclamation Policies

    Give sessions activity signals (last access time, remaining quota, priority) and combine LRU/LFU-style eviction with idle-timeout reclamation. For very long contexts, use a sliding window or summary compression that keeps only the key segments.

    3.3 Rate Limiting, Queuing, and Degradation

    Do token-bucket rate limiting and priority queuing at the gateway layer, and degrade in stages under overload: turn off non-core add-on capabilities, shorten the maximum generation length, reduce batch concurrency, and only then reject requests with a clear retry message.

    1. # Example: priority-aware admission and degradation
    2. def admit(req, limiter, queue):
    3. if not limiter.try_acquire(req.user_tier):
    4. return {"code": 429, "msg": "Quota reached, please retry later"}
    5. queue.put(req, priority=req.priority)
    6. return queue.schedule(max_new_tokens=req.degraded_tokens)

    3.4 Observability and Capacity Governance

    Build dashboards for time-to-first-token, generation throughput, GPU memory usage, cache hit rate, and queue time, with thresholds set through logging and monitoring alerts. Use load testing to determine how many concurrent long sessions a single GPU can carry, then work backward to daily quotas and input limits so the limits rest on data rather than guesswork.

    4. Recommendations for Application Teams

    • Slim the context: keep only necessary history, and retrieve from long documents before assembling a prompt instead of stuffing in whole passages.
    • Shard sessions: split long tasks into multiple short sessions to reduce how long any one session’s cache stays resident.
    • Persist results: write generated content to object storage promptly to avoid wasting compute on regeneration.
    • Decouple the architecture: make non-real-time tasks asynchronous through a message queue to smooth peaks and fill valleys.
    • Plan for multi-option failover: run multiple instances with autoscaling on a container platform, plus health checks for fast fault isolation.

    5. Conclusion

    Limits are not a step backward in capability but rational scheduling under compute scarcity. For developers, understanding the cost structure of the KV cache is what makes it possible to design applications that are both compute-efficient and stable. For enterprises, bringing rate limiting, cache governance, and observability into the architecture—and making good use of general capabilities such as the container platform, object storage, message queue, logging, and monitoring alerts offered by Baidu AI Cloud—is how services stay deterministic when compute is running short.