Compute and Context Governance Behind LLM Service Limits

    This article explains why large language model services impose usage limits, session expiration, and input caps. It breaks down the compute and GPU memory costs of long contexts, including the quadratic attention cost and KV cache growth, then maps common quota mechanisms to their technical purpose. It also outlines practical responses for developers, such as context compression, externalized session state, cache lifecycle management, and architecture-level cost reduction.

    1. The Shift: Free Access Did Not Disappear, an Old Assumption Did

    A recent usage policy change from a major LLM service triggered widespread discussion: extremely long chat histories can no longer be resumed, single-input length has been reduced, daily call quotas now apply, and once the quota is exhausted users see a busy message and must wait for it to reset. The frustration is understandable, but from an engineering perspective, what has actually ended is not the “free” label. What ended is the old assumption that made unlimited free access possible: that compute costs could be subsidized by capital indefinitely.

    Framed as a technical problem, this is a new version of an old question: given scarce GPU memory and bandwidth, how do you deliver predictable latency and fair quotas to a large number of concurrent sessions? Any public-facing generative service eventually has to answer three questions: who is using it, how much they are using, and whether idle capacity can be reclaimed.

    2. Root Cause: Why Long Contexts Are Expensive

    2.1 The Quadratic Term in Attention

    During autoregressive decoding, every new token must be attended against all existing tokens. Let the context length be n: the compute for a single attention step grows linearly with n, while the cumulative cost of one full forward pass grows roughly with n squared. Scaling a context from a few thousand tokens to tens of thousands does not double the cost; it jumps by an order of magnitude.

    2.2 KV Cache: The Invisible Tenant in GPU Memory

    To avoid recomputation, the model keeps the Key/Value tensors for every layer and every head resident in GPU memory. This is the KV cache. Its size can be approximated as:

    1. cache_bytes ≈ 2 * layers * kv_heads * head_dim * seq_len * bytes_per_elem * batch

    The factor of 2 accounts for the two tensors, K and V. The critical detail is that seq_len and batch are both multiplicative terms: a single session on the order of hundreds of thousands of characters already consumes substantial memory, and multiplying that by the concurrent batch size pushes memory to its ceiling quickly. Once memory runs short, the scheduler can only reduce the batch size, and throughput drops accordingly.

    2.3 Idle Sessions Are a Classic Resource Mismatch

    A session that has been inactive for a long time generates no new interactions yet still holds its memory. Under resource pressure this is the worst possible combination: the cost has already been paid and the return is zero. Policies such as disconnecting session resumption after 7 days of inactivity are essentially a form of cache eviction, the same idea as an operating system reclaiming cold pages or a database evicting cold data.

    3. Three Forms of Limits and What They Mean Technically

    Limit form Technical meaning Primary effect
    Session expiration Cold-session cache eviction Frees HBM, reduces mismatch
    Single-input cap Constrains the prefill peak Shaves memory and compute spikes
    Daily usage quota Token bucket / sliding-window rate limiting Ensures fairness and predictable latency

    In practice, quotas are commonly implemented with a token bucket or a sliding-window counter, combined with a priority queue: paid or high-priority requests are dequeued first, while low-priority requests are deferred during peaks. Illustrative logic:

    1. class TokenBucket:
    2. def __init__(self, capacity, refill_per_sec):
    3. self.capacity = capacity
    4. self.tokens = capacity
    5. self.refill = refill_per_sec
    6. def allow(self, need):
    7. self.tokens = min(self.capacity, self.tokens + self.refill)
    8. if self.tokens >= need:
    9. self.tokens -= need
    10. return True
    11. return False # corresponds to "quota reached, please try again later"

    4. What Developers Can Do

    4.1 Context Compression and Tiered Memory

    Do not stuff the entire history into the prompt. Viable combinations include rolling summaries that compress early conversation into a structured summary, vector retrieval that pulls back only the fragments relevant to the current question, and a hybrid window of “summary plus the most recent N turns verbatim.” In engineering terms, summaries and vector indexes can live in object storage and a vector retrieval service, with hot data kept in memory and cold data fetched on demand.

    4.2 Externalize Session State

    Treat conversation history as business data rather than internal model state: use a message queue to smooth peaks, a logging service for auditing, and monitoring and alerting to track P95 latency and failure rate. That way, even if the server side evicts the cache, the application can still “replay” the necessary context in a new session and the user notices nothing.

    4.3 Actively Manage Cache Lifecycles

    Assign tiered TTLs to sessions: active sessions stay in hot cache, quiet sessions are downgraded to a summary state, and expired ones are fully evicted and persisted to storage. Combined with LRU/LFU eviction policies, this significantly reduces wasted GPU memory.

    4.4 Architecture-Level Cost Reduction

    • Prefix cache reuse: shared KV for common prefixes such as system prompts and tool definitions, avoiding repeated prefill;
    • Batching and paged caching: better memory utilization and less fragmentation;
    • Model tier routing: simple requests go to smaller models, and only complex requests are escalated;
    • Streaming output: improves perceived time to first byte and eases queue anxiety.

    5. Advice for Product and Operations

    Limits should not be packaged as punishment but as an explicit interface for capacity governance: show remaining quota clearly, provide quota reset times, and let users export and archive their history. Once users understand that a long context occupies GPU memory exclusively, most resistance turns into appreciation for predictability. If demand is genuinely steady, subscriptions or pay-as-you-go are the normal mechanism for passing cost signals to the demand side.

    6. Conclusion

    The move from unlimited free access to quotas and expiration is not a change in technical ideals but a return to visible resource constraints. For developers, the real moat is not the longest possible context but delivering results reliably with fewer tokens and lower memory consumption. Managing context as an asset, treating cache as a finite resource to govern, and designing quotas as a capacity contract is the engineering norm for getting through compute cycles.