---
title: "WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the Environment"
url: https://awesomerea.org/papers/paper-worldcoder/
updated: 2026-10-17
type: paper
---

# WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the Environment

> WorldCoder learns executable Python transition and reward models from environment interactions and natural-language goals. It refines code against recorded experiences and an optimistic planning constraint, studying transfer and task solving in Sokoban, MiniGrid and ALFWorld.

- Authors: Hao Tang; Darren Key; Kevin Ellis
- Venue: NeurIPS 2024
- Status: Conference paper
- Publication / posting date: 2024 (exact date not verified)
- Date source: The NeurIPS proceedings and publisher-deposited Crossref record identify publication year 2024; the publication month and day are unavailable.
- First arXiv submission: February 19, 2024
- arXiv: 2402.12275
- Read in a terminal: `hf papers read 2402.12275`
- DOI: 10.52202/079017-2243
- Sources reviewed: 2026-10-17
- Added to the catalog: 2026-10-17
- Original paper: <https://papers.nips.cc/paper_files/paper/2024/hash/820c61a0cd419163ccbd2c33b268816e-Abstract-Conference.html>
- PDF: <https://papers.neurips.cc/paper_files/paper/2024/file/820c61a0cd419163ccbd2c33b268816e-Paper-Conference.pdf>
- Code: <https://github.com/haotang1995/WorldCoder>
- Project: <https://haotang1995.github.io/projects/worldcoder>
- BibTeX: <https://awesomerea.org/papers/citations/paper-worldcoder.bib>
- Catalog page: <https://awesomerea.org/papers/paper-worldcoder/>
- Record JSON: <https://awesomerea.org/papers/paper-worldcoder/record.json>
- Chinese version: [简体中文](https://awesomerea.org/zh/papers/paper-worldcoder/index.md)

## Scope and limitations

Assumes deterministic dynamics and symbolic, discrete states; inputs are confined to these symbolic states, with arbitrary pixels and binaries outside the input scope. Consistency with observed transitions and successful planning cover tested states; complete engine equivalence and correctness on every unseen state remain untested. Evaluation concerns bounded environment models and planning; original source and asset recovery remain outside its scope.

## Why it fits this collection

Studies agent-assisted reconstruction of observed game behavior as executable code, checked against recorded interactions.

## Publication and review notes

The final NeurIPS paper, pages 70148–70212. The MIT author repository is a partial experiment artifact: its pinned environment registry exposes MiniGrid only, despite the README’s Sokoban example and broader paper experiments. The README warns about NumPy 2 incompatibility and older Gymnasium/MiniGrid dependencies.

## BibTeX

```bibtex
@inproceedings{paper-worldcoder,
  title = {{WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the Environment}},
  author = {{Hao Tang} and {Darren Key} and {Kevin Ellis}},
  year = {2024},
  url = {https://papers.nips.cc/paper_files/paper/2024/hash/820c61a0cd419163ccbd2c33b268816e-Abstract-Conference.html},
  booktitle = {Advances in Neural Information Processing Systems},
  volume = {37},
  pages = {70148--70212},
  doi = {10.52202/079017-2243},
  eprint = {2402.12275},
  archivePrefix = {arXiv}
}
```

## Primary sources

1. <https://papers.nips.cc/paper_files/paper/2024/hash/820c61a0cd419163ccbd2c33b268816e-Abstract-Conference.html>
2. <https://papers.neurips.cc/paper_files/paper/2024/file/820c61a0cd419163ccbd2c33b268816e-Paper-Conference.pdf>
3. <https://api.crossref.org/works/10.52202/079017-2243>
4. <https://arxiv.org/abs/2402.12275>
5. <https://haotang1995.github.io/projects/worldcoder>
6. <https://github.com/haotang1995/WorldCoder/blob/9d9fc8d55b7537e2cc1e667a13185a0f2c9d9404/README.md>
7. <https://github.com/haotang1995/WorldCoder/blob/9d9fc8d55b7537e2cc1e667a13185a0f2c9d9404/LICENSE>
8. <https://github.com/haotang1995/WorldCoder/blob/9d9fc8d55b7537e2cc1e667a13185a0f2c9d9404/requirements.txt>
9. <https://github.com/haotang1995/WorldCoder/blob/9d9fc8d55b7537e2cc1e667a13185a0f2c9d9404/worldcoder/envs/__init__.py>
10. <https://github.com/haotang1995/WorldCoder/blob/9d9fc8d55b7537e2cc1e667a13185a0f2c9d9404/worldcoder/agent/synthesizer/evaluator.py>

## About this entry

Reviewed against the paper and its primary sources. Cite the original authors using the linked paper or BibTeX.
Original editorial content: MIT. Linked projects, papers and assets retain their own rights and licenses.
