Jumanji: a Diverse Suite of Scalable Reinforcement Learning Environments in JAX

Clément Bonnet, Daniel Luo, Donal Byrne, Shikha Surana, Vincent Coyette, Paul Duckworth, Laurence I. Midgley, Tristan Kalloniatis, Sasha Abramowitz, Cemlyn N. Waters, Andries P. Smit, Nathan Grinsztajn, Ulrich A. Mbou Sob, Omayma Mahjoub, Elshadai Tegegn, Mohamed A. Mimouni, Raphaël Boige, Ruan de Kock, Daniel Furelos-Blanco, Victor Le, Arnu Pretorius, Alexandre Laterre

TL;DR

Jumanji is a new open-source suite of 22 reinforcement learning (RL) environments implemented in JAX, specifically designed for high-speed, hardware-accelerated experimentation. By focusing on industry-relevant combinatorial optimization problems and providing a highly flexible, scalable API, Jumanji aims to bridge the gap between academic RL research and complex real-world applications.

What Problem Does This Paper Address?

Reinforcement learning has seen massive success in games, but transitioning that success to industrial applications remains difficult. The authors identify three major bottlenecks in current RL benchmarking:

  1. Speed: Most environments run on CPUs, creating a sequential bottleneck that hinders large-scale experimentation.
  2. Flexibility: Existing suites often have hard-coded initial states, making it difficult to study how agents generalize to different data distributions.
  3. Real-world Relevance: Popular benchmarks like Atari or MuJoCo are often disconnected from the NP-hard combinatorial optimization problems (COPs) found in logistics, manufacturing, and routing.

Jumanji addresses these by providing a suite of environments that are natively hardware-accelerated, highly customizable via "generators," and focused on practical problem categories like routing and packing.

Methods

The core of Jumanji is its implementation in JAX. This allows the environments to leverage XLA compilation for device-agnostic optimization across CPUs, GPUs, and TPUs.

Key technical features include:

  • Stateless Design: Environments are functionally pure, meaning the step and reset functions don't maintain internal state. This makes them perfectly suited for JAX transformations like vmap (vectorization for running thousands of environments in parallel) and pmap (parallelization across multiple hardware devices).
  • Anakin Architecture: The library is designed to support the "Anakin" training flow, where the entire RL loop—inference, environment stepping, and learner updates—stays on the accelerator. This eliminates the costly data transfer overhead between the host (CPU) and the device (GPU/TPU).
  • Composition-based API: Unlike the standard OpenAI Gym, Jumanji uses "Generators" to define initial state distributions. This allows researchers to easily swap out how a problem is initialized (e.g., changing how cities are distributed in a Traveling Salesman Problem) without changing the environment dynamics.

Datasets

Jumanji introduces a diverse suite of 22 environments divided into three categories:

  • Routing: Including Traveling Salesman (TSP), Capacitated Vehicle Routing (CVRP), and Robot Warehouse.
  • Packing: Including 3D Bin Packing, Job Shop Scheduling, and Knapsack.
  • Logic Games: Including Rubik’s Cube, Sudoku, and Minesweeper.
Overview of the 22 environments in Jumanji

For evaluation, the authors also utilize the VLSI TSP Benchmark Dataset, a collection of real-world problem instances, to test the generalization capabilities of their trained agents.

Key Insights and Ideas

  • The Power of Parallelization: By moving environments to the accelerator, Jumanji achieves massive throughput. For simple environments like Maze, it can process nearly $10^8$ steps per second on a single TPU-v4.
  • Generalization requires Distributional Diversity: A key experiment showed that an agent trained on a single uniform distribution for TSP performed poorly on real-world VLSI instances. However, an agent trained using a mix of custom generators (cluster, linear compression, and explosion) generalized significantly better to unseen real-world data.
  • Scalability as a Benchmark: Jumanji allows users to arbitrarily scale problem complexity (e.g., increasing the number of items in Bin Packing or the grid size in Connector). The authors show that as complexity increases, standard RL baselines like A2C struggle, highlighting a clear "optimality gap" that provides a fertile ground for future research.

Key Results

  • Throughput Scaling: The library demonstrates near-linear scaling of environment steps per second as the number of parallel instances increases.
  • Training Speedup: On the "Connector" environment, increasing the hardware from 8 TPU cores to 128 cores reduced the time to reach 92% optimal performance from 12.8 hours to just 1.4 hours.
Figure 3: Analysis of environment parallelization. (a): Scaling of the effective environment steps per second (throughput) for each registered environment as the number of parallel environments increases, on an 8-core TPU-v4. The legend is ordered by the throughput of the rightmost data point. The results on GPU and CPU are presented in Appendix C.2. (b): Training of an A2C agent on the Connector environment on a CPU, GPU (RTX 2080 super), and TPU-v4 with a number of cores varying from 8 to 128. Each training is run for 255M steps. Full training takes weeks on a CPU, which is why it is not visible on the bottom plot. Performance denotes the proportion of wires connected (an optimal policy would reach 1.0). See Appendix C.2 for further details.
  • Baseline Performance: The authors provide A2C baselines for all 22 environments. While the agents successfully learn in most cases, they often fall short of optimal performance in complex combinatorial tasks, establishing a challenging benchmark for the community.
Figure 2: Learning curves from training an actor-critic agent (A2C) in blue compared to a masked random policy in red on all 22 Jumanji environments. When possible to determine, the optimal expected return is shown with a dashed line. Experiments were run with three different seeds, with the median represented as a blue curve and the min/max as the shaded region.

Limitations and Future Work

While Jumanji is a significant step forward, the authors note several areas for growth:

  • Action Spaces: Currently, all implemented environments use discrete actions, though the API is designed to support continuous actions in the future.
  • Multi-Agent RL (MARL): Several environments (like Robot Warehouse or MultiCVRP) are inherently multi-agent, but the current baselines treat them as single-agent problems with centralized control. Future work will include dedicated MARL implementations.
  • Domain Expansion: The team plans to expand the suite into other fields like life sciences, agriculture, and more complex logistics scenarios.

Jumanji is released under the Apache 2.0 license and is available on GitHub.

Summary updated

BibTeX
@inproceedings{bonnet2024jumanji,
  author = {Clément Bonnet and Daniel Luo and Donal Byrne and Shikha Surana and Vincent Coyette and Paul Duckworth and Laurence I. Midgley and Tristan Kalloniatis and Sasha Abramowitz and Cemlyn N. Waters and Andries P. Smit and Nathan Grinsztajn and Ulrich A. Mbou Sob and Omayma Mahjoub and Elshadai Tegegn and Mohamed A. Mimouni and Raphaël Boige and Ruan de Kock and Daniel Furelos-Blanco and Victor Le and Arnu Pretorius and Alexandre Laterre},
  title = {{Jumanji: a Diverse Suite of Scalable Reinforcement Learning Environments in JAX}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=C4CxQmp9wc},
}
Figure