GithubHelp home page GithubHelp logo

konstantinosmitsides / dreaming-in-code Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 42.57 MB

Dreaming in Code for Curriculum Learning in Open-Ended Worlds (Accepted at ICML 2026)

Home Page: https://konstantinosmitsides.github.io/dreaming-in-code

License: MIT License

Dockerfile 0.14% Python 99.86%
open-ended-learning unsupervised-environment-design reinforcement-learning craftax curriculum-learning foundation-models jax procedural-generation icml-2026

dreaming-in-code's Introduction

Dreaming in Code for Curriculum Learning in Open-Ended Worlds

Paper Project Website


License: MIT Python 3.10+ JAX


Foundation Models that "dream" and materialize executable environment code to scaffold learning in open-ended worlds.


๐Ÿ’ก What is this?

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.


DiCode Method Overview

The framework operates in a closed feedback loop:

  1. Dream: An FM synthesizes new environment code (transition dynamics, initial states, goals) tailored to the agent's current capabilities.
  2. Evaluate: The agent is trained on these generated levels; performance data flows back into the archive.
  3. Refine: High-learning-signal levels become "parents" for the next generation of code, creating an infinite, self-correcting curriculum.

๐Ÿ“ˆ Key Results

Learning Curve Comparison

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.

๐ŸŽฅ Watch Gameplay Comparison

RL Baseline (PPO-GTrXL) on Craftax DiCode Agent (Ours) on Craftax
Baseline Gameplay DiCode Gameplay
Struggles with initial survival. Reaches late-game content.

๐Ÿš€ Quick Start

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

โš™๏ธ Advanced Setup

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

๐Ÿ“œ Citation

@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

Contributors

konstantinosmitsides avatar

Stargazers

justiceli avatar  avatar Tokarev Igor avatar Jose Cohenca avatar Roger Creus avatar Shyam Sudhakaran avatar Constantinos Papacharalambous avatar AG avatar

Watchers

justiceli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.