Skip to main content

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,
    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}
}
@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


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.19.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x_evolution-0.0.19-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file x_evolution-0.0.19.tar.gz.

File metadata

  • Download URL: x_evolution-0.0.19.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for x_evolution-0.0.19.tar.gz
Algorithm Hash digest
SHA256 725a0135d0a89e65e379ad3f65a25bd086e28cd2dc5d4f729578ee976869ce3f
MD5 8e2542c34b6a51c58216982f131e2776
BLAKE2b-256 c30f1b131dd08bb2a0a0248b01afc5382f771c50004fa15302c2f22b39e5a446

See more details on using hashes here.

File details

Details for the file x_evolution-0.0.19-py3-none-any.whl.

File metadata

  • Download URL: x_evolution-0.0.19-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for x_evolution-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 9437c9babfdef368963bbf339fc216ef96d0f4714f60d01ef9803a5ec4bf0d0c
MD5 9357f864cb7b251324265d078c95e1e9
BLAKE2b-256 5f48c27846d3b7f362d7a20eb8e911a6a5d4a0330b1a14de6f314986b19441cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page