arXiv:2601.14470cs.SEcs.AI2026-01被引 9

分析智能体编程中令牌消耗分布,发现代码评审最耗资源。

Tokenomics: Quantifying Where Tokens Are Used in Agentic Software Engineering

  • 追踪6个开发阶段的输入/输出/推理令牌使用情况
  • 代码评审占总令牌消耗59.4%,输入令牌占53.9%
  • 适合关注成本优化与效率提升的开发者和研究者

基于大模型的多智能体系统在需求工程、代码生成和测试等复杂软件工程任务中日益普及,但其运行效率与资源消耗尚不明确,导致成本不可预测且环境影响显著。本文针对软件开发生命周期中的令牌消耗模式进行分析,利用ChatDev框架在GPT-5推理模型下完成30个开发任务的执行轨迹,将内部阶段映射至设计、编码、代码补全、代码评审、测试和文档六个阶段,建立标准化评估框架。通过量化各阶段输入、输出与推理令牌的分布,发现迭代式代码评审平均消耗59.4%的总令牌,输入令牌平均占比达53.9%。结果表明,智能体编程的主要成本并非初始代码生成,而在于自动化修正与验证过程。该方法可帮助从业者预估开销并优化流程,也为未来更高效的智能体协作协议研究提供方向。

原文摘要 · Abstract (English)

LLM-based Multi-Agent (LLM-MA) systems are increasingly applied to automate complex software engineering tasks such as requirements engineering, code generation, and testing. However, their operational efficiency and resource consumption remain poorly understood, hindering practical adoption due to unpredictable costs and environmental impact. To address this, we conduct an analysis of token consumption patterns in an LLM-MA system within the Software Development Life Cycle (SDLC), aiming to understand where tokens are consumed across distinct software engineering activities. We analyze execution traces from 30 software development tasks performed by the ChatDev framework using a GPT-5 reasoning model, mapping its internal phases to distinct development stages (Design, Coding, Code Completion, Code Review, Testing, and Documentation) to create a standardized evaluation framework. We then quantify and compare token distribution (input, output, reasoning) across these stages. Our preliminary findings show that the iterative Code Review stage accounts for the majority of token consumption for an average of 59.4% of tokens. Furthermore, we observe that input tokens consistently constitute the largest share of consumption for an average of 53.9%, providing empirical evidence for potentially significant inefficiencies in agentic collaboration. Our results suggest that the primary cost of agentic software engineering lies not in initial code generation but in automated refinement and verification. Our novel methodology can help practitioners predict expenses and optimize workflows, and it directs future research toward developing more token-efficient agent collaboration protocols.

智能体编程令牌消耗成本优化

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