MichaelTMatthews/Craftax

(Crafter + NetHack) in JAX. ICML 2024 Spotlight.

What it solves

Reinforcement learning researchers need environments that are both complex enough to challenge agents and fast enough to train on modern hardware. Craftax provides a rich, open-ended game world (mining, farming, combat, magic, and more) that runs entirely in JAX, so the entire simulation can be compiled and run on GPUs/TPUs. It also uses the standard gymnax interface, making it easy to plug into existing JAX reinforcement learning frameworks without custom glue code.

How it works

Craftax is a game environment inspired by Crafter and NetHack. The world includes many interactive elements, and the simulation is written from scratch in JAX, meaning the step and reset functions are accelerated and can be vectorized for parallel training. It offers two variants: Craftax-Symbolic-v1 (a compact symbolic observation format) and Craftax-Classic (a more detailed version). You interact with it like any gymnax environment: call reset, sample actions, and step. It also supports rendering observations as text, so language-based agents can be tested. The README includes a playable demo (run play_craftax) and provides baseline results for many common algorithms.

Who it's for

This is for reinforcement learning researchers and practitioners who want a challenging, fast, and reproducible benchmark, especially those already using JAX for end-to-end training pipelines. It is also suitable for anyone exploring open-ended learning, generalization, or comparing agents on a consistent task.

Highlights

  • Entirely written in JAX, enabling fast execution and massive parallelization on GPU/TPU.
  • Extends Crafter with additional mechanics and roguelike elements, offering a rich task space.
  • Conforms to the gymnax interface, so it integrates easily with PureJaxRL, JaxUED, and other JAX RL libraries.
  • Provides both a symbolic and a classic variant, with text-based rendering for language agents.
  • Includes scoreboards with baseline results for many algorithms (PPO, RNN, RND, etc.) for two difficulty settings (Craftax-1B and Craftax-1M).
  • Ships with an offline dataset of human trajectories and tools for extending the environment.

Related

  • Project
  • Project
  • Project
  • Project