Foundation Models that "dream" and materialize executable environment code to scaffold learning in open-ended worlds.
Dreaming in Code (DiCode) is an Unsupervised Enviornment Design framework that uses Foundation Models (FMs) to generate executable Python code for training environments (or levels). Instead of just randomizing parameters, DiCode writes the logic itself โ creating a curriculum of distinct levels that bridge the gap between an agent's current skills and the complexities of open-ended worlds.
The framework operates in a closed feedback loop:
- Dream: An FM synthesizes new environment code (transition dynamics, initial states, goals) tailored to the agent's current capabilities.
- Evaluate: The agent is trained on these generated levels; performance data flows back into the archive.
- Refine: High-learning-signal levels become "parents" for the next generation of code, creating an infinite, self-correcting curriculum.
SOTA Performance on Craftax: DiCode dominates throughout training, achieving a 16% improvement in mean return over the strongest baseline (PPO-GTrXL).
By structuring the curriculum through code generation, DiCode:
- Solves the "Impossible": Achieves non-zero success on late-game tasks (e.g., Defeat Gnome Warrior, Defeat Gnome Archer) where baselines fail completely (0% success).
- Unlocks Exploration: Scaffolds instrumental milestones (e.g., Make Iron Armour), enabling the agent to survive long enough to reach and master deep exploration targets.
| RL Baseline (PPO-GTrXL) on Craftax | DiCode Agent (Ours) on Craftax |
|---|---|
![]() |
![]() |
| Struggles with initial survival. | Reaches late-game content. |
Get running in seconds using uv.
# 1. Clone & Install
git clone https://github.com/konstantinosmitsides/dreaming-in-code.git
cd dreaming-in-code
uv sync --all-extras
# 2. Install JAX (Ensure [cuda12] matches your driver)
uv pip install "jax[cuda12]"
# 3. Configure Secrets
cp .env.example .env
# Edit .env to add your API keys
# 4. Train Agent
uv run experiments/training/run_dicode.py
Apptainer & Docker Support
Apptainer (Singularity)
# Build
apptainer build dicode.sif apptainer/container.def
# Run training
apptainer run --nv dicode.sif
# Interactive shell
apptainer shell --nv --bind .:/workspace dicode.sif
Docker
# Build
docker build -t dicode .
# Run training
docker run --gpus all --env-file .env dicode
# Interactive shell (Development)
docker run --gpus all -it --env-file .env -v $(pwd):/workspace dicode /bin/bash
Pip / Standard Install
If you prefer not to use uv, you can install via pip:
# 1. Install package and dependencies
pip install -e .[dev,evaluation]
# 2. Install JAX (Ensure [cuda12] matches your driver)
pip install "jax[cuda12]"
Configuration & Hydra Overrides
DiCode uses Hydra for configuration. You can override any parameter from the command line:
# Make seed random, disable WandB
uv run experiments/training/run_dicode.py seed=$RANDOM use_wandb=false
@misc{mitsides2026dreamingcodecurriculumlearning,
title={Dreaming in Code for Curriculum Learning in Open-Ended Worlds},
author={Konstantinos Mitsides and Maxence Faldor and Antoine Cully},
year={2026},
eprint={2602.08194},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2602.08194},
}
dreaming-in-code's People
Forkers
romannekrasovaillmRecommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
OpenClaw
Personal AI Assistant
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.



