← Latest papers
💬 NLP

Token Reduction Is Not Cost Reduction

This paper demonstrates that reducing token counts in coding agent contexts does not reliably lower billed costs due to the dominance of prompt-cache traffic and the risk of task failure, arguing instead for evaluating cost-efficiency based on success-adjusted billed cost rather than token reduction alone.

Original authors: Sarel Weinberger, Amir Hozez

Published 2026-07-15
📖 6 min read🧠 Deep dive

Original authors: Sarel Weinberger, Amir Hozez

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you're running a high-tech detective agency where your super-smart AI detectives (called "coding agents") solve mysteries by reading files, running commands, and chatting with you. Every time they read a file or run a command, you get a bill from the cloud provider.

For a long time, everyone thought the best way to save money was to make the detectives read less text. The logic was simple: "If we compress the files they read, we cut the word count, so the bill goes down!" It sounded like a perfect plan, like packing a suitcase by squeezing out all the air.

But this paper, titled "Token Reduction Is Not Cost Reduction," is here to tell us that the suitcase analogy is a trap. The authors ran a massive experiment—over 2,908 detective runs across 7 different codebases and 3 different AI models—to see what actually happens to the bill.

Here is the twist they discovered: Shrinking the text doesn't always shrink the bill. In fact, sometimes shrinking the text makes the bill go up.

The "Cached Memory" Surprise

The biggest shocker is where the money actually goes. The authors broke down the bill and found that 87% of the reconstructed cost (and about 80% of the actual bill) comes from something called "prompt-cache traffic."

Think of the AI's memory like a super-fast, magical whiteboard.

  • Writing on the board (Cache Creation): This costs money, but it's a one-time fee.
  • Reading from the board (Cache Reads): This is super cheap, like getting a discount coupon.
  • New text (Uncached Input): This is the expensive part, but it's actually a tiny slice of the pie (only about 1.3% of the bill!).

However, there's a hidden cost the whiteboard doesn't show clearly. The authors found an 8.7% "unattributed residual" in the bill that their standard breakdown couldn't explain. This leftover chunk isn't random; it scales directly with how hard the AI is thinking. On the Haiku 4.5 model, the more "thinking effort" you set, the bigger this mysterious bill gets. It suggests that even when the text looks small, the AI might be doing expensive mental work that doesn't show up in the token count.

The problem is that when you compress text, you aren't just saving on the "New text" part. You might be messing with the "Reading from the board" part. If you compress a file too much, the AI might get confused, forget what it was doing, and have to go back and re-read the entire history of the conversation to figure it out.

Every time the AI has to re-read that history, it has to write it to the board again. And writing is expensive! So, even if you saved a few words, you forced the AI to pay the "writing fee" again and again.

The "38% Cut" That Cost More

The authors tested a fancy compression system (called RTK-ML) that successfully cut 38.4% of the raw tool-output text. You'd think that would save a fortune, right?

Wrong.
In their paired tests, this system actually increased the cost by 6.8% (with a 95% confidence interval of [+2.8, +11.3]).

Why? Because the compression was so aggressive that the AI had to take extra steps to solve the problem. It had to run extra diagnostic turns, re-read files, and ask more questions. Each of those extra steps meant re-transmitting the whole conversation history, which wiped out any savings from the text compression.

The paper explicitly rules out the idea that "fewer tokens = lower cost." They found that the relationship between how much text you remove and how much money you save is basically non-existent. The correlation was a weak 0.15, which is so close to zero that it's practically a coin flip.

The "Broken Anchor" Disaster

There's another way compression can backfire: it can break the clues the AI needs to do its job.

The authors ran a special test on Go programming tasks. They found that when they compressed the text, the AI sometimes lost the "verbatim edit anchors"—the exact, byte-for-byte lines of code it needed to copy and paste to fix a bug.

Imagine trying to fix a leak in a pipe, but the instructions you're reading have been squished so much that the specific part you need to cut is now a blurry smudge. The AI tries to fix it, but the "patch" (the fix) doesn't fit because the instructions were corrupted.

  • Without compression: The AI successfully applied 27 out of 40 patches.
  • With compression: The AI only managed 15 out of 40.

In this specific test, the compressed version didn't just cost more per successful fix; it actually failed more often. The authors note that while the compressed version looked cheaper per attempt, the "cost per solved problem" was actually double ($0.515 vs. $0.248) because it failed so many times.

The "Black Box" Proxy

They also tested a different tool called Headroom, which acts like a middleman that rewrites the messages before they hit the AI. This one was a total disaster for the wallet. It made the cost 48.4% higher (with a 95% CI of [+42.3, +55.0]) than doing nothing at all, with no improvement in success rates.

The Bottom Line

The paper concludes that if you want to save money on AI coding agents, you can't just look at a "token counter" and assume you're winning.

  • What they proved: In these specific, real-world tests, cutting text did not reliably lower costs. In fact, for the RTK-ML system, it made things more expensive. For Headroom, it made things much more expensive.
  • What they measured: They didn't just guess; they tracked 2,908 actual runs with real bills totaling around $175.92 (just for the main campaign), plus an extra 8.7% of the bill that scales with thinking effort and couldn't be explained by standard token counts.
  • What they suggest: The only way to know if a compression tool works is to measure the final bill per successful task, not the number of words removed.

So, the next time someone tells you, "We compressed the data by 50% to save you money!" you can smile and say, "Cool, but did you check if the AI had to re-read the whole book because of it?" Because in the world of AI agents, sometimes the shortest path is the most expensive one.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →