Skip to main content
fig1

Evolutionary Policy Optimization

Pytorch implementation of Evolutionary Policy Optimization, from Wang et al. of the Robotics Institute at Carnegie Mellon University

This paper stands out, as I have witnessed the positive effects first hand in an exploratory project (mixing evolution with gradient based methods). Perhaps the Alexnet moment for genetic algorithms has not come to pass yet.

Besides their latent variable strategy, I'll also throw in some attempts with crossover in weight space

Install

$ pip install evolutionary-policy-optimization

Usage

import torch

from evolutionary_policy_optimization import (
    LatentGenePool,
    Actor,
    Critic
)

latent_pool = LatentGenePool(
    num_latents = 128,
    dim_latent = 32,
)

state = torch.randn(1, 32)

actor = Actor(dim_state = 32, dim = 256, mlp_depth = 2, num_actions = 4, dim_latent = 32)
critic = Critic(dim_state = 32, dim = 256, mlp_depth = 3, dim_latent = 32)

latent = latent_pool(latent_id = 2)

action_distr = actor(state, latent)
actions = action_distr.sample()
value = critic(state, latent)

# interact with environment and receive rewards, termination etc

# derive a fitness score for each gene / latent

fitness = torch.randn(128)

latent_pool.genetic_algorithm_step(fitness) # update latent genes with genetic algorithm

End to end learning

import torch

from evolutionary_policy_optimization import (
    create_agent,
    EPO,
    Env
)

agent = create_agent(
    dim_state = 512,
    num_latents = 16,
    dim_latent = 32,
    actor_num_actions = 5,
    actor_dim = 256,
    actor_mlp_depth = 2,
    critic_dim = 256,
    critic_mlp_depth = 3,
    latent_gene_pool_kwargs = dict(
        frac_natural_selected = 0.5
    )
)

epo = EPO(
    agent,
    episodes_per_latent = 1,
    max_episode_length = 10,
    action_sample_temperature = 1.
)

env = Env((512,))

epo(env, num_learning_cycles = 5)

# saving and loading

agent.save('./agent.pt', overwrite = True)
agent.load('./agent.pt')

Train Gym

An example training script for LunarLander-v3 is provided at train_gym.py

First install example dependencies

$ pip install '.[examples]' # or `uv pip install '.[examples]'`

Single process

$ python train_gym.py --cpu

Distributed with 8 processes (one latent per process)

$ torchrun --nproc_per_node=8 train_gym.py --cpu

With wandb logging

$ torchrun --nproc_per_node=8 train_gym.py --cpu --use_wandb

Contributing

At the project root, run

$ pip install '.[test]' # or `uv pip install '.[test]'`

Then add your tests to tests/test_epo.py and run

$ pytest tests/

That's it

Citations

@inproceedings{Wang2025EvolutionaryPO,
    title = {Evolutionary Policy Optimization},
    author = {Jianren Wang and Yifan Su and Abhinav Gupta and Deepak Pathak},
    year  = {2025},
    url   = {https://api.semanticscholar.org/CorpusID:277313729}
}
@article{Farebrother2024StopRT,
    title   = {Stop Regressing: Training Value Functions via Classification for Scalable Deep RL},
    author  = {Jesse Farebrother and Jordi Orbay and Quan Ho Vuong and Adrien Ali Taiga and Yevgen Chebotar and Ted Xiao and Alex Irpan and Sergey Levine and Pablo Samuel Castro and Aleksandra Faust and Aviral Kumar and Rishabh Agarwal},
    journal = {ArXiv},
    year   = {2024},
    volume = {abs/2403.03950},
    url    = {https://api.semanticscholar.org/CorpusID:268253088}
}
@inproceedings{Khadka2018EvolutionGuidedPG,
    title   = {Evolution-Guided Policy Gradient in Reinforcement Learning},
    author  = {Shauharda Khadka and Kagan Tumer},
    booktitle = {Neural Information Processing Systems},
    year    = {2018},
    url     = {https://api.semanticscholar.org/CorpusID:53096951}
}
@article{Fortunato2017NoisyNF,
    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 R{\'e}mi Munos and Demis Hassabis and Olivier Pietquin and Charles Blundell and Shane Legg},
    journal = {ArXiv},
    year    = {2017},
    volume  = {abs/1706.10295},
    url     = {https://api.semanticscholar.org/CorpusID:5176587}
}
@article{Banerjee2022BoostingEI,
    title   = {Boosting Exploration in Actor-Critic Algorithms by Incentivizing Plausible Novel States},
    author  = {Chayan Banerjee and Zhiyong Chen and Nasimul Noman},
    journal = {2023 62nd IEEE Conference on Decision and Control (CDC)},
    year    = {2022},
    pages   = {7009-7014},
    url     = {https://api.semanticscholar.org/CorpusID:252682944}
}
@article{Doerr2017FastGA,
    title   = {Fast genetic algorithms},
    author  = {Benjamin Doerr and Huu Phuoc Le and R{\'e}gis Makhmara and Ta Duy Nguyen},
    journal = {Proceedings of the Genetic and Evolutionary Computation Conference},
    year    = {2017},
    url     = {https://api.semanticscholar.org/CorpusID:16196841}
}
@article{Lee2024AnalysisClippedCritic
    title   = {On Analysis of Clipped Critic Loss in Proximal Policy Gradient},
    author  = {Yongjin Lee, Moonyoung Chung},
    journal = {Authorea},
    year    = {2024}
}
@article{Ash2019OnTD,
    title   = {On the Difficulty of Warm-Starting Neural Network Training},
    author  = {Jordan T. Ash and Ryan P. Adams},
    journal = {ArXiv},
    year    = {2019},
    volume  = {abs/1910.08475},
    url     = {https://api.semanticscholar.org/CorpusID:204788802}
}
@inproceedings{Gerasimov2025YouDN,
    title   = {You Do Not Fully Utilize Transformer's Representation Capacity},
    author  = {Gleb Gerasimov and Yaroslav Aksenov and Nikita Balagansky and Viacheslav Sinii and Daniil Gavrilov},
    year    = {2025},
    url     = {https://api.semanticscholar.org/CorpusID:276317819}
}
@article{Lee2024SimBaSB,
    title   = {SimBa: Simplicity Bias for Scaling Up Parameters in Deep Reinforcement Learning},
    author  = {Hojoon Lee and Dongyoon Hwang and Donghu Kim and Hyunseung Kim and Jun Jet Tai and Kaushik Subramanian and Peter R. Wurman and Jaegul Choo and Peter Stone and Takuma Seno},
    journal = {ArXiv},
    year    = {2024},
    volume  = {abs/2410.09754},
    url     = {https://api.semanticscholar.org/CorpusID:273346233}
}
@article{Karras2019stylegan2,
    title   = {Analyzing and Improving the Image Quality of {StyleGAN}},
    author  = {Tero Karras and Samuli Laine and Miika Aittala and Janne Hellsten and Jaakko Lehtinen and Timo Aila},
    journal = {CoRR},
    volume  = {abs/1912.04958},
    year    = {2019},
}
@article{Chebykin2023ShrinkPerturbIA,
    title   = {Shrink-Perturb Improves Architecture Mixing during Population Based Training for Neural Architecture Search},
    author  = {Alexander Chebykin and Arkadiy Dushatskiy and Tanja Alderliesten and Peter A. N. Bosman},
    journal = {ArXiv},
    year    = {2023},
    volume  = {abs/2307.15621},
    url     = {https://api.semanticscholar.org/CorpusID:260316291}
}
@article{Jiang2022GeneralIR,
    title     = {General intelligence requires rethinking exploration},
    author    = {Minqi Jiang and Tim Rocktaschel and Edward Grefenstette},
    journal   = {Royal Society Open Science},
    year      = {2022},
    volume    = {10},
    url       = {https://api.semanticscholar.org/CorpusID:253523156}
}
@misc{xie2025simplepolicyoptimization,
    title   = {Simple Policy Optimization},
    author  = {Zhengpeng Xie and Qiang Zhang and Fan Yang and Marco Hutter and Renjing Xu},
    year    = {2025},
    eprint  = {2401.16025},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url = {https://arxiv.org/abs/2401.16025},
}
@inproceedings{Nisioti2025WhenDN,
    title   = {When Does Neuroevolution Outcompete Reinforcement Learning in Transfer Learning Tasks?},
    author  = {Eleni Nisioti and Joachim Winther Pedersen and Erwan Plantec and Milton L. Montero and Sebastian Risi},
    booktitle = {Annual Conference on Genetic and Evolutionary Computation},
    year    = {2025},
    url     = {https://api.semanticscholar.org/CorpusID:278995766}
}
@article{Eysenbach2018DiversityIA,
    title   = {Diversity is All You Need: Learning Skills without a Reward Function},
    author  = {Benjamin Eysenbach and Abhishek Gupta and Julian Ibarz and Sergey Levine},
    journal = {ArXiv},
    year    = {2018},
    volume  = {abs/1802.06070},
    url     = {https://arxiv.org/abs/1802.06070}
}
@inproceedings{Sharma2020DynamicsAwareUD,
    title   = {Dynamics-Aware Unsupervised Discovery of Skills},
    author  = {Archit Sharma and Shixiang Gu and Sergey Levine and Vikash Kumar and Karol Hausman},
    booktitle = {International Conference on Learning Representations},
    year    = {2020},
    url     = {https://arxiv.org/abs/1907.01657}
}
@article{Zhu2025Hybrid,
    author  = {Zhu, Zimo and Yu, Chuanqiang and Wang, Junti},
    title   = {A Hybrid Genetic Algorithm and Proximal Policy Optimization System for Efficient Multi-Agent Task Allocation},
    journal = {Systems},
    volume  = {13},
    year    = {2025},
    number  = {6},
    article-number = {453},
    url     = {https://www.mdpi.com/2079-8954/13/6/453},
    issn    = {2079-8954}
}
@misc{kedia2026simtoolrealobjectcentricpolicyzeroshot,
    title   = {SimToolReal: An Object-Centric Policy for Zero-Shot Dexterous Tool Manipulation},
    author  = {Kushal Kedia and Tyler Ga Wei Lum and Jeannette Bohg and C. Karen Liu},
    year    = {2026},
    eprint  = {2602.16863},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2602.16863},
}

Evolution is cleverer than you are. - Leslie Orgel

Metadata

Release files for evolutionary-policy-optimization 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evolutionary-policy-optimization 0.6.0
File Size Uploaded Provenance Actions
evolutionary_policy_optimization-0.6.0.tar.gz 30.2 kB Without provenance Details for evolutionary_policy_optimization-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evolutionary-policy-optimization 0.6.0
File Interpreter ABI Platform Actions
evolutionary_policy_optimization-0.6.0-py3-none-any.whl Python 3 none any Details for evolutionary_policy_optimization-0.6.0-py3-none-any.whl

Total release size: 62.1 kB

Release files / evolutionary_policy_optimization-0.6.0.tar.gz

Download URL evolutionary_policy_optimization-0.6.0.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e29dd9283f011897d5fd6519ea9b92ccfefa8e86cc7a25b680979f1b6296b217
BLAKE2b-256 checksum
How to use checksums
de47fec496f0ccdd11175d345f58ba5f2262a762f78ab6b66057e4d644b7694a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / evolutionary_policy_optimization-0.6.0-py3-none-any.whl

Download URL evolutionary_policy_optimization-0.6.0-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65414a644789bbf904888ed1792e4452a88de03930a2153b07468fbdd9cd84c9
BLAKE2b-256 checksum
How to use checksums
2aa8f21812ed362efe5dd833b4daa005f9d05a1cf48da1ca45d38f456331ff2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Security for evolutionary-policy-optimization 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page