Understanding LLM Context Limits: Why a Plain Multi-Turn Chat Hits the Cap
This article explains why a text-only, multi-turn conversation can hit an LLM usage limit around the 39th turn, even when the user types only a few thousand characters. It breaks down the root causes: autoregressive models resend the full history on every turn, so cumulative token consumption grows roughly quadratically; KV cache and attention costs rise with sequence length; and platforms enforce rate, quota, and length limits to protect compute. It also assesses who is affected, then covers engineering responses such as context governance, token observability and alerts, and architecture decoupling, plus platform-side suggestions and a final takeaway.
1. What Happened: A Plain Multi-Turn Chat Hit the Limit
In a deliberate stress test, no files were uploaded. The user asked questions in natural language only: long questions of roughly 150–200 characters, short ones around 10 characters, averaging an estimated 50–80 characters. The regenerate feature was not used, and the discussion topic could be switched at any time. The limit was triggered at the end of the 39th turn, and a newly opened conversation was still restricted.
One common misunderstanding needs clearing up first: limits are not only about a “single session.” On most platforms, the quota is an account-level resource scheduling result, so opening a new session does not reset the allowance. What actually counts toward cost is the total tokens sent to the model in each request, not the number of characters the user typed.
2. Root Causes: Token Accounting and Compute Constraints
2.1 Context Window and the Cost of “Re-reading”
Autoregressive models have no real “memory.” Every turn, the full message history must be reassembled into the input. Suppose the user adds x tokens and the model replies with y tokens on turn n; then the input for turn n is roughly:
input(n) ≈ system_prompt + Σ(xi + yi), i = 1..n-1 + xncumulative consumption ≈ Σ input(i) + Σ output(i)
In long conversations, cumulative consumption grows roughly with the square of the number of turns. With 39 turns at around 100 tokens of input each, cumulative input can reach the tens of thousands of tokens. This explains the gap between “I only typed two or three thousand characters” and actually hitting the limit.
2.2 Compute and GPU Memory: Linear Growth of the KV Cache
During inference, generating each token requires reading the entire historical key-value cache. GPU memory usage is roughly linear in sequence length, while attention computation grows super-linearly with length. When concurrent requests stack on top of long contexts, the compute cost per request rises sharply, and enforcing limits to protect resources is standard industry practice.
2.3 Three Common Forms of Limits
- Rate limits: a cap on requests or tokens per unit of time;
- Quota limits: a cap on cumulative daily/monthly tokens or conversation turns;
- Length limits: truncation of a single input, for example keeping only the first several pages or the first several thousand tokens.
The “first 20 pages or 10,000 tokens” mentioned in the original text is essentially the third type: an over-long input is truncated, and the model can only see the prefix.
3. Who Is Actually Affected
- Long-conversation discussion users: the more turns, the higher the cumulative cost, and they hit limits first;
- Document-analysis users: long documents get truncated, reducing answer completeness;
- Coding assistant and customer-service applications: a fixed system prompt permanently occupies part of the allowance, so long sessions hit the ceiling more easily;
- Enterprise batch scenarios: concurrency and quotas stack up, requiring capacity planning.
4. Engineering-Side Strategies
4.1 Context Governance
- Session segmentation: start a new session when the topic switches, avoiding the buildup of useless history;
- Summary compression: apply rolling summaries to earlier conversation, keeping only conclusions and constraints;
- Retrieval augmentation: chunk long documents into a vector retrieval service and recall fragments on demand instead of stuffing in the whole document;
- Structured prompts: replace lengthy natural language with field-based templates.
Example logic:
def build_context(history, query, budget=8000):# 1) Fixed system prompt firstctx = SYSTEM_PROMPT# 2) Retrieve relevant fragmentsctx += retrieve(query, top_k=5)# 3) Rolling summary of historyctx += summarize(history)# 4) Trim to budgetreturn truncate_by_token(ctx, budget)
4.2 Observability and Alerts
Build your own counter at the application layer to track input and output tokens per turn, set alert thresholds at 70%/90%, and connect to logging and monitoring/alerting services. This turns a “sudden disconnection” into an “early degradation.” Degradation paths include switching to a shorter context, disabling non-essential history, and queued retries.
4.3 Architecture Decoupling
Split long tasks into a multi-stage pipeline of “plan–retrieve–generate–verify,” use a message queue to smooth out peaks, scale elastically with a container platform, and store intermediate artifacts in object storage to avoid unbounded growth within a single session.
5. Platform-Side Suggestions
Transparent quota dashboards, remaining-balance hints, visualization of truncation points, tiered quota packages by scenario, and capacity reservation plans for enterprises are all key to reducing disputes. General capabilities that Baidu AI Cloud provides for model services and compute scheduling, such as elastic containers, monitoring and alerting, and log analysis, can serve as the foundation for an enterprise-side self-built quota governance system.
6. Conclusion
Limits are not a sign that a “product got worse,” but an inevitable result of compute cost combined with the context mechanism. On the user side, actively slim down context and segment sessions; on the development side, establish token budgets, observability, and a degradation path. Understanding the cumulative nature of input(n) turns an unpredictable interruption into a plannable, optimizable engineering problem.
