LLM Inference Rate Limits and Stability Governance: Managing KV Cache, Quotas, and SLOs

    This article examines how large language model (LLM) inference services handle capacity constraints through rate limits, session lifecycle policies, and input length caps. It explains why conversational inference cost scales with context residency time rather than request count, focusing on KV cache as the primary GPU memory pressure source. Readers will learn how to interpret availability metrics correctly, apply developer-side patterns such as token budgeting, layered memory, prefix stabilization, and graceful degradation, and review common platform-side capacity and stability practices.

    1. Background: From “Unlimited Usage” to Quota Constraints

    A major LLM chat service recently introduced usage limits for regular users due to tight compute supply. Based on public user feedback and status page records, this was not a single change but three overlapping policies:

    • Session lifecycle governance: Long conversations that have existed for more than 7 days without active interaction are no longer supported, and idle sessions cannot be resumed.
    • Single-input length reduction: The per-request input limit was lowered to roughly 40,000 characters.
    • Daily call quota: Once the daily usage limit is reached, requests return a “server busy, quota exhausted” type of message.

    During the same period, the service’s status page recorded 8 incidents from October to early November, with varying severity. Most were performance degradations (slower responses, higher generation latency, occasional request failures), and a few were partial outages. The October 15 incident lasted more than 4 hours and simultaneously affected the web app, mobile app, and two types of APIs. It was the most severe incident that month. The provider later offered credit compensation to API users and committed to preventing recurrence. Other incidents mostly lasted from a few minutes to tens of minutes, and some only affected search-related add-on capabilities while basic chat remained available.

    The value of this information for developers is not “watching a failure” but that it puts a long-overlooked engineering fact on the table: the cost of conversational inference is not proportional to the number of requests, but strongly correlated with how long context state remains resident.

    2. Root Cause: Why KV Cache Is the Main GPU Memory Pressure Source

    Autoregressive generation models need to cache the Key/Value tensors of already-processed tokens in GPU memory during inference, avoiding recomputing the full history for every generated token. This is the KV cache. It has two direct consequences:

    1. GPU memory usage grows linearly with context length, and when multiplied by the number of concurrent sessions, it becomes the primary capacity constraint.
    2. Cache lifetime is bound to the “session”: as long as a session is still “alive,” this GPU memory cannot be reclaimed.

    A simplified capacity model makes this clearer (it only expresses order-of-magnitude relationships, not any specific product parameters):

    1. # Order-of-magnitude estimate of KV cache GPU memory per session (illustrative)
    2. # bytes ≈ 2(K,V) * layers * kv_heads * head_dim * seq_len * dtype_size
    3. def kv_bytes(layers, kv_heads, head_dim, seq_len, dtype_size=2):
    4. return 2 * layers * kv_heads * head_dim * seq_len * dtype_size
    5. per_session = kv_bytes(32, 8, 128, 40_000) # context around 40,000 characters
    6. print(per_session / 1024**3, "GiB per session")

    The conclusion is intuitive: increasing context length by 10x increases per-session GPU memory by 10x; multiply that by concurrency, and GPU memory quickly becomes a hard bottleneck. Therefore, “reclaiming idle long sessions” is technically equivalent to freeing long-occupied GPU memory and giving resources to active requests. This is a typical resource scheduling optimization, not a feature reduction.

    Similarly, lowering the single-input limit and adding a daily quota both put an upper bound on the “total resident state,” preventing tail sessions from dragging the cluster into an unpredictable overload zone.

    3. Reading Availability Metrics Correctly: 99.46% Does Not Mean “Almost Never Broken”

    Two availability numbers from the original information (August to October: 99.46% for one type of API, 99.74% for another) are easy to misread. Converting to 8,760 hours per year, 99.46% corresponds to about 47.3 hours of unavailability, and 99.74% to about 22.8 hours. Three methodological issues must be clarified:

    • How unavailability is defined: Is it “complete unresponsiveness,” or does it also count “significantly higher latency and occasional failures”? The former looks much better; the latter is closer to the real user experience.
    • Statistical scope and denominator: Counting by requests, by minutes, or weighted by users leads to vastly different conclusions. With requests as the denominator, long-tail failures are often diluted by large volumes of successful requests.
    • SLA vs. SLO: An SLA is an external commitment tied to compensation; an SLO is an internal target (e.g., 99.9% over a 30-day window), and the error budget is the tolerable amount of unavailability.

    A more reliable engineering practice is to build your own “perceived availability” dashboard:

    1. # Pseudo-config: define unavailability from the user's perspective
    2. slo:
    3. window: 30d
    4. target: 0.999 # internal target
    5. error_budget: 43m # tolerable unavailability over 30 days
    6. bad_events:
    7. - p99_latency > 3x baseline
    8. - error_rate_5xx > 0.5%
    9. - queue_wait > 2s

    4. Developer Checklist: Write Rate Limiting as a Design Constraint

    Facing upstream quotas and length limits, the application side should treat “resources are finite” as a baseline assumption, not an exception branch.

    1. Budget the context: Set a token budget for each request, and trim low-value history first when the limit is exceeded.
    2. Layered memory: Keep recent conversations verbatim and summarize older ones, forming a “hot context + cold summary” structure.
    3. Session TTL and proactive archiving: Align with upstream policy and archive after 7 days of inactivity, avoiding the user-side illusion of “cannot resume.”
    4. Prefix stabilization: Place system prompts, tool descriptions, and few-shot examples at the front and keep them byte-level stable to improve prefix cache hit rate and reduce repeated computation.
    5. Graceful degradation chain: When a strong model is unavailable, switch to a lightweight model or retrieval-based answers, and clearly inform users of the quality difference.
    6. Quota-aware client: Expose quota, remaining amount, and reset time to the frontend to prevent users from repeatedly retrying at the critical point and amplifying the failure.
    1. # Illustrative: call wrapper with budget and fallback
    2. def call_with_budget(messages, budget=32_000, fallback=None):
    3. ctx = trim_to_budget(messages, budget) # trim + summarize
    4. try:
    5. return chat(ctx, timeout=8)
    6. except QuotaExceeded:
    7. raise
    8. except (Timeout, UpstreamError):
    9. return fallback(ctx) if fallback else degrade_notice()

    5. Capacity and Stability Governance: Common Platform-Side Practices

    From the platform perspective, the industry-consensus combination for mitigating similar issues maps to common cloud product categories:

    • Elastic container platform + auto-scaling: Handle sudden traffic, but note cold-start latency from model loading and warm-up.
    • Message queue peak shaving: Make non-real-time requests asynchronous to smooth peaks.
    • Prefix caching and paged KV management: Improve GPU memory utilization and reduce repeated prefill.
    • Multi-AZ deployment with circuit breaking and rate limiting: Contain the impact scope of single-point failures.
    • Log service + monitoring and alerting + distributed tracing: Define SLIs from the user’s perspective and shorten fault localization time.
    • Object storage for long text and archived sessions: Move “cold data” out of GPU memory and the main request path.

    Baidu AI Cloud’s general approach in similar scenarios is also to combine foundational capabilities such as elastic compute, monitoring and alerting, and log analysis to support the business side in building its own SLO and error budget system.

    6. Conclusion

    This quota adjustment is essentially a public capacity governance case: when context state becomes a scarce resource, any conversational AI service must answer “what to keep, what to discard, and who to serve first.” For developers, the right posture is not to wait for upstream to restore “unlimited usage,” but to incorporate token budgets, session lifecycle, degradation paths, and observability metrics into architecture design, so that applications remain predictable, explainable, and sustainable under resource constraints.