Codex writes control programs from simulator code, rivalling reinforcement learning

A preprint finds that OpenAI's Codex coding agent, given a simulator's source code, can write readable control programs that match or beat standard reinforcement learning on many benchmark tasks, using far less trial and error. Fine-grained physical control remains the exception.

7 min readIIBenchmarkedPreprint, not peer reviewed
Save
Figure 3 from the paper "Do We Still Need Reinforcement Learning When We Can Read the World Model?"
Learning curves for standard reinforcement learning methods on 16 simulated tasks, with the agent-written program's score shown as a dashed line for comparison. Figure 3 from Mingchao Zhang et al., 2026, arXiv:2611.34656. CC0 (public domain).

What the study shows

Reinforcement learning, where a model learns by trial and error from rewards, usually needs huge amounts of practice. The authors asked whether that practice is needed when the environment's own source code can be read. They call this code a readable world model: a description of how the environment reacts to each action.

They gave OpenAI's Codex coding agent, running a model the paper calls gpt-6-astra, the code of each environment. The agent wrote a control program, tested it in the environment or, in offline tasks, checked it against recorded data, and revised it, with no human in the loop. The finished programs saw only the same observations as the trained systems they were compared with.

The tests covered StarCraft unit battles (SMAC), multi-agent coordination, grid navigation (MiniGrid), landing and walking tasks (Box2D), and offline tasks from D4RL and BabyAI, where only a fixed dataset is available. The authors report that the written programs beat the standard model-free reinforcement learning baselines in 15 of 16 online tasks.

The programs also needed far less experience to reach set targets. On one MiniGrid task they needed under 1,800 environment steps, against 400,000 for DreamerV3, a leading model-based method. On the two-legged walker the saving was small.

Results were mixed on offline data. The programs scored best on maze navigation and kitchen tasks, but clearly worse on simulated running robots (MuJoCo) and robot hands (Adroit). Where precise continuous control matters, trained systems still led.

Reading the code itself helped, but not everywhere. Compared with an agent given only task descriptions, code access raised scores in 8 of 16 online tasks, lowered them in 3 and tied in 5. The largest gains came on harder control tasks and on an offline kitchen task with few successful examples.

This is a preprint and has not been peer reviewed.

Figure 2 from the paper "Do We Still Need Reinforcement Learning When We Can Read the World Model?"
The workflow: a coding agent reads the environment's code, writes a control program, refines it with live feedback or recorded data, and the frozen program is then evaluated. Figure 2 from Mingchao Zhang et al., 2026, arXiv:2611.34656. CC0 (public domain).

Our reading

In our reading, the headline question in the paper's title is answered more modestly than it is posed. The study shows that for many standard benchmarks, a strong coding agent can write a good controller by reading the rules. It does not show that reinforcement learning is unnecessary, and the authors say as much in their discussion.

The practical point is about where effort goes. Trained systems spend millions of steps discovering what the code already states. The coding agent spends from about a thousand to a few hundred thousand steps checking and fixing a program it reasoned out. For a team that owns its simulator, this changes the first thing to try.

A concrete example: a warehouse operator with a software model of its conveyor and picking system could ask a coding agent to write dispatch rules from that model. Engineers could then read, test and adjust those rules, rather than train an opaque policy for weeks. The study does not test such a system, so this remains an extrapolation.

Free membership

Read the rest of this story

Membership is free. You get every article in full, and can save stories and follow topics.

We send a sign-in link, no password needed. Already a member? Sign in

Readiness assessment

II
Benchmarked
LevelStatusEvidence
I  Lab onlyMetExperiments were run in simulated environments under controlled conditions.
II  BenchmarkedMetThe paper reports results on public benchmarks (SMAC, MPE, MiniGrid, Box2D, D4RL, BabyAI) against established baselines such as QMIX, MAPPO, DreamerV3, CQL and IQL.
III  Open sourceNot yetThe appendix prints full policy code for four SMAC maps, but no repository, prompts package or data release link is given.
IV  In productionNot yetThere is no documented use by any named organisation.

What would move it up
Releasing the full code, prompts, generated policies and evaluation harness in a public repository would meet level III. Independent reproduction with other coding agents would also strengthen the case.

The study

Mingchao Zhang, Miduo Cui, Kangze He et al.. Do We Still Need Reinforcement Learning When We Can Read the World Model?. arXiv, 25 November 2026. Read the paper

Preprint, not peer reviewed · Licence CC0 (public domain) · Shandong University, Jinan · Chinese Academy of Sciences, Beijing · Li Auto Inc., Beijing

Notes

  1. Zhang, Cui, He, Li et al. Do We Still Need Reinforcement Learning When We Can Read the World Model? arXiv preprint, 25 November 2026, not peer reviewed. Licence CC0. Source
  2. No code repository is linked in the paper. Appendix E prints full generated policies for four StarCraft (SMAC) maps.
  3. Experiments used OpenAI's Codex with a model named gpt-6-astra at maximum reasoning effort. Estimated cost per scenario ranged from about USD 0.91 (MiniGrid) to USD 26.17 (MPE), using the paper's stated API prices (Appendix C).
  4. Exact figures: MiniGrid DoorKey reached the target in 1,789 steps against 400,000 for DreamerV3; BipedalWalker in 529,773 steps against 633,333 for PPO (Table 4). StarCraft allied death rate 34.80% against 84.45% for QMIX (Table 6). BabyAI average success 99.28% against at most 65.33% (Table 3).
  5. Affiliations: Shandong University; Institute of Automation and Institute of Microelectronics, Chinese Academy of Sciences; Li Auto; Tsinghua University; Nanyang Technological University.

Edited and signed by

Stefan PerdalFounder. Twenty-five years of building digital products.194 stories edited

Stefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.

How this was made

An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.

More on Agents