evosax: Evolution Strategies in JAX π¦Tired of having to handle asynchronous processes for neuroevolution? Do you want to leverage massive vectorization and high-throughput accelerators for Evolution Strategies? evosax provides a comprehensive, high-performance library that implements Evolution Strategies (ES) in JAX. By leveraging XLA compilation and JAX's transformation primitives, evosax enables researchers and practitioners to efficiently scale evolutionary algorithms to modern hardware accelerators without the traditional overhead of distributed implementations.
The API follows the classical ask-eval-tell cycle of ES, with full support for JAX's transformations (jit, vmap, lax.scan). The library includes 30+ evolution strategies, from classics like CMA-ES and Differential Evolution to modern approaches like OpenAI-ES and Diffusion Evolution.
evosax API Usage π²import jax
from evosax.algorithms import CMA_ES
# Instantiate the search strategy
es = CMA_ES(population_size=32, solution=dummy_solution)
params = es.default_params
# Initialize state
key = jax.random.key(0)
state = es.init(key, dummy_solution, params)
# Ask-Eval-Tell loop
for i in range(num_generations):
key, key_ask, key_eval = jax.random.split(key, 3)
# Generate a set of candidate solutions to evaluate
population, state = es.ask(key_ask, state, params)
# Evaluate the fitness of the population
fitness = ...
# Update the evolution strategy
state, metrics = es.tell(key, population, fitness, state, params)
# Get best solution
state.best_solution, state.best_fitness
Population-based algorithms such as SimpleGA use the same ask-tell loop, but their state is initialized from an explicit initial population and its fitness:
import jax
import jax.numpy as jnp
from evosax.algorithms import SimpleGA
key = jax.random.key(0)
solution = dummy_solution
ga = SimpleGA(population_size=32, solution=solution)
params = ga.default_params
# Replicate a template solution (or provide your own evaluated population).
population_init = jax.tree.map(
lambda x: jnp.repeat(x[None, ...], ga.population_size, axis=0),
solution,
)
fitness_init = ...
# Initialize state from the initial population and its fitness.
state = ga.init(key, population_init, fitness_init, params)
The fitness_init argument seeds the stored population ranking used by the first ask(...) call. After initialization, ga.ask(...) returns the next population to evaluate and ga.tell(...) updates the algorithm state with the evaluated population and fitness.
evosax v0.3.2 requires Python 3.10 or later and a working JAX installation.
Then, install evosax from PyPi:
pip install "evosax==0.3.2"
To install the latest development version of evosax, use:
pip install git+https://github.com/RobertTLange/evosax.git@main
evosax βοΈIf you use evosax in your research, please cite the following paper:
@article{evosax2022github,
author = {Robert Tjarko Lange},
title = {evosax: JAX-based Evolution Strategies},
journal = {arXiv preprint arXiv:2212.04180},
year = {2022},
}
We acknowledge financial support by the Google TRC and the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy - EXC 2002/1 "Science of Intelligence" - project number 390523135.
Contributions are welcome! If you find a bug or are missing your favorite feature, please open an issue or submit a pull request following our contribution guidelines π€.
This repository contains independent reimplementations of LES and DES based and is unrelated to Google DeepMind. The implementation has been tested to reproduce the official results on a range of tasks.
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
936 followers Β· starred Dec 2025
112 followers Β· starred Mar 2022
157 followers Β· starred Nov 2024
133 followers Β· starred Dec 2022
evosax: Evolution Strategies in JAX π¦Tired of having to handle asynchronous processes for neuroevolution? Do you want to leverage massive vectorization and high-throughput accelerators for Evolution Strategies? evosax provides a comprehensive, high-performance library that implements Evolution Strategies (ES) in JAX. By leveraging XLA compilation and JAX's transformation primitives, evosax enables researchers and practitioners to efficiently scale evolutionary algorithms to modern hardware accelerators without the traditional overhead of distributed implementations.
The API follows the classical ask-eval-tell cycle of ES, with full support for JAX's transformations (jit, vmap, lax.scan). The library includes 30+ evolution strategies, from classics like CMA-ES and Differential Evolution to modern approaches like OpenAI-ES and Diffusion Evolution.
evosax API Usage π²import jax
from evosax.algorithms import CMA_ES
# Instantiate the search strategy
es = CMA_ES(population_size=32, solution=dummy_solution)
params = es.default_params
# Initialize state
key = jax.random.key(0)
state = es.init(key, dummy_solution, params)
# Ask-Eval-Tell loop
for i in range(num_generations):
key, key_ask, key_eval = jax.random.split(key, 3)
# Generate a set of candidate solutions to evaluate
population, state = es.ask(key_ask, state, params)
# Evaluate the fitness of the population
fitness = ...
# Update the evolution strategy
state, metrics = es.tell(key, population, fitness, state, params)
# Get best solution
state.best_solution, state.best_fitness
Population-based algorithms such as SimpleGA use the same ask-tell loop, but their state is initialized from an explicit initial population and its fitness:
import jax
import jax.numpy as jnp
from evosax.algorithms import SimpleGA
key = jax.random.key(0)
solution = dummy_solution
ga = SimpleGA(population_size=32, solution=solution)
params = ga.default_params
# Replicate a template solution (or provide your own evaluated population).
population_init = jax.tree.map(
lambda x: jnp.repeat(x[None, ...], ga.population_size, axis=0),
solution,
)
fitness_init = ...
# Initialize state from the initial population and its fitness.
state = ga.init(key, population_init, fitness_init, params)
The fitness_init argument seeds the stored population ranking used by the first ask(...) call. After initialization, ga.ask(...) returns the next population to evaluate and ga.tell(...) updates the algorithm state with the evaluated population and fitness.
evosax v0.3.2 requires Python 3.10 or later and a working JAX installation.
Then, install evosax from PyPi:
pip install "evosax==0.3.2"
To install the latest development version of evosax, use:
pip install git+https://github.com/RobertTLange/evosax.git@main
evosax βοΈIf you use evosax in your research, please cite the following paper:
@article{evosax2022github,
author = {Robert Tjarko Lange},
title = {evosax: JAX-based Evolution Strategies},
journal = {arXiv preprint arXiv:2212.04180},
year = {2022},
}
We acknowledge financial support by the Google TRC and the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy - EXC 2002/1 "Science of Intelligence" - project number 390523135.
Contributions are welcome! If you find a bug or are missing your favorite feature, please open an issue or submit a pull request following our contribution guidelines π€.
This repository contains independent reimplementations of LES and DES based and is unrelated to Google DeepMind. The implementation has been tested to reproduce the official results on a range of tasks.
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
936 followers Β· starred Dec 2025
112 followers Β· starred Mar 2022
157 followers Β· starred Nov 2024
133 followers Β· starred Dec 2022