LLM Context Caching and Rate Limiting: How They Actually Work
This article explains the engineering reasons behind rate limits on large language model services: why models are stateless and cannot truly remember past conversations, how prefix caching reduces repeated computation and why cache hits depend on time, and why long sessions create uneven costs. It also covers multi-dimensional tiered limiting strategies and practical context governance techniques for developers, including layered memory, retrieval instead of stacking, rolling summaries, session persistence, and budget monitoring.
The Technical Problem Behind a Rate Limiting Controversy
A large language model service recently faced significant negative feedback after imposing rate limits on free users. The trigger was straightforward: long-inactive historical sessions returned an insufficient compute notice when reopened, single input length was compressed, and a quota limit reminder appeared after continuous use. Paid interfaces were unaffected; the free entry point absorbed the pressure first.
Setting emotion aside, the episode raises three general engineering questions: why large models have no real long-term memory, why long sessions are extremely uneven in cost, and how providers use tiered strategies to maintain availability under limited compute. The discussion below applies to common industry architectures and does not target any specific vendor or product.
Why the Model Cannot Remember What You Said Last Week
Inference in a large model is essentially a stateless function call. Given an input sequence, the model produces the next token, appends the new token back to the sequence, and continues generating. What looks like “remembering” is simply reassembling prior messages into the current input:
final_input = system_prompt + history_messages + current_user_messageoutput = model(final_input)
The model has no database and no user profile. Every act of “recall” means reading the entire history again.
The key variable is sequence length. The computation of the attention mechanism grows superlinearly with sequence length, and memory usage rises with length as well. A session of two hundred thousand characters must be processed repeatedly on every turn, so cost multiplies by the number of turns. A long session is therefore not “free while stored and unused”; it is “expensive the moment it is revived.”
What Context Caching Actually Saves
Providers typically introduce mechanisms such as prefix caching to reduce repeated computation. The idea is to retain the intermediate token states that have already been computed, so that a later request with an identical prefix can reuse them directly:
cache_hit -> compute only the new tokenscache_miss -> recompute the entire prefix
The value of caching depends entirely on the hit rate, and the hit rate depends on time. Cache residency is constrained by GPU and memory capacity and requires an eviction policy; the longer the idle period, the higher the probability of eviction. A common industry practice is to retain entries within a window of hours to days, treating anything beyond that window as expired.
This produces a counterintuitive outcome. A session that has accumulated two hundred thousand characters and gone untouched for seven days may receive a single greeting, yet the server must rebuild the entire prefix. The compute cost can be equivalent to a dozen or more normal turns in the same session. The user perceives “I only said one sentence”; the server perceives “an extremely long cold start.”
Rate Limiting Is Not Punishment but a Consequence of Queueing Theory
Think of the service as a system with a finite number of service desks: compute is the number of desks, requests are customers, and long-context requests are customers who occupy a desk for an unusually long time. As the proportion of long requests rises, queue wait times deteriorate nonlinearly, eventually surfacing as “server busy.”
Mature platforms therefore apply tiered strategies across multiple dimensions:
- Identity tiers: free entry points and paid interfaces use different quotas and priorities;
- Length tiers: caps on single input length suppress extreme sequences;
- Frequency tiers: request counts and concurrency are limited per time window;
- Session tiers: restoring long-inactive sessions carries additional constraints.
The goal of these strategies is not to filter users out but to keep high-value requests from being dragged down by extremely long cold starts. Understanding this explains why limits always land on the free side first.
Context Governance Practices on the Application Side
For developers, rather than relying on an infinitely long session window, it is better to govern context actively. Several directions can be implemented directly:
First, build layered memory. Put stable information in the system prompt, put stage-specific information in structured storage, and inject only the content relevant to the current turn.
def build_prompt(system, user_profile, retrieved, turn):return {"system": system, # stable and cacheable"context": retrieved[:MAX_SNIPPETS], # a few retrieved snippets"history": turn[-MAX_TURNS:], # rolling window}
Second, use retrieval instead of stacking. Chunk long documents, vectorize them, and recall on demand, sending only the few most relevant snippets and reducing length from “everything” to “what is necessary.”
Third, apply rolling summaries. Every few turns, compress earlier conversation into a structured summary that keeps conclusions and discards process.
Fourth, persist and migrate sessions. Export long-term context to a common format and reinject it when needed, instead of expecting the platform to retain it permanently.
Fifth, add observability and budgets. Record token consumption per turn, cache hit status, and failed retries, and set budget alerts to avoid uncontrolled consumption on long sessions.
Recommendations for Different Roles
When ordinary users hit a rate limit, the most economical approach is to start a new session, shorten individual inputs, and keep long material external as files provided on demand. Heavy users, such as those maintaining medical records, literature libraries, business templates, or long-form writing over time, should build a local knowledge base and summarization mechanism, turning “extra-long memory” into “searchable external memory.” Developers should treat context length as a finite resource when designing interfaces and reserve a degradation path at the architecture level.
Conclusion
The rate limiting controversy is essentially a cost structure problem perceived by users as a service attitude problem. The stateless nature of large models, the time sensitivity of caching, and the finiteness of compute together determine that long sessions must be constrained. Understanding the cost difference between cache hits and prefix rebuilding, and adopting layered memory, retrieval augmentation, rolling summaries, and budget monitoring, is what yields a stable and predictable experience under limited compute. For platforms, transparently explaining limit rules and recovery conditions is more valuable than absorbing negative reviews afterward.
