PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environments

Jiaxin Bai, Yue Guo, Yifei Dong, Jiaxuan Xiong, Tianshi Zheng +11 more
5/29/2026
7 citations
cs.CLcs.AI

Official code: HKBU-KnowComp/PatchWorld (11 stars, Python, MIT, last commit 2026-06-01).

Abstract

World models for interactive text agents must typically be learned from observation-action trajectories alone. Specifically, the environment returns text observations after each action, but does not expose a ground-truth latent state nor an inspectable transition model.A research gap remains in how to induce executable code as a world model in this black-box setting for prediction and agent decision making.

Show full abstract

We introduce PatchWorld, a gradient-free framework that turns offline trajectories into executable Python world models through counterexample-guided code repair.Instead of predicting the next observation with a black-box model, PatchWorld induces symbolic belief-state programs whose action updates can be inspected, replayed, and locally patched. Across seven AgentGym environments, PatchWorld-Simple achieves the highest code-based decision-making score among evaluated methods (76.4% macro success in live one-step lookahead), matching or exceeding LLM-based lookahead while invoking no LLM calls inside the world-model prediction module itself. We further find that a human-specified residual-memory bias improves surface observation fidelity but weakens agent decision-making utility. This reveals a tradeoff in executable world models, since improving observation fidelity can come at the expense of action-discriminative dynamics, and vice versa. Code is available at https://github.com/HKBU-KnowComp/PatchWorld.

View on arXivView PDF

Code Implementations(1)

MIT
111Python, ShellMay 26, 20266 months agoMIT

Similar Papers

Cite this paper

@article{bai2026patchworld,
  title  = {PatchWorld: Gradient-Free Optimization of Executable World Models for Agent Environments},
  author = {Jiaxin Bai and Yue Guo and Yifei Dong and Jiaxuan Xiong and Tianshi Zheng and Yixia Li and Tianqing Fang and Yufei Li and Yisen Gao and Haoyu Huang and Zhongwei Xie and Hong Ting Tsang and Zihao Wang and Lihui Liu and Jeff Z. Pan and Yangqiu Song},
  year   = {2026},
  eprint = {2605.30880},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.30880v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2605.30880.svg)](https://codeofpaper.com/paper/2605.30880)

Discussion