arXiv cs.CL· Zixuan Wu, Carolyn Jane Anderson, Arjun Guha·· 13 小时前AI 评分42
哪种编程语言最费 token:编程智能体跨语言行为研究
The Best Programming Language for Tokenmaxxing: An Investigation of Coding Agent Behavior Across Programming Languages
AI 导读
一项研究在 Python、Java、Rust 和 OCaml 上评测五个近期模型后发现,编程智能体的 token 消耗会因编程语言不同而出现显著差异,且这一差异在各模型间保持一致。轨迹分析显示,智能体在不熟悉的语言中反复产出无法编译的解法、修改已经通过测试的方案,并倾向用 Python 做原型来绕开目标语言。作者据此提出,按语言衡量的 token 效率应纳入多语言智能体的基准测试与开发。
正文 · 原文
Abstract:Although coding agents are now very effective in a variety of programming languages, this paper first shows that the cost (in tokens) can very significantly by programming language. We evaluate five recent models on programming problems in Python, Java, Rust, and OCaml. We carefully control for problem difficulty, and show that there can be stark variation in token consumption that is consistent across models. To understand why, we analyze both the structure and content of agent trajectories. First, we re-execute every intermediate solution and abstract each trajectory as a sequence of test-outcome vectors, then label the work between successive solutions. This reveals agents repeatedly producing noncompiling solutions in unfamiliar languages and revising solutions that already pass. Second, we analyze trajectory text, finding that agents plan solutions in code comments, distrust the provided tests in favor of inputs they invent, and sidestep unfamiliar target languages by prototyping in Python. Our results show that by-language token efficiency is a metric that should be considered when benchmarking and developing multilingual agents, and, for the tokenmaxxer, a guide to the most expensive language to work in.
| Subjects: | Software Engineering (cs.SE); Computation and Language (cs.CL) |
| Cite as: | arXiv:2607.22807 [cs.SE] |
| (or arXiv:2607.22807v2 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2607.22807 arXiv-issued DOI via DataCite |
Submission history
From: Zixuan Wu [view email]
[v1]
Fri, 24 Jul 2026 16:41:59 UTC (65 KB)
[v2]
Wed, 21 Oct 2026 17:35:05 UTC (71 KB)
来源:arXiv cs.CL · arxiv.org