virus spreading by huge tech.
Engineers are being judged, straight or not directly, by how a lot AI they’ll devour. Extra tokens, extra output, extra compute. Some firms even had leaderboards.
It’s the 2026 model of rating engineers by strains of code.
Much less is extra
Tokenminning is the antithesis of tokenmaxxing.
Token effectivity turns into more and more essential as your utilization grows. Each pointless token will increase price, 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 take advantage of to scale back prices. All of those methods might be deployed with out vital refactoring.
The outcome: considerably decrease AI prices with no sacrifice in high quality
The Value 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 mandatory prompts, loaded with uncompressed context and RAG bloat. In some circumstances, it might enhance efficiency, however, it introduces some vital issues.
1. Monetary Value
Unsurprisingly, prices skyrocket.
Each token despatched to and generated by a mannequin has a value. Interactive chats have affordable sized inputs and outputs, so naively estimated prices first appear manageable.
Nonetheless, actual agent token utilization violates all the assumptions you might have had relating to common token use. Working long-running brokers with frontier fashions may end up in ridiculous prices.
What are actual prices for utilizing AI everyday?
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 take advantage of 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: monitor and doc a number of operating 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 | Whole | Day by day Whole |
| 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’d spend roughly $40 per day in API utilization prices utilizing Claude Opus 4. I spend fairly a bit much less, because of optimizations.
Some engineers spend way more per day, particularly in case you use autonomous engineering brokers. In some circumstances, engineers have reported spending over $10,000 per week1
In consequence, huge tech firms 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 occasions. This may be detrimental with buyer dealing with 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, essential info competes with irrelevant particulars for the mannequin’s focus. “Context rot,” is an actual downside2, 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 the 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 price of utilizing AI, the issues outlined above ought to now be evident.
AI engineers want to start out fascinated by find out how to realistically scale back token use whereas protecting efficiency excessive.
Listed here are a couple of methods I take advantage of to scale 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 might be dealt with by smaller, decrease price fashions. It’s possible you’ll even route these to a quantized native mannequin and skip the API price all collectively.
Right here, routing isn’t used as a token minimization technique, however as a brute drive price discount method that works devastatingly effectively. In consequence, many firms 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 use this terribly bloated LiteLLM library or roll your individual*, which is ~1 day of precise work and testing (probably much less in case you agentically code it.)
Inside 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: based mostly 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 outcome 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 along 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 information, and so forth. and its structure + weights are publicly out there.
It’s possible you’ll discover that it’s extra efficient to coach your individual. Nemocurator was skilled on prompts from many domains, reminiscent of inventive writing, science, programming, and so forth.
That is wasted mannequin capability in case your staff is usually engaged on distributed machine studying and RL, and the standard of the predictions will endure.
Not all is wasted. The Nemocurator can both be fine-tuned, or skilled from scratch with prompts taken straight from you (or your staff).
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 Lessons
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
In an effort to map complexity to a scalar, we first must 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 period (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 based mostly off of the price class. Anthropic (or different) could 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 utility 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 Technique | 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 based mostly on the reasoning degree + variety of tokens used |
| GPT-5.5 | Base + Scaled Reasoning | A base rating of 0.4 + a scaled worth based mostly 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 by way of 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 inexpensive MSE, which we deemed correct sufficient for routing.
Notice: The intricacies of the coaching course of (coaching vs analysis, high quality tuning studying charges, gradients, and so forth.) have deliberately been omitted to take care of the article’s focus
This mannequin offers us a strategy to deterministically consider every immediate
Routing every immediate to the proper 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 forms 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 now have different “particular class prompts”, like medical paper summarization, machine studying analysis assessment which get auto-escalated to particular function fashions, like o3-pro.
We’re nonetheless creating the simplest 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 information to the calling utility.
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 vital
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 diminished 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 complete Lord of the Rings collection plus The Hobbit, and nonetheless go away area for extra context.
Large context home windows are altering how we construct AI methods. Nonetheless, they arrive with main drawbacks as beforehand mentioned: price and diminishing effectiveness at scale.
For builders fascinated by tokenminning, prices and effectiveness, context compression, or “compaction” is crucial. Don’t naively load each interplay into historical past, however “delicately” choose info based mostly 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 all the time runs with a decrease order mannequin, with the objective of retaining the related element of every agent step with out destroying info.
Inside the agent loop:
# Compress earlier than the mannequin hits the laborious 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
)
# substitute the present context with the compacted context
messages = [
*messages[:2], # maintain system + preliminary context
{
"position": "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 outcome
in markdown format:
## Goal
[What are we trying to accomplish?]
## Present State
[Where things stand now]
## Key Choices
- Determination:
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 strategy is that its very simple and usually results in higher outcomes with the agent, particularly with lengthy operating agent classes.
Forcing the agent to construction its abstract is a good way to distill essential info.
It’s extraordinarily essential to tune your compaction step for recall, making certain that probably the most related and essential 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 chance of hallucinations or errors.
Wrapping up
“Tokenmaxxing” is a symptom of a still-evolving business.
Tokenminning isn’t nearly saving cash, it’s about reworking 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 methods, reminiscent of structured episodic reminiscence, that goal 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 Growing 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.















