New study reveals Python cheapest for AI coding agents, Rust most expensive
Token consumption by coding agents varies 10x across languages, with surprising inefficiencies.
A new arXiv paper (2607.22807) from Wu, Anderson, and Guha investigates how coding agents consume tokens differently across programming languages. Testing five recent models on problems in Python, Java, Rust, and OCaml, they controlled for difficulty and found stark, consistent variation in token consumption. Rust, for instance, demanded far more tokens than Python. The cost difference is large enough that language choice alone can dramatically affect the budget for AI-assisted development.
Digging into agent trajectories, the researchers uncovered inefficient behaviors: agents repeatedly produce noncompiling solutions in unfamiliar languages and revise solutions that already pass. They also plan in code comments, distrust provided tests in favor of self-invented inputs, and sidestep unfamiliar target languages by prototyping in Python. These results suggest that token efficiency by language should be a standard metric when benchmarking and developing multilingual agents, and serve as a guide for 'tokenmaxxers' seeking the most expensive language to avoid.
- Token consumption across languages varies consistently (10x+ difference) across five tested coding agents.
- Agents often prototype in Python to work around unfamiliar target languages, adding hidden token costs.
- Noncompiling code and unnecessary re-revision of passing solutions are common inefficiencies in Rust and OCaml.
Why It Matters
Developers using AI coding agents must consider language-level token costs to avoid budget blowouts and inefficiencies.