Skip to main content

x-evolution

Project description

x-evolution (wip)

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.
    population_size = 30,
    num_generations = 100,
    learning_rate = 1e-3,
    noise_scale = 1e-3
)

# do evolution with your desired fitness function for so many generations

evo_strat()

# then save your evolved model, maybe for alternating with gradient based training

torch.save(model.state_dict(), './evolved.pt')

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


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.2.tar.gz (7.0 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.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: x_evolution-0.0.2.tar.gz
  • Upload date:
  • Size: 7.0 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.2.tar.gz
Algorithm Hash digest
SHA256 ba573973d9e46606bdd9dfe0b0eee042c90b80a93bf3d8651b680fc7928ded92
MD5 205d2bd67c0e8317c0d64c757a8ac2c1
BLAKE2b-256 b734baae9274ac0add6da50caaea7d361b97b6d8b722cf0bd978bda820810580

See more details on using hashes here.

File details

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

File metadata

  • Download URL: x_evolution-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50eee18a8e690da19fc10b32e86271ef069734f1b3440b9ba90df44ff97cbf1b
MD5 5aff9acaf8735587458b98c98fd6c89a
BLAKE2b-256 75d2e670977469e443266ef43268f0d2db982cf25c71fcf97ad8aa4c65255ee2

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