EvoJAX is a scalable, general purpose, hardware-accelerated neuroevolution toolkit. Built on top of the JAX library, this toolkit enables neuroevolution algorithms to work with neural networks running in parallel across multiple TPU/GPUs. EvoJAX achieves very high performance by implementing the evolution algorithm, neural network and task all in NumPy, which is compiled just-in-time to run on accelerators.
This repo also includes several extensible examples of EvoJAX for a wide range of tasks, including supervised learning, reinforcement learning and generative art, demonstrating how EvoJAX can run your evolution experiments within minutes on a single accelerator, compared to hours or days when using CPUs.
EvoJAX paper: https://arxiv.org/abs/2202.05008 (presentation video)
Please use this BibTeX if you wish to cite this project in your publications:
@article{evojax2022,
title={EvoJAX: Hardware-Accelerated Neuroevolution},
author={Tang, Yujin and Tian, Yingtao and Ha, David},
journal={arXiv preprint arXiv:2202.05008},
year={2022}
}
List of publications using EvoJAX (please open a PR to add missing entries):
EvoJAX is implemented in JAX which needs to be installed first.
Install JAX: Please first follow JAX's installation instruction with optional GPU/TPU backend support. In case JAX is not set up, EvoJAX installation will still try pulling a CPU-only version of JAX. Note that Colab runtimes come with JAX pre-installed.
Install EvoJAX:
# Install from PyPI.
pip install evojax
# Or, install from our GitHub repo.
pip install git+https://github.com/google/evojax.git@main
If you also want to install the extra dependencies required for certain optional functionalities, use
pip install evojax[extra]
# Or
pip install git+https://github.com/google/evojax.git@main#egg=evojax[extra]
EvoJAX is a framework with three major components, which we expect the users to extend.
evojax.algo.base.NEAlgorithm
interface and reside in evojax/algo/
.
See here for the available algorithms in EvoJAX.evojax.policy.base.PolicyNetwork
interface and be saved in evojax/policy/
.
In this repo, we give example implementations of the MLP, ConvNet, Seq2Seq and PermutationInvariant models.evojax.task.base.VectorizedTask
and be in evojax/task/
.These components can be used either independently, or orchestrated by evojax.trainer
and evojax.sim_mgr
that manage the training pipeline.
While they should be sufficient for the currently provided policies and tasks, we plan to extend their functionality in the future as the need arises.
As a quickstart, we provide non-trivial examples (scripts in examples/
and notebooks in examples/notebooks
) to illustrate the usage of EvoJAX.
We provide example commands to start the training process at the top of each script.
These scripts and notebooks are run with TPUs and/or NVIDIA V100 GPU(s):
While one would obviously use gradient-descent for such tasks in practice, the point is to show that neuroevolution can also solve them to some degree of accuracy within a short amount of time, which will be useful when these models are adapted within a more complicated task where gradient-based approaches may not work.
The purpose of including control tasks are two-fold: 1) Unlike supervised learning tasks, control tasks in EvoJAX have undetermined number of steps, we thus use these examples to demonstrate the efficiency of our task roll-out loops. 2) We wish to show the speed-up benefit of implementing tasks in JAX and illustrate how to implement one from scratch.
In this last category, we go beyond simple illustrations and show examples of novel tasks that are more practical and attractive to researchers in the genetic and evolutionary computation area, with the goal of helping them try out ideas in EvoJAX.
![]() |
![]() |
![]() |
Multi-agent WaterWorld | ES-CLIP: “A drawing of a cat” | Slime Volleyball |
The goal of EvoJAX is to get evolutionary computation to able to work on a vast array of tasks using accelerators.
One issue before was that many evolution algorithms were only optimized for one particular task for some paper. This is the reason we focused only on one single algorithm (PGPE) in the first release of EvoJAX, while creating 6+ different tasks in diverse domains, ensuring that one single algorithm works for all of the tasks without any issues. See Table of contributed algorithms.
We welcome new evolution algorithms to be added to this toolkit. It would be great if you can show that your implementation can perform on cart-pole swing-up (hardmode), BRAX, waterworld, and MNIST, before submitting a pull request.
Ideas for evolutionary algorithm candidates:
We suggest the below performance guidelines for new algorithms:
Note that these are not hard requirements, but just rough guidelines.
Please use the benchmark script to evaluate your algorithm before sending us a PR, let us know if you are unable to test on some tasks due to hardware limitations. See this example pull request thread of a Genetic Algorithm that has been merged into EvoJAX to see how it should be done.
Feel free to reach out to evojax-dev@google.com or evojax-dev@googlegroups.com if you wish to discuss further.
We also welcome new tasks and examples (see here for all tasks in EvoJAX). Some suggestions:
There is a growing number of researchers working with evolutionary computation who are using JAX. Here is a list of related efforts:
QDax: Accelerated Quality-Diversity. A tool that uses JAX to help accelerate Quality-Diveristy (QD) algorithms through hardware accelerators and massive parallelism. (GitHub | paper)
evosax: A JAX-based library of evolution strategies focusing on JAX-composable ask-tell functionality and strategy diversity. More than 10 ES algorithms implemented. (GitHub)
This is not an official Google product.