Where the Tokens Go: Heat, Entropy and Error in Agentic Coding
Al\'an Aspuru-Guzik, Varinia Bernales
Key points
From the paper's conclusion- We test the theory with an analogue of the experiments in which a single molecule is pulled open and let fold again: an agent makes a change to a repository (coding) and then undoes it (uncoding), many times over, and we count the tokens of every model call.
Abstract
Coding agents are billed by the token, yet software engineering says nothing about what a token actually buys. Here we introduce a theory of software thermodynamics. The theory draws analogues from classical and stochastic thermodynamics, extends them, and applies them to modern agentic coding. We count the tokens an agent generates as its cost and divide that cost into work and heat. The test suite acts as a software Maxwell's daemon that judges every coding change. We test the theory with an analogue of the experiments in which a single molecule is pulled open and let fold again: an agent makes a change to a repository (coding) and then undoes it (uncoding), many times over, and we count the tokens of every model call. The cycle returns the requested edits to where they began, with each direction started from a stored reference tree, and the spread of its cost over repeated cycles defines a software temperature, which rose with the sampling temperature of the model. About 80 per cent of the tokens of a successful run are generated in model calls that leave the requested change where it was, and we call these tokens heat. The free energy of a change, which we estimate by analogy with the equality of Jarzynski, is 14 to 22 per cent of the mean cost of a successful coding run. Coding costs 1.1 to 1.5 times as much as uncoding. The daemon is imperfect: the verdict of a test suite varies with its environment, and a suite that accepts a broken change has a cost in tokens. The practical implication of the proposed theory could be new tools for analysing and optimising coding agents through the lens of thermodynamics.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- TokenEconomizer: Experience-Driven Black-Box Cost Control for Coding AgentsarXiv · 2026
- SWE-Shift: Evaluating Coding Agents in Evolving WorkspacesarXiv · 2026
- Assurance Envelopes for Autonomous Coding Agents: Minimum-Cost Evidence for Software ChangearXiv · 2026
- Repository-Grounded Rubrics for Execution-Free Evaluation of Coding AgentsarXiv · 2026
- A Coding-Theoretic Carnot Cycle: Extremal D-ary Huffman Bounds, the Sagawa–Ueda Identity, and a Closed-Form EfficiencyJournal of Statistical Physics · 2026
- Implementing the Spec Growth Engine: Preventing Spec-Code Divergence, and Growing the Spec with AgentsarXiv · 2026