arXiv:2604.22750cs.CLcs.AI2026-04被引 21

AI编程代理耗能惊人,且难以预测。

How Do AI Agents Spend Your Money? Analyzing and Predicting Token Consumption in Agentic Coding Tasks

论文配图:How Do AI Agents Spend Your Money? Analyzing and Predicting Token Consumption in Agentic Coding Tasks
图 1 · 摘自论文原文
  • 分析8个前沿模型在代码任务中的耗token模式
  • 同一任务耗量差30倍,高耗能不等于高准确率
  • 大模型普遍低估自身耗能,适合成本优化研究者

AI代理在复杂任务中导致大语言模型(LLM)的令牌消耗急剧增长。本文首次系统研究了代理式编程任务中的令牌消耗模式。我们在SWE-bench Verified数据集上分析了八个前沿大模型的执行轨迹,并评估模型在任务执行前预测自身令牌成本的能力。结果发现:(1) 代理任务极其昂贵,耗量达代码推理和聊天的1000倍,主要由输入令牌驱动;(2) 耗量高度波动且随机,相同任务的总令牌数可相差30倍,更高耗能并不提升准确率,准确率常在中等成本时达到峰值并饱和;(3) 模型间效率差异显著,在相同任务上,Kimi-K2和Claude-Sonnet-4.5平均比GPT-5多消耗超过150万令牌;(4) 人类专家评定的任务难度与实际耗量关联较弱,暴露出人眼复杂度感知与代理实际计算开销之间的根本差距;(5) 前沿模型无法准确预测自身耗量(相关性仅0.39),且系统性低估真实成本。本研究为理解AI代理的经济成本提供了新视角,可推动后续相关研究。

原文摘要 · Abstract (English)

The wide adoption of AI agents in complex human workflows is driving rapid growth in LLM token consumption. When agents are deployed on tasks that require a significant amount of tokens, three questions naturally arise: (1) Where do AI agents spend the tokens? (2) Which models are more token-efficient? and (3) Can agents predict their token usage before task execution? In this paper, we present the first systematic study of token consumption patterns in agentic coding tasks. We analyze trajectories from eight frontier LLMs on SWE-bench Verified and evaluate models' ability to predict their own token costs before task execution. We find that: (1) agentic tasks are uniquely expensive, consuming 1000x more tokens than code reasoning and code chat, with input tokens rather than output tokens driving the overall cost; (2) token usage is highly variable and inherently stochastic: runs on the same task can differ by up to 30x in total tokens, and higher token usage does not translate into higher accuracy; instead, accuracy often peaks at intermediate cost and saturates at higher costs; (3) models vary substantially in token efficiency: on the same tasks, Kimi-K2 and Claude-Sonnet-4.5, on average, consume over 1.5 million more tokens than GPT-5; (4) task difficulty rated by human experts only weakly aligns with actual token costs, revealing a fundamental gap between human-perceived complexity and the computational effort agents actually expend; and (5) frontier models fail to accurately predict their own token usage (with weak-to-moderate correlations, up to 0.39) and systematically underestimate real token costs. Our study offers new insights into the economics of AI agents and can inspire future research in this direction.

AI代理耗能分析成本预测

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。