← all repositories
nnaisense/evotorch

Evolutionary algorithms that actually use your GPU

A PyTorch-native library for evolutionary computation that vectorizes populations like mini-batches and scales across clusters via Ray.

1.1k stars Python ML FrameworksOther AI
evotorch
Velocity · 7d
+0.8
★ / day
Trend
steady
star history

What it does EvoTorch implements evolutionary and black-box optimization algorithms—CMA-ES, SNES, PGPE, genetic algorithms, MAP-Elites—directly in PyTorch tensors. You define fitness functions as ordinary torch operations, flip a device="cuda" switch, and run population-based search on the same hardware you train neural nets on. It also wraps gym environments for neuroevolution and scales workloads across CPUs, GPUs, or Ray clusters.

The interesting bit Most evolutionary computation libraries treat vectorization as an afterthought; EvoTorch treats a population as a batched tensor operation from the ground up. The Ray integration is similarly first-class rather than bolted-on, letting you throw a cluster at expensive fitness evaluations without rewriting your objective.

Key highlights

  • Algorithms: CMA-ES, XNES, SNES, PGPE, CEM, genetic algorithm/NSGA-II, CoSyNE, MAP-Elites
  • GPU acceleration via native PyTorch tensor operations
  • Distributed scaling through Ray (multi-CPU, multi-GPU, multi-node)
  • Built-in GymNE wrapper for reinforcement learning and neuroevolution
  • Logging utilities including Pandas and pickling loggers for post-hoc analysis
  • pip-installable with pip install evotorch

Caveats

  • The README notes GPU support but leaves exact speedup numbers unstated; you’ll need to benchmark your own fitness function
  • Supervised learning tasks are mentioned as supported but not demonstrated in the provided examples

Verdict Worth a look if you’re doing black-box optimization, neuroevolution, or RL and already live in PyTorch—especially if you have idle GPUs. Skip it if you need gradient-based optimization; that’s not the point.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.