EMI-Group/evox 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 GNU General Public License v3.0 许可证,目前获得 2.7k 个 Star、359 次 Fork。
仓库全名
EMI-Group/evox
README 摘要
The Infrastructure for Evolutionary AI Systems Enabling intelligence to adapt, create, and evolve across digital and physical worlds. Website · Documentation · Releases · 简体中文 EvoX provides the computing and experimentation foundation for AI that evolves. Across models, software, control policies, and scientific design, it connects population-based search with scalable evaluation. How evolution works Retain what…
EvoX provides the computing and experimentation foundation for AI that evolves. Across models, software, control policies, and scientific design, it connects population-based search with scalable evaluation.
How evolution works
Retain what works, then explore new variations. EvoX scales this loop through batched evaluation and parallel computing.
Tensorization and parallel computing scale up exploration. The PyTorch main version in this repository organizes candidates and their evaluation as batched tensor computation on CPUs and GPUs. Composable algorithms, problems, and workflows connect search, execution, and feedback.
Start here for: Exploring the new functional API and compiler backends
New to EvoX? Get started with 1.x. The experimental version is a functional rewrite on EvoX Compiler, with a NumPy interpreter and optional IREE, XLA, and TVM backends. Both versions use the evox package name, so try the alpha in a separate environment using its own installation guide.
The earlier JAX implementation is available at v0.9.0.
Part of the EvoX ecosystem
The same loop takes different forms across the EvoX ecosystem: model weights, code, control policies, or geometry become the candidates. Each illustration below follows two generations, showing how retained traits and local changes shape the next round of search.
Generative AI
Evolve the models. Retain useful weights and explore small changes.
Optimize the 10-dimensional Ackley function with particle swarm optimization:
import torch
from evox.algorithms import PSO
from evox.problems.numerical import Ackley
from evox.workflows import EvalMonitor, StdWorkflow
torch.set_default_device("cuda" if torch.cuda.is_available() else "cpu")
torch.manual_seed(42)
algorithm = PSO(
pop_size=100,
lb=-32 * torch.ones(10),
ub=32 * torch.ones(10),
)
monitor = EvalMonitor()
workflow = StdWorkflow(algorithm, Ackley(), monitor)
workflow.init_step()
for _ in range(100):
workflow.step()
print("Best fitness:", monitor.get_best_fitness().item())
# monitor.plot().show() # Optional: inspect the convergence curve.
Algorithm generates and updates candidates. Problem evaluates a batch. Workflow connects them. Monitor records the results.
Use your own objective
Implement a batched evaluation function. For a single objective, map a tensor of shape (population_size, dimensions) to one fitness value per candidate:
from evox.core import Problem
class Sphere(Problem):
def evaluate(self, candidates: torch.Tensor) -> torch.Tensor:
return candidates.square().sum(dim=-1)
Pass Sphere() in place of Ackley() when constructing the workflow. EvoX minimizes by default; use opt_direction="max" in StdWorkflow for maximization.
Optimize multiple objectives
The same workflow supports multi-objective search. This example uses RVEA on DTLZ2:
import torch
from evox.algorithms import RVEA
from evox.problems.numerical import DTLZ2
from evox.workflows import EvalMonitor, StdWorkflow
torch.manual_seed(42)
algorithm = RVEA(
pop_size=100,
n_objs=2,
lb=torch.zeros(12),
ub=torch.ones(12),
)
monitor = EvalMonitor(multi_obj=True)
workflow = StdWorkflow(algorithm, DTLZ2(m=2), monitor)
workflow.init_step()
for _ in range(100):
workflow.step()
print("Pareto-front fitness shape:", monitor.get_pf_fitness().shape)
# monitor.plot().show()
Algorithm libraries propose candidates. Benchmarks and simulation environments provide evaluation feedback. Workflows organize iteration, while tensorization and compiler tools support execution at scale. Together, these components provide infrastructure for exploration and validation:
Algorithm libraries
Tensorized optimization, multi-objective search, genetic programming, and neural topology evolution.
Compiler backends for the experimental EvoX line; automatic tensorization of MATLAB multi-objective optimization code into PyTorch/EvoX implementations.
The PyTorch version runs on CPU, NVIDIA GPU (CUDA), AMD GPU (ROCm), and Apple Silicon (MPS, eager execution) through the corresponding PyTorch backend. See the hardware guide for setup.
For supported compilation environments, compile the repeated step before entering the search loop:
from evox import compile
workflow.step = compile(workflow.step)
git clone --branch main https://github.com/EMI-Group/evox.git
cd evox
python -m pip install -e ".[default]"
Citation
If EvoX supports your research, please cite the framework paper:
@article{evox,
title = {{EvoX}: A Distributed GPU-accelerated Framework for Scalable Evolutionary Computation},
author = {Huang, Beichen and Cheng, Ran and Li, Zhuozhao and Jin, Yaochu and Tan, Kay Chen},
journal = {IEEE Transactions on Evolutionary Computation},
year = {2024},
doi = {10.1109/TEVC.2024.3388550}
}
评论