Troubleshooting Abnormal LLM Token Consumption After November 2026
This article explains how to diagnose sudden spikes in LLM token usage in AI coding tools. It breaks consumption into input tokens, output tokens, cache hits, and overhead, then examines why automatic context compaction can trigger a feedback loop of cache invalidation and repeated compaction. It also covers context duplication across sub-agents, four checks for distinguishing configuration issues from implementation defects, and a practical optimization checklist.
1. Symptom Overview: Why the Usage Curve Suddenly Spikes
After mid-November 2026, some developers using AI coding tools reported that token consumption per unit of time had multiplied, even though the actual complexity of their coding tasks had not changed noticeably. Typical descriptions included: a scenario that previously accounted for about 20% of total usage jumped to 50% within a short period; a quota that used to support several hours of interaction was exhausted within 20 minutes; and daily usage habits, codebase size, and prompting style all stayed the same, yet the usage curve visibly steepened.
Such reports easily lead to the first assumption that “the tool is broken.” From an engineering perspective, a more likely explanation is that the context management mechanism entered an inefficient loop under certain conditions. To determine whether this is a program defect, you must first break “consumption” into observable components and verify them one by one.
2. Break Consumption into Observable Components
The billing and latency of any request are basically made up of four parts:
- Input tokens: system prompts, tool definitions, conversation history, and retrieved code snippets;
- Output tokens: model-generated responses and tool call parameters;
- Cached portion: content identical to the prefix of the previous turn, usually billed at a lower rate;
- Overhead: context compaction itself, retrieval recall, repeated file reads, and so on.
The first step is to quantify these four categories separately. Staring only at the “total quota dropping” has no diagnostic value, because the total is a result, not a cause.
# Example: consumption attribution for a single sessionrecord = {"input_tokens": 246_000,"cached_tokens": 12_000, # cache hit rate only about 5%"output_tokens": 8_500,"compaction_events": 3, # compactions triggered this turn"compaction_cost": 95_000, # consumption of the compaction process itself}effective = record["input_tokens"] - record["cached_tokens"]print(effective, record["compaction_cost"])
When the cached_tokens share is extremely low while compaction_cost is high, the problem can basically be located in the context management pipeline, rather than the model itself “becoming more expensive.”
3. Key Clue: Automatic Compaction Barely Frees Any Space
The most notable point in the feedback is that the “benefit” of compaction is close to zero. Typical data observed on the user side: the trigger threshold is around 240K tokens, the context is about 240K–250K before compaction, and 140K–160K remains after compaction. In other words, a fairly costly compaction reclaims less than 40% of the space.
This leads to two direct consequences:
First, compaction becomes a high-frequency event. Since a single pass reclaims limited space, the threshold is hit again quickly. The main task and multiple sub-tasks then trigger compaction alternately, and it is not unusual to see a dozen or even dozens of compactions in a single day.
Second, the cached prefix is truncated. Most inference services match caches by prefix: only content that is identical from the very beginning can hit. Compaction rewrites the middle of the history, which invalidates all previously accumulated cache. After compaction, the entire context must be “warmed up” again, and warm-up itself is full-price input.
Together, these form a typical positive feedback loop: compaction → cache invalidation → more expensive input → threshold reached sooner → compaction again.
4. Sub-Task Context Isolation: The Overlooked Amplifier
Multi-agent parallelism is a common way to improve efficiency, but if the main task and each sub-task each maintain a complete history, the context is duplicated many times over. The observed distribution is telling: the main task compacted a dozen times, while three sub-tasks each compacted more than 20 times, on a fully comparable scale.
Reasonable engineering constraints are:
- A sub-task should receive only the minimal context needed to accomplish its sub-goal, rather than inheriting the full history;
- A sub-task should return a structured summary, rather than feeding the complete process back into the main context;
- For parallel sub-tasks of the same kind, reuse the same read-only context to avoid counting it repeatedly.
5. Four Checks to Determine Whether It Is a Program Defect
To distinguish a “mechanism side effect” from an “implementation defect,” use the following checks:
- Threshold check: Is the compaction trigger point stable near the configured value? Drift indicates a problem with threshold judgment.
- Reclaim-rate check: Is the proportion released by a single compaction significantly lower than expected? Being close to zero over the long term is an implementation anomaly.
- Idempotence check: After two consecutive compactions, does the context length converge? If it does not converge, it is a defect.
- Prefix-stability check: Does compaction preserve the cacheable common prefix as much as possible? Rewriting it arbitrarily is a design defect.
Only when two or more of the four checks fail is it appropriate to judge it as a tool-side defect; otherwise, optimization should be prioritized through configuration and usage.
6. An Actionable Optimization Checklist
- Explicitly set a context budget, lower the threshold to a range where space can be reclaimed stably, and compact in small steps—better too often than too rarely;
- Turn off unnecessary full-history feedback and use on-demand retrieval to obtain code context;
- Split long tasks into short sessions, and create a new session on each task switch to naturally keep the prefix stable;
- Put the stable, unchanging system prompt and conventions at the very front to maximize cache hits;
- Use logging services and monitoring alerts to build dashboards and threshold alerts for compaction counts, cache hit rate, and input size per request;
- Run small-sample regression in a container platform or CI environment, using a fixed script to compare per-task consumption before and after optimization.
7. Conclusion
Abnormal usage growth is, in most cases, not a single defect but the result of three factors resonating: low compaction benefit + invalidated cache prefix + duplicated sub-task context. The judgment path should be: attribute first, then check, then optimize—break consumption into the four categories of input, output, cache, and overhead; use the four checks of threshold, reclaim rate, idempotence, and prefix stability to locate the problem boundary; and finally bring costs back under control through budget control, context isolation, and observability. For teams, establishing a baseline metric for per-task consumption has more long-term value than investigating where the quota went after the fact.
