🤖 AI Summary
This work addresses a critical gap in understanding how coding agents internally represent program states while performing software engineering tasks. By training linear logistic regression probes on the residual stream of language models, the study decodes the agents’ internal representations of program properties—such as syntactic parsability and test pass outcomes—and reveals, for the first time, their ability to prospectively predict the results of future edits up to 25 steps ahead. This predictive capacity leads to the proposal of the “latent programming horizon” concept. Experimental results demonstrate that the probes achieve decoding AUCs as high as 0.83 for attributes like program correctness and exhibit strong zero-shot transfer across benchmarks without any fine-tuning.
📝 Abstract
A coding agent solving a software-engineering task spends dozens of steps reasoning, editing code, and running tests, yet little is known about what the underlying language model internally represents about the program it is working on. We show that the residual streams of language models under coding agents linearly encode properties of the evolving program: a logistic-regression probe on hidden states is able to decode whether the current code parses, passes its test suite, reduces the number of failing tests, and introduces regressions, reaching AUC up to 0.83 for correctness across two models and two benchmarks. Our second finding is more surprising: these representations run ahead of the agent's own edits. Probes trained to predict the outcome of future edits (before they are materialized and written on disk) achieve performance above chance up to roughly 25 steps in advance. We call this the agent's latent programming horizon. As a proof of external validity, we show that the probes transfer across benchmarks without retraining. Our positive results open calls for more research in mechanistic interpretability of coding agents.