x-evolution
Project description
x-evolution
Implementation of various evolutionary algorithms, starting with evolutionary strategies
Install
$ pip install x-evolution
Usage
import torch
from x_evolution import EvoStrategy
# model
from torch import nn
model = torch.nn.Sequential(
nn.Linear(8, 16),
nn.ReLU(),
nn.Linear(16, 4)
)
# evolution wrapper
evo_strat = EvoStrategy(
model,
environment = lambda model: torch.randint(0, 100, ()), # environment is just a function that takes in the individual model (with unique noise) and outputs a scalar (the fitness) the measure you are selecting for
noise_population_size = 30, # increase this for better gradient estimates
noise_scale = 1e-3, # the scale of the perturbation noise
num_generations = 100, # number of generations / training steps
learning_rate = 1e-3, # scale on update derived by fitness and perturb noises
params_to_optimize = None # defaults to all parameters, but can be [str {param name}] or [Parameter]
)
# do evolution with your desired fitness function for so many generations
evo_strat()
# model will be saved under checkpoints/ folder
# can also specify checkpoint_every at init and select the one with your favored fitness score for continued policy gradient learning etc
Distributed
Using the CLI from 🤗
$ accelerate config
Then
$ accelerate launch train.py
Citations
@article{Qiu2025EvolutionSA,
title = {Evolution Strategies at Scale: LLM Fine-Tuning Beyond Reinforcement Learning},
author = {Xin Qiu and Yulu Gan and Conor F. Hayes and Qiyao Liang and Elliot Meyerson and Babak Hodjat and Risto Miikkulainen},
journal = {ArXiv},
year = {2025},
volume = {abs/2509.24372},
url = {https://api.semanticscholar.org/CorpusID:281674745}
}
@misc{sarkar2025evolutionstrategieshyperscale,
title = {Evolution Strategies at the Hyperscale},
author = {Bidipta Sarkar and Mattie Fellows and Juan Agustin Duque and Alistair Letcher and Antonio León Villares and Anya Sims and Dylan Cope and Jarek Liesen and Lukas Seier and Theo Wolf and Uljad Berdica and Alexander David Goldie and Aaron Courville and Karin Sevegnani and Shimon Whiteson and Jakob Nicolaus Foerster},
year = {2025},
eprint = {2511.16652},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2511.16652},
}
@misc{fortunato2019noisynetworksexploration,
title = {Noisy Networks for Exploration},
author = {Meire Fortunato and Mohammad Gheshlaghi Azar and Bilal Piot and Jacob Menick and Ian Osband and Alex Graves and Vlad Mnih and Remi Munos and Demis Hassabis and Olivier Pietquin and Charles Blundell and Shane Legg},
year = {2019},
eprint = {1706.10295},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/1706.10295},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
x_evolution-0.1.2.tar.gz
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file x_evolution-0.1.2.tar.gz.
File metadata
- Download URL: x_evolution-0.1.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
664c950a26f5e2405a22e131e623b336dad459029d498b78b7b80dd8c03ef51b
|
|
| MD5 |
1e2e4afa1e7415f957fe4752ce94e740
|
|
| BLAKE2b-256 |
f8ab7a739cc9864527046c7972950bc41cfdd946ebff72b5f5fdb3519a21c963
|
File details
Details for the file x_evolution-0.1.2-py3-none-any.whl.
File metadata
- Download URL: x_evolution-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f20cfcdad1fcdb3dec9926cb782ebb1d844c0b45de11863db52a61342b0eeeb
|
|
| MD5 |
0f0eef9ce35ae77b025876114a05fbfb
|
|
| BLAKE2b-256 |
266759adffc184975d81c50c050af2b45693e7ec6e044d5d8496346e3149ab7e
|