virus spreading by means of huge tech.
Engineers are being judged, instantly or not directly, by how a lot AI they will eat. Extra tokens, extra output, extra compute. Some corporations even had leaderboards.
It’s the 2026 model of rating engineers by traces of code.
Much less is extra
Tokenminning is the antithesis of tokenmaxxing.
Token effectivity turns into more and more necessary as your utilization grows. Each pointless token will increase value, latency and complexity.
Tokenminning is a brand new sample, which systematically minimizes token use whereas sustaining, if not bettering, the efficiency of your AI brokers.
On this article, I cowl sensible methods for tokenminning that I exploit to cut back prices. All of those methods will be deployed with out vital refactoring.
The consequence: considerably decrease AI prices and not using a sacrifice in high quality
The Price of Tokenmaxxing
Tokenmaxxing and different naïve approaches to AI utilization share a typical assumption: inputs with extra tokens result in higher outputs.
This assumption results in bigger than essential prompts, loaded with uncompressed context and RAG bloat. In some circumstances, it could enhance efficiency, however, it introduces some vital issues.
1. Monetary Price
Unsurprisingly, prices skyrocket.
Each token despatched to and generated by a mannequin has a worth. Interactive chats have cheap sized inputs and outputs, so naively estimated prices first appear manageable.
Nevertheless, actual agent token utilization violates all the assumptions you could have had relating to common token use. Working long-running brokers with frontier fashions can lead to ridiculous prices.
What are actual prices for utilizing AI daily?
I carried out a fast evaluation of my very own private utilization, for interactive chats and for my brokers.
For context, I’m presently the pinnacle of AI for a biotech startup. I exploit AI as an interactive analysis assistant (medical papers, most cancers analysis, machine studying), and I’ve additionally developed a number of brokers which carry out the next duties:
- Code evaluation and automatic unit testing: I push code each day, and these brokers carry out vulnerability evaluation, floor potential points and repair minor points
- Experiment administration: observe and doc a number of working coaching experiments
- Devops: managing AWS assets, automating occasion provisioning and common cloud administration help to optimize prices
Right here is the breakdown:
| Supply | Enter Tokens | Output Tokens | Complete | Day by day Complete |
| Interactive Chat (per chat) |
492 | 1650 | 2142 | 42,840 |
| Brokers (per invocation) |
56,497 | 4,594 | 61,091 | 1,221,820 |
As you’ll be able to see, my interactive chats pale compared to my brokers. With these numbers, I might spend roughly $40 per day in API utilization prices utilizing Claude Opus 4. I spend fairly a bit much less, attributable to optimizations.
Some engineers spend way more per day, particularly in the event you use autonomous engineering brokers. In some circumstances, engineers have reported spending over $10,000 per week1
Consequently, huge tech corporations have began to implement AI utilization limits.
2. Inference Velocity
Extra tokens additionally imply extra latency.
Logically, bigger prompts take longer to course of, rising the time-to-first-token and total response instances. This may be detrimental with buyer going through AI or time delicate brokers.
3. High quality
A giant false impression is that extra context produces higher outcomes. That is merely not the case, particularly with very lengthy contexts.
Fashions have restricted consideration. As prompts turn out to be more and more giant, necessary info competes with irrelevant particulars for the mannequin’s focus. “Context rot,” is an actual drawback2, the place LLMs turn out to be much less efficient because the context grows, and a focus effectiveness deteriorates unusually with giant context: it really works for the start and finish of the context window, however degrades within the center3
Typically, the business is shifting mindsets in direction of context high quality, not context quantity for simpler AI use.
🛠️ Actual methods for “tokenminning”
In the event you haven’t already skilled the true value of utilizing AI, the issues outlined above ought to now be evident.
AI engineers want to begin occupied with the best way to realistically cut back token use whereas maintaining efficiency excessive.
Listed here are a couple of methods I exploit to cut back AI prices. These methods are conceptually easy to keep away from derailing present AI workflows.
Technique #1: Routing
Realistically, most prompts don’t want a frontier mannequin.
It’s true, fashions like Claude Opus or GPT 5.5 excel at complicated reasoning, planning, and tough coding duties.
However easy requests, like device utilization, summarization and classification will be dealt with by smaller, decrease value fashions. You might even route these to a quantized native mannequin and skip the API value all collectively.
Right here, routing isn’t used as a token minimization technique, however as a brute drive value discount approach that works devastatingly effectively. Consequently, many corporations are doing it.
Here’s a excessive degree abstract of the way it works:
A light-weight self-hosted webservice intercepts every immediate request
This webservice is light-weight, and conforms to both the OpenAI Chat Completions API or the Anthropic Messages API, relying on who your supplier is. This webservice is often known as an “LLM Gateway.”
You should utilize this terribly bloated LiteLLM library or roll your individual*, which is ~1 day of precise work and testing (probably much less in the event you agentically code it.)
Throughout the webservice, you’ll need the next hooks for every immediate:
- Course of: run any preprocessing required for every immediate
- Consider: run classification on the processed immediate
- Route: primarily based off the analysis, apply predefined guidelines to pick out the mannequin
- Execute: execute the LLM name with the chosen mannequin
- Validate: [optional, but helpful], run validation guidelines on the output
- Return: Format and return the consequence to the caller
* There are a couple of hidden complexities to rolling your individual, make sure you take note of streaming the response again from the supplier in addition to token counting, which varies throughout supplier.
Consider every immediate with a pretrained mannequin
Inside your consider hook, a number of pretrained classifiers evaluates the immediate, returning each the intent of the immediate and the complexity, a rating from 0 to 1.0.
🤚So I’ve to coach a classifier on prompts?
Presumably. Listed here are your choices:
If you wish to go together with an off the shelf classifier, the chief is NVIDIA’s NemoCurator Immediate Process and Complexity Classifier4. It makes use of a fusion complexity rating and evaluates prompts for creativity, reasoning, specialised area data, and many others. and its structure + weights are publicly out there.
You might discover that it’s extra efficient to coach your individual. Nemocurator was skilled on prompts from many domains, reminiscent of artistic writing, science, programming, and many others.
That is wasted mannequin capability in case your workforce is generally engaged on distributed machine studying and RL, and the standard of the predictions will undergo.
Not all is wasted. The Nemocurator can both be fine-tuned, or skilled from scratch with prompts taken instantly from you (or your workforce).
Coaching a classifier for prompts
The structure from NVIDIA’s immediate and complexity classifier makes use of a pretrained DeBERTa5 spine, with a number of classification heads. We modified this structure, leaving solely two heads, one for the intent class and one for the complexity rating.
Intent Courses
We use the next intent courses, largely impressed by the unique analysis from NVIDIA.
- Open QA
- Closed QA
- Device Name
- Summarization
- Code Technology
- Classification
- Rewrite
- Brainstorming
- Extraction
Complexity
As a way to map complexity to a scalar, we first have to quantify the extent of reasoning required to sufficiently reply the immediate. The hybrid complexity rating methodology utilized in Nemocurator was inapplicable for our wants.
Knowledge assortment
Our LLM gateway collected prompts over a time frame (we collected over 10,000 prompts, however a minimal of 4000 is beneficial).
For every immediate:
We consider it with (4) separate fashions at totally different reasoning ranges, an area quantized LLM (Qwen 3.5 9B), a low tier mannequin (GPT 5 mini), a medium tier reasoning mannequin (GPT 5.5) and a frontier reasoning mannequin (o3-pro).
| Mannequin | Tier | Low Reasoning | Medium Reasoning |
Excessive Reasoning |
|---|---|---|---|---|
| Qwen 3.5 9B | Native | ❌ | ❌ | ❌ |
| GPT-5 mini | Low-tier | ✅ | ✅ | ✅ |
| GPT-5.5 | Medium-tier | ✅ | ✅ | ✅ |
| o3-pro | Frontier | ❌ | ❌ | ✅ |
We chosen every mannequin primarily based off of the fee class. Anthropic (or different) can have related availability.
Working every mannequin, with the reasoning ranges above, gave 8 separate solutions to every immediate.
To categorise the intent of the immediate: we used GPT 5.5 (medium reasoning) to label the intent of every given the enter and metadata from the LLM gateway (our gateway collects the calling software and agent).
To quantify the complexity: We once more used GPT 5.5 (medium reasoning) to judge the minimal degree {that a} query was sufficiently answered at every of the 8 ranges.
| Mannequin | Rating Methodology | Particulars |
|---|---|---|
| Qwen 3.5 9B | Base | A base rating of 0.1 given |
| GPT-5 mini | Base + Scaled Reasoning | A base rating of 0.2 + a scaled worth primarily based on the reasoning degree + variety of tokens used |
| GPT-5.5 | Base + Scaled Reasoning | A base rating of 0.4 + a scaled worth primarily based on the reasoning degree + variety of tokens used |
| o3-pro | Base | A rating of 1.0 given |
This complexity scoring methodology gave us a scalar worth for every immediate, starting from 0.1 to 1.0.
This gave us the coaching knowledge required to coach the mannequin.
Coaching the mannequin
As talked about beforehand, we reused the structure launched by NVIDIA’s Nemocurator, which merely has a pretrained DeBERTa spine with separate classification heads.
Our mannequin makes use of a simplified model, with two heads:
- A classifier head which was optimized through cross-entropy loss on the intent targets
- A regression head which was optimized utilizing MSE on the complexity scores
This gave us an eval accuracy of ~0.94 on intent class and an affordable MSE, which we deemed correct sufficient for routing.
Be aware: The intricacies of the coaching course of (coaching vs analysis, nice tuning studying charges, gradients, and many others.) have deliberately been omitted to take care of the article’s focus
This mannequin provides us a option to deterministically consider every immediate
Routing every immediate to the right mannequin
That is half science and half guesswork. Nobody routing framework will work for everybody.
To develop a routing desk (with each the intent and the complexity), we thought of the constraints our firm has and the sorts of knowledge we work with.
The consider step outputs:
{
"immediate": "...",
"intent": "closed_qa",
"complexity": 0.4,
// different metadata
...
}
Right here, every of the fashions in our structure is mapped to each an intent and a complexity rating.
| Class | Low Complexity x < 0.2 | Medium Complexity 0.2 < x <= 0.7 |
Excessive Complexity x > 0.7 |
|---|---|---|---|
| Open QA | GPT 5.5 (Excessive) |
GPT 5.5 (Excessive) |
GPT 5.5 (Excessive) |
| Closed QA | Qwen 3.5 |
GPT 5.5 (Med) |
GPT 5.5 (Excessive) |
| Device Name | Qwen 3.5 |
GPT-5 mini (Low) |
GPT-5 mini (Medium) |
| Summarization | Qwen 3.5 |
GPT-5 mini (Low) |
GPT 5.5 (Excessive) |
| Code Technology | GPT 5.5 (Low) |
GPT 5.5 (Excessive) |
o3-pro |
| Classification | Qwen 3.5 |
GPT-5 mini (Medium) |
GPT-5 mini (Excessive) |
| Rewrite | GPT-5 mini (Low) |
GPT-5 mini (Med) |
GPT-5 mini (Med) |
| Brainstorming | GPT 5.5 (Excessive) |
GPT 5.5 (Excessive) |
GPT 5.5 (Excessive) |
| Extraction | Qwen 3.5 |
GPT 5.5 (Low) |
GPT 5.5 (Excessive) |
📝We’ve got different “particular class prompts”, like medical paper summarization, machine studying analysis overview which get auto-escalated to particular goal fashions, like o3-pro.
We’re nonetheless creating the best routing desk for our group which balances accuracy and prices.
Some key takeaways:
- When producing code, default to premium fashions. This ends in fewer roundtrip requests to repair errors.
- For summarizing, offload to the native mannequin or decrease tier mannequin.
The artwork right here is performing the utmost degree of downgrading whereas nonetheless sustaining high quality and efficiency. Systematically instrumenting your AI calls (with a homebrew device or a vendor) is paramount to examine success charges.
Executing, validating and returning the request
The remainder of the precise routing is comparatively easy to carry out, given the goal mannequin. Merely, execute the request in opposition to the specified API, Validate the response and return the info to the calling software.
If desired, right here you might carry out a model of cascaded routing, relying on if the immediate was efficiently resolved with the mannequin chosen. We’re nonetheless evaluating strategies to do that deterministically, with out having to make one other LLM name, which might invalidate the aim of routing altogether.
Routing is essential
Implementing a routing layer would possibly look like a heavy elevate at first look.
However while you take a look at the economics of LLM utilization at scale, this isn’t only a intelligent hack, it’s a foundational piece of AI structure.
💵💵 Utilizing solely routing, we’ve decreased our AI utilization prices by over 60% 💵💵
We’re nonetheless debugging, however the outcomes are fairly promising.
Technique #2: Context Compaction
Context home windows have turn out to be ultra-large. The dimensions of a 256k or 1M token context window isn’t actually understood till it’s comparatively in contrast.
For instance, a 256k token context window can maintain the primary two books of the Harry Potter collection with room to spare.
A 1M token context window can maintain your entire Lord of the Rings collection plus The Hobbit, and nonetheless go away house for added context.
Large context home windows are altering how we construct AI techniques. Nevertheless, they arrive with main drawbacks as beforehand mentioned: value and diminishing effectiveness at scale.
For builders occupied with tokenminning, prices and effectiveness, context compression, or “compaction” is crucial. Don’t naively load each interplay into historical past, however “delicately” choose info primarily based off the present process.
Right here’s an actual world sample you’ll be able to make use of with out main modifications to your brokers.
Compaction (lossy)
That is one we use with our long-running brokers and it really works effectively, however comes with some tradeoffs.
As an agent nears a predefined restrict (both the higher tail of the context window or a restrict set by you), a summarization step happens.
This summarization step at all times runs with a decrease order mannequin, with the purpose of retaining the related element of every agent step with out destroying info.
Throughout the agent loop:
# Compress earlier than the mannequin hits the onerous restrict
COMPACTION_THRESHOLD=32000
# the remainder of agent loop is omitted for brevity
token_count = count_tokens([messages, memory])
if token_count >= COMPACTION_THRESHOLD:
compacted_state = compact_context(
compact_prompt=compact_prompt,
messages=messages,
reminiscence=reminiscence
)
# change the present context with the compacted context
messages = [
*messages[:2], # preserve system + preliminary context
{
"function": "system",
"content material": compacted_state
}
]}
# proceed agent loop with summarized context
we run a compact_context step after we attain a predefined threshold, with a compaction immediate just like the next:
You're a context compaction system for an autonomous coding agent.
Your process is to compress the present dialog historical past right into a
compressed, structured reminiscence state.
Protect: architectural choices, accomplished work,
unresolved bugs and implementation particulars
Discard: redundant device outputs, messages, intermediate reasoning
Don't summarize vaguely. Extract actionable state. Return the consequence
in markdown format:
## Goal
[What are we trying to accomplish?]
## Present State
[Where things stand now]
## Key Choices
- Choice:
Cause:
## Technical Context
[Important architecture, code, configuration, environment details]
## Accomplished Work
- [Completed items]
## Remaining Duties
- [Next actions]
## Agent Reminiscence
[Reusable information that would help in future sessions]
What’s good about this method is that its very simple and usually results in higher outcomes with the agent, particularly with lengthy working agent periods.
Forcing the agent to construction its abstract is a good way to distill necessary info.
It’s extraordinarily necessary to tune your compaction step for recall, making certain that probably the most related and necessary particulars are retained when compressing context. However, as talked about, it’s inherently lossy. You’ll have to throw away info, which will increase the danger of hallucinations or errors.
Wrapping up
“Tokenmaxxing” is a symptom of a still-evolving business.
Tokenminning isn’t nearly saving cash, it’s about remodeling AI use right into a self-discipline. Clever routing and compaction are simply the primary steps to take. The business is shifting towards extra superior strategies, reminiscent of structured episodic reminiscence, that intention to make brokers extra environment friendly with out sacrificing functionality.
AI dominance will belong to the groups that optimize for outcomes, not token quantity. Cease chasing token counts. Begin chasing effectiveness.
References:
[1]: Bellan, R. (2026, June 5). The token invoice comes due: Contained in the business scramble to handle AI’s runaway prices. TechCrunch.
[2]: Hong, Ok., Troynikov, A., & Huber, J. (2025). Context Rot: How Rising Enter Tokens Impacts LLM Efficiency. Chroma.
[3]: Liu, N. F., et al. (2023). “Misplaced within the Center: How Language Fashions Use Lengthy Contexts.” Stanford College.
[4]: NVIDIA. (2025). NemoCurator Immediate Process and Complexity Classifier (Model 1.1) [Machine learning model]. NVIDIA NGC. https://catalog.ngc.nvidia.com/orgs/nvidia/nemo/fashions/prompt-task-and-complexity-classifier
Related hyperlinks:
[5]: P. He, X. Liu, J. Gao, and W. Chen, “DeBERTa: Decoding-enhanced BERT with Disentangled Consideration,” Worldwide Convention on Studying Representations (ICLR), 2021.





