arXiv cs.AI· Pramod Kumar, Raj Kumar Pandey·· 3 天前AI 评分42
TurnCost:编码智能体的缓存感知循环工程——轮次而非观测才是成本主因
TurnCost: Turns, Not Observations: Cache-Aware Loop Engineering for Coding Agents
AI 导读
研究分析 600 条编码智能体轨迹发现,轮次数量解释了日志轨迹成本 84% 的方差,而平均观测大小仅占 4%,最昂贵的轨迹轮次最多但观测最小。98.6% 的输入 token 由前缀缓存提供,扁平定价平均高估循环成本约 7 倍。团队发布 TurnCost 工具,可在不同缓存、定价、压缩和路由策略下重新评分轨迹语料。
正文 · 原文
Abstract:AI coding agents operate in iterative loops: they modify code, run tools, inspect the results, and decide what to do next. We call the design of this process loop engineering, which includes context management, model selection, compaction, and termination. Existing efficiency work mainly compresses tool observations or routes selected turns to cheaper models, but the practical opportunity for these optimizations remains unclear. We analyze 600 publicly released coding-agent trajectories spanning two agent scaffolds and two language models. Median observations contain only 118-286 tokens, while the large build logs commonly used to motivate compression occur near the ninety-ninth percentile. Moreover, 98.6% of input tokens are served from a prefix cache, so flat input pricing overestimates loop cost by roughly 7x on average under near-ideal caching.
We derive and empirically validate a closed-form break-even condition for model delegation. Delegation increases cost in half of the evaluated settings, near the predicted boundary. More broadly, turn count explains 84% of the variance in log trajectory cost, compared with 4% for mean observation size; the most expensive trajectories have the most turns despite having the smallest observations. These associations suggest that observation-focused methods target a secondary cost factor, and identify unnecessary turns as the larger and largely unexamined opportunity, though we do not establish that turns can be removed while holding task success fixed. We release TurnCost, a tool for re-scoring trajectory corpora under alternative caching, pricing, compression, and routing policies.
| Subjects: | Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Emerging Technologies (cs.ET); Machine Learning (cs.LG) |
| ACM classes: | D.2.8; I.2.2; I.2.11 |
| Cite as: | arXiv:2610.15093 [cs.SE] |
| (or arXiv:2610.15093v1 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2610.15093 arXiv-issued DOI via DataCite (pending registration) |
|
| Related DOI: | https://doi.org/10.1145/3843779.3844635
DOI(s) linking to related resources |
Submission history
From: Raj Kumar Pandey [view email]
[v1]
Sat, 10 Oct 2026 18:03:24 UTC (130 KB)
来源:arXiv cs.AI · arxiv.org