R386 · Agent principles and patterns › Workflows over agents

A coding agent that reads the simulator, and the ablation that says reading barely mattered

Read the original

coding-agentsreinforcement-learningprogram-synthesisworld-modelsbenchmarksinterpretability

Policy synthesis from a readable world model, and why its own control condition is the most interesting table in the paper.

The method

The setup inverts the usual reinforcement-learning loop. Instead of training a policy by interacting with an environment, a coding agent is handed the environment's source code as a readable world model — which, as the paper notes, also specifies the observation and termination mechanisms — and asked to write a control policy as an ordinary program. There is no task-specific training of any kind.

Refinement comes in one of two forms. Online, the agent runs a candidate program, sees the resulting states and rewards, and revises the code; each run counts against a development budget. Offline, the agent never touches the environment: it compares its policy's predicted actions against a fixed dataset's actions, and may fit small conventional models — decision trees, regressions — inside the program it writes. Several candidates are produced and the best by development score is selected, with evaluation results withheld from the agent so that selection cannot leak the test set.

The agent is a commercial coding agent driven by a frontier model at maximum reasoning effort. The output is code, not parameters, which is what makes the resulting policies inspectable — and the paper spends a full section on reading the decision rules the agent wrote and tracing how they changed under feedback.

Results

Against model-free baselines given 2 million steps (for two of them) or 10 million steps, the synthesized policies win 15 of 16 online scenarios. The development budget is capped at the first 1,600 attempted episodes, failures and validation included. That is the headline: three to four orders of magnitude fewer interactions.

Offline, on the maze tasks, the margins are not marginal:

D4RL taskBest baselineSynthesized
maze2d-umaze94.7 (CQL)154.0 ± 7.6
maze2d-medium62.1 (TD3+BC)157.5 ± 18.3
maze2d-large88.6 (TD3+BC)219.2 ± 21.4
Average (3 maze2d)62.0 (CQL)176.9

Scores are D4RL normalised, over 100 evaluation episodes, with mean and standard deviation taken over three independently constructed policies.

On the harder AntMaze set the picture is mixed and worth stating plainly: the method averages 71.7 against the best baseline average of 63.0, but it loses antmaze-umaze (83.0 against 87.5) and loses antmaze-medium-diverse (51.0 against 70.0 and 53.7). It wins the three tasks where most baselines score zero, which is where the average comes from. Variance is large — up to ±37.7 on one task with three runs.

Other losses, named by the paper: two multi-agent baselines beat it on one StarCraft scenario, a world-model baseline beats it on one communication task, and a model-based baseline leads on one continuous-control task. The paper also states directly that the approach "remains less competitive on MuJoCo locomotion and Adroit manipulation, particularly in tasks requiring precise continuous control." Writing a program is a good way to express a decision rule and a poor way to express a smooth controller.

The ablation, which is the real content

The natural reading of this work is that reading the dynamics is what produces the gain. The paper runs the control condition that tests exactly that — same model, same reasoning effort, same instructions, same interfaces, same feedback, but with only task descriptions and public interface documentation instead of the implementation — and the answer splits sharply by regime.

Online, reading the source barely mattered.

Benchmark (average)RL baselineWithout sourceWith source
StarCraft scenarios42.7191.5096.17
Multi-agent particle−69.67−36.66−36.53
MiniGrid28.50100.00100.00

Without any access to the implementation, the agent still beats the reinforcement-learning baselines by enormous margins and lands within a few points of the with-source condition — on MiniGrid, identically. So in the online setting the gain comes overwhelmingly from writing a program and refining it against feedback, not from reading the dynamics. The readable world model is close to free.

Offline, reading the source was decisive.

Kitchen datasetWithout sourceWith source
kitchen-complete, normalised60.7584.25
kitchen-complete, full completion41.00%63.33%
kitchen-partial, normalised40.9296.17
kitchen-partial, full completion3.00%92.33%

A three percent full-completion rate becomes ninety-two. The paper gives the reason, and it is the generalisable claim: the improvement "is particularly pronounced on kitchen-partial, where successful demonstrations are relatively scarce."

Put the two halves together and the result is sharper than either: reading the environment substitutes for experience, and it only pays when experience is unavailable. Where the agent can experiment, feedback supplies the same information that the source code would have. Where it cannot — offline, with a dataset that rarely demonstrates success — the source is the only route to knowing what success requires.

That is a much more useful statement than "RL is unnecessary", and it is also a much narrower one.

Tradeoffs and scope

White-box access is the hard prerequisite. The method needs the environment's implementation, which exists for simulators and essentially never for the deployed systems that most applied reinforcement learning targets. The online ablation softens this — the approach works without source — but then it is no longer the claim in the title.

The comparison is not like-for-like on compute. Baselines spend millions of environment steps; this spends a small number of episodes plus a very large number of frontier-model reasoning tokens at maximum effort. An interaction-count comparison flatters whichever side has the cheaper unit, and the paper's development-budget framing is honest about episodes while the token and dollar cost sits in an appendix.

Interpretability is a genuine and underrated win. The artifact is a program. It can be read, diffed, reviewed and edited, and the paper's analysis of how the rules evolved under feedback is possible only because of that. A policy network affords none of this.

Three runs is thin. With standard deviations in the tens on the harder tasks, several of the smaller wins and losses would not survive more seeds, and the paper does not say whether baseline numbers were rerun or quoted.

The win profile is "solves what others score zero on". On the hardest AntMaze variants most baselines score 0.0 and this scores 54 to 76. That is a real capability difference, not an incremental one, and it is also what pulls the averages up — so read the per-task rows, not the average.

Failure modes to watch for in work like this

Review checklist

Connections

See R386 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.