来自Microsoft Research和UC Berkeley的一组研究人员拥有发布 TokenEconomizer,一个用于编码agents的开源成本控制器。 TokenEconomizer是一个插件,在寄存器中从以往的会话中吸取教训,以便在以后的会话中切入废品。 它与Claude Code,Codex,GitHub Copilot CLI和Pi合作。 它不接触模型重量或agent代码。 在277个SWE-Bench任务中,在5个agent模式设置中将平均成本降低了18.4%至30.9%。
TL; DR 数据
- 包:一个标准图书馆Python包和agent插件,有3个可切换机制。
- 运行在:任何运行Claude Code,Codex,Copilot CLI或用Python 3.10+的Pi的机器。 没有GPU和自己的API密钥。
- 性能:18.4%至30.9%,平均SWE-Bench成本较低,所有30个寄存器设置细胞成本更低。
- 最佳:Claude Code和Opus 4.8的费用降低30.9%(与RTK结合时为33.2%)。
最糟糕的是:ReposVul审计只节省了6.4%至9.3%;Pass@1在Opus 4.8上降低了1.0分。
为什么编码 agents 浪费了标志?
每一个agent转动重告系统提示,每一个上载的工具计划以及完整的历史。 研究团队对60个SWE-Bench任务进行了剖析,在6个寄存器中使用Claude Code与Opus 4.8. 他们发现了三个经常性的废物来源:
- 重复发现:一旦在目前的任务之前完成5项任务,30%的工具呼叫重复了先前的行动。
- 未使用的工具:每转弯23个工具计划装载。 16个从未被调用,3个覆盖98%的通话。
- 失败循环:10次失败运行是17%的任务,但占总支出的32%。
他们还测试了3个固定的开源策略:RTK,Serena和Aider的RepoMap. 到处都是便宜货 Django和SymPy的融资全部削减成本。
TokenEconomizer是怎样工作的?
TokenEconomizer是一个外部控制器,将agent作为黑匣子处理。 它保持每个寄存器的状态,由完成的痕迹所建。 在每个任务之前,它通过快取,工具设置和事件流设定出3个政策。
1. 微型技能
LLM提议者将痕量摘要变成一行事实,如工作测试指令。 每个事实都携带了regex探测器,这些探测器在没有模型呼叫的情况下检查后期的痕迹。 3 次确认未重叠编辑文件的任务后,事实会输入提示。 其需求率也必须保持在或高于0.4。 一个自相矛盾就等于5个确认,所以错误的事实会很快消失。
2. 工具修补
贝壳,读取,书写和编辑工具总是保留。 其他工具在连续3个未使用的任务后被蒙上面具,或者当LLM评委将其标记为无关。 完整目录返回每5个任务进行再审计。 在Django和Claude Code上,任务2的第一个请求从43,351个被降为16,295个即时活符。
3. 失败干预
控制器学习回转预算:是成功运行长度的90%的1.25倍。 廉价规则检查标记重复失败或密集错误。 LLM法官然后决定agent是否被卡住,在0.7置信度或更高。 被卡住的agent得到1个重定向,如果循环重现则停止。
SWE -Bench结果显示什么?
资料来源:arXiv 2610.22732,表1. 费用包括所有控制电话。 每架3个种子
5个设置中有4个改进了通路@1。 较低的推理努力节省了成本,但将Pass@1减少了1.8至10.3分。 光是RTK在30个寄存器设置单元格中就花费了12个,而RepoMap在15个。
储蓄逐渐积累。 大多数储存库起初成本较高,但根据第六项任务,所有储存库的成本都较低。 单在Claude Code上,工具穿行节省了13.2%至17.7%,微技术节省了11.8%至14.3%,循环护卫节省了5.4%至7.1%。
在SWE-Bench以外也取得了成果。 在Web-Bench上,成本下降了16.0%至21.2%,在CredData上,成本下降了16.5%至19.6%。 ReposVul只看到6.4%到9.3%,因为较短的运行间隔会减少去除。
与其他节能工具相比如何?
成本行:TokenEconomizer纸张。 许可证和声称:每个项目的仓库或文件。
如何安装 TokenEconomizer?
插件需要4个agents和Python 3.10或更新的之一。 在 Claude Code 上,复制回波,作为市场添加,再运行 claude 插件安装 sordereconomizer@tokeneconomizer. 所学数据保持在~/.tokeneconomizer中。 工具刷新和循环保护默认进行。 微技能默认关闭,因为求婚者新增模型调用。
关键外卖
- TokenEconomizer 削减 SWE-Bench 成本为18.4%至30.9%,agent不变。
- 在所有30个存储器设置单元中,价格较低;RTK和RepoMap没有。
- 工具推跑是最大的单一杠杆,为13.2%至17.7%。
- Pass@1在5个设置中有4个上升,在Opus 4.8上跌了1.0分。
-是Apache 2.0,安装在Claude Code,Codex,Copilot CLI和Pi上。
请检查access-date=中的日期值 (帮助) 页面存档备份,存于互联网档案馆页面存档备份,存于互联网档案馆页面存档备份。 并加入我们的通讯。 等等,你在电报里吗?现在你也可以加入我们的电报。
需要和我们合作推广您的 GitHub Repo OR Hugging Face Page OR Product Release OR Webinar等吗?联系我们
Asif Razzaq是Marktechpost AI Media Inc.的首席执行官。 作为一个有远见的企业家和工程师,阿西夫致力于利用人工智能的潜力为社会造福。 他最近的努力是人工智能媒体平台的发布,该平台以深入报道机器学习和深层学习新闻而出名,这些新闻在技术上既可靠又为广大观众所容易理解。 该平台每月有超过200万次观看,表明其受观众欢迎。
本文由 AI宝库自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
A team of researchers from Microsoft Research and UC Berkeley have released TokenEconomizer, an open-source cost controller for coding agents. TokenEconomizer is a plugin that learns from past sessions in a repository to cut waste in later ones. It works with Claude Code, Codex, GitHub Copilot CLI and Pi. It does not touch model weights or agent code. On 277 SWE-Bench tasks, it lowered mean cost by 18.4% to 30.9% across 5 agent-model settings.
TL;DR
- Package: A standard-library Python package and agent plugins, with 3 switchable mechanisms.
- Runs on: Any machine running Claude Code, Codex, Copilot CLI or Pi with Python 3.10+. No GPU and no API key of its own.
- Performance: 18.4% to 30.9% lower mean SWE-Bench cost, and cheaper in all 30 repository-setting cells.
- Best: 30.9% lower cost on Claude Code with Opus 4.8 (33.2% when combined with RTK).
- Worst: Only 6.4% to 9.3% savings on ReposVul audits; Pass@1 drops 1.0 point on Opus 4.8.
Why do coding agents waste tokens?
Every agent turn re-bills the system prompt, every loaded tool schema and the full history. The research team profiled 60 SWE-Bench tasks across 6 repositories using Claude Code with Opus 4.8. They found 3 recurring sources of waste:
- Repeated discovery: once 5 tasks precede the current one, 30% of tool calls repeat an earlier action.
- Unused tools: 23 tool schemas load every turn. 16 are never called, and 3 cover 98% of calls.
- Failure loops: 10 failed runs were 17% of tasks but 32% of total spend.
They also tested 3 fixed open-source strategies: RTK, Serena and Aider’s RepoMap. None was cheaper everywhere. All 3 cut cost on Django and raised it on SymPy.
How does TokenEconomizer work?
TokenEconomizer is an external controller that treats the agent as a black box. It keeps a state per repository, built from completed traces. Before each task, it sets 3 policies through the prompt, the tool settings and the event stream.
1. Micro-skills
An LLM proposer turns trace digests into 1-line facts, such as the working test command. Each fact carries regex detectors that check later traces without a model call. A fact enters the prompt after 3 confirmations on tasks with non-overlapping edited files. Its need rate must also stay at or above 0.4. One contradiction counts as 5 confirmations, so wrong facts retire quickly.
2. Tool pruning
Shell, read, write and edit tools are always kept. Other tools are masked after 3 consecutive unused tasks, or when an LLM judge marks them irrelevant. The full catalog returns every 5 tasks for a re-audit. On Django with Claude Code, the first request on task 2 fell from 43,351 to 16,295 prompt tokens.
3. Failure-loop intervention
The controller learns a turn budget: 1.25 times the 90th percentile of successful run lengths. Cheap rule checks flag repeated failures or dense errors. An LLM judge then decides if the agent is stuck, at 0.7 confidence or higher. A stuck agent gets 1 redirect, then a stop if the loop recurs.
What do the SWE-Bench results show?
Source: arXiv 2610.22732, Table 1. Costs include all controller calls. 3 seeds per setting.
Pass@1 improved in 4 of 5 settings. Lower reasoning effort saved cost but cut Pass@1 by 1.8 to 10.3 points. RTK alone raised cost in 12 of 30 repository-setting cells, and RepoMap in 15.
Savings build over time. Most repositories cost more at first, but all were cheaper by the sixth task. Alone on Claude Code, tool pruning saved 13.2% to 17.7%, micro-skills 11.8% to 14.3%, and the loop guard 5.4% to 7.1%.
Results also held outside SWE-Bench. Costs fell 16.0% to 21.2% on Web-Bench and 16.5% to 19.6% on CredData. ReposVul saw only 6.4% to 9.3%, because shorter runs leave less to remove.
How does it compare with other token-saving tools?
Cost rows: TokenEconomizer paper. Licenses and claims: each project’s repository or docs.
How do you install TokenEconomizer?
The plugin needs one of the 4 agents and Python 3.10 or newer. On Claude Code, clone the repo, add it as a marketplace, then run claude plugin install tokeneconomizer@tokeneconomizer. Learned data stays local in ~/.tokeneconomizer. Tool pruning and the loop guard are on by default. Micro-skills are off by default, because the proposer adds model calls.
Key Takeaways
- TokenEconomizer cuts SWE-Bench cost 18.4% to 30.9% with an unchanged agent.
- It was cheaper in all 30 repository-setting cells; RTK and RepoMap were not.
- Tool pruning is the biggest single lever, at 13.2% to 17.7%.
- Pass@1 rose in 4 of 5 settings and fell 1.0 point on Opus 4.8.
- It is Apache 2.0 and installs on Claude Code, Codex, Copilot CLI and Pi.
Check out the Paper, GitHub Repo and Project Page. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
Asif Razzaq is the CEO of Marktechpost AI Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.
Auto-fetched and translated by AI Gem Box. All rights belong to the original author.