RobertTLange/gymnax
RL Environments in JAX 🌍
What it solves
Traditional reinforcement learning environments run on CPU, which becomes a bottleneck when you need many parallel rollouts for training or meta-learning. gymnax solves this by reimplementing environments directly in JAX, so they can run on GPUs/TPUs. This unlocks just-in-time compilation (jit) and massive parallelization (vmap/pmap), dramatically accelerating experiments.
How it works
gymnax provides a classic gym-style API: you reset an environment, step it with an action, and get observations and rewards. But everything is expressed as pure JAX functions, so you can batch across many environments, compile the whole rollout loop, and even differentiate through transitions. The library includes a diverse set of environments—CartPole, Pendulum, MinAtar games, bsuite tasks, and more. Version 1.0 introduces a six-value step return (observation, state, reward, terminated, truncated, info), automatic reset, and separate termination/truncation flags for correct bootstrapping. For continuous-control tasks, you can opt into gradient flow through transitions via with_transition_gradients(). Pixel-style observations are also supported for several environments.
Who it’s for
This is aimed at reinforcement learning researchers and practitioners who want to run high-throughput experiments on accelerators—especially those using evolutionary strategies, meta-RL, or parallelized training. It’s also handy for JAX users who need a fast, jittable environment suite for benchmarking algorithms.
Highlights
- Accelerated, vectorized environments via
jax.jitandjax.vmap/pmap - Functional control of seeds and hyperparameters for meta-RL and distributed evolution
- Enables the Anakin sub-architecture from the Podracer paper (Hessel et al., 2021)
- Includes classic control, MinAtar, bsuite, and custom meta-RL environments
- Optional differentiability through transitions for continuous-control environments
- Automatic reset and clear termination/truncation handling in version 1.0
- Seamless integration with
evosaxfor evolutionary optimization - Trained baseline checkpoints (PPO/ES) provided in
gymnax-blines
Related
- Project
- Project
- Project
- Project
- Project