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 the fitness - you can select for whatever you want here, does not have to be differentiable.
noise_population_size = 30,
num_generations = 100,
learning_rate = 1e-3,
noise_scale = 1e-3,
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}
}
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.0.11.tar.gz
(8.1 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.0.11.tar.gz.
File metadata
- Download URL: x_evolution-0.0.11.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1044d6c017634e71315e90c8e7c7581458f3d33dbaec629cc4d796defc322d5e
|
|
| MD5 |
b8de4725159442db42d0bcf56af3957e
|
|
| BLAKE2b-256 |
d27af1986ff07f8c60bfa8979139c5f4294fbe830343f303a419404e55464e6f
|
File details
Details for the file x_evolution-0.0.11-py3-none-any.whl.
File metadata
- Download URL: x_evolution-0.0.11-py3-none-any.whl
- Upload date:
- Size: 6.7 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 |
4eebab3502712c33573866bf06e49d23433c6729a9644fdb8f89d4e1b4e8830f
|
|
| MD5 |
88fad4866d9259775741d81eb4282fc4
|
|
| BLAKE2b-256 |
21b91f24b7811b7b1681a3eb5bf4815d7da88fa2eb4eda5864fae04f3e0e55f8
|