Skip to content

MarioRicoIbanez/ES_DRL

Repository files navigation

Evolution Strategies for Deep Reinforcement Learning Pretraining

Paper Poster Python License

JAX Brax MuJoCo W&B

A comprehensive research project investigating Evolution Strategies as pretraining mechanisms for Deep Reinforcement Learning algorithms

ร‰cole Polytechnique Fรฉdรฉrale de Lausanne (EPFL)
In collaboration with Swiss Data Science Center


๐Ÿ“‘ Table of Contents


๐Ÿ“Š Research Poster

View Poster

Click the badge above to view the full research poster (PDF)

๐Ÿ“„ Full Paper: RL_project.pdf

Demo Video

MuJoCo Humanoid Agent Trained with Evolution Strategies

https://github.com/MarioRicoIbanez/ES_DRL/assets/sim.mp4

๐ŸŽฅ Simulation Video: sim.mp4 - Watch the trained agent in action!


๐Ÿ“ Abstract

Although Deep Reinforcement Learning has proven highly effective for complex decision-making problems, it demands significant computational resources and careful parameter adjustment in order to develop successful strategies. Evolution strategies offer a more straightforward, derivative-free approach that is less computationally costly and simpler to deploy. However, ES generally do not match the performance levels achieved by DRL, which calls into question their suitability for more demanding scenarios.

This study examines the performance of ES and DRL across tasks of varying difficulty, including Flappy Bird, Breakout, and MuJoCo environments, as well as whether ES could be used for initial training to enhance DRL algorithms.

Key Findings:

  • โœ… ES accelerates early learning in simple environments (Flappy Bird)
  • โŒ ES struggles with high-dimensional state spaces (Breakout)
  • โš ๏ธ ES pretraining shows limited benefit for complex tasks (MuJoCo)
  • ๐Ÿ“ˆ DRL algorithms achieve better final performance but require more tuning

๐ŸŽฏ At a Glance

๐Ÿ”ฌ Research Focus

  • Comparing ES vs DRL performance
  • Evaluating ES as pretraining strategy
  • Testing across 3 environment types
  • Analyzing training speed & robustness

๐Ÿ› ๏ธ Technologies Used

  • Physics: Brax, MuJoCo
  • Frameworks: JAX, NumPy
  • Algorithms: ES, DQN, PPO, TD3
  • Tracking: Weights & Biases

๐Ÿ“Š Environments Tested

  • Discrete: Flappy Bird, Breakout
  • Continuous: Hopper, Walker2d, HalfCheetah
  • Dimensions: 2D to 84ร—84ร—4
  • Complexity: Simple to High

โœจ Key Contributions

  • Comprehensive ES vs DRL comparison
  • ES pretraining analysis
  • Architecture compatibility insights
  • Reproducible benchmark suite

๐ŸŽฏ Research Motivation

Traditional Deep Reinforcement Learning approaches often require:

  • Extensive training time and computational resources
  • Careful hyperparameter tuning for convergence
  • Gradient computation through complex backpropagation

Evolution Strategies offer an alternative:

  • โœจ Gradient-free optimization
  • ๐Ÿš€ Simpler implementation and parallelization
  • ๐Ÿ’ฐ Lower computational cost per update
  • ๐ŸŽฒ Robust exploration through parameter space perturbations

Research Questions:

  1. Can ES reach intermediate performance benchmarks faster than DRL?
  2. Can ES serve as effective pretraining to improve DRL training speed and robustness?

๐Ÿ“„ Research Materials

This repository contains the complete implementation of the research presented in our paper:

Resource Description Link
๐Ÿ“˜ Full Paper Complete research paper with detailed methodology and analysis RL_project.pdf
๐ŸŽจ Research Poster Visual summary of findings presented at EPFL Poster PDF
๐ŸŽฅ Demo Video MuJoCo Humanoid agent trained with ES sim.mp4
๐Ÿ’ป Source Code Full implementation with experiments This repository

Publication Details:

  • Institution: ร‰cole Polytechnique Fรฉdรฉrale de Lausanne (EPFL)
  • Collaboration: Swiss Data Science Center
  • Year: 2025
  • Conference: NeurIPS 2024 Format

๐Ÿงฎ Mathematical Formulation

Evolution Strategies

Evolution Strategies optimize a smoothed version of the objective function through parameter perturbations:

Objective Function:

$$\tilde{J}(\theta) = \mathbb{E}_{\epsilon \sim \mathcal{N}(0, I)}[F(\theta + \sigma \epsilon)]$$

where:

  • $\theta$ = policy parameters
  • $F(\theta)$ = total reward (fitness) for parameters $\theta$
  • $\sigma$ = noise standard deviation
  • $\epsilon$ = Gaussian perturbation vector

Gradient Estimation:

Using the log-likelihood trick, the gradient can be estimated as:

$$\nabla_\theta \tilde{J}(\theta) = \frac{1}{\sigma} \mathbb{E}_{\epsilon} \left[ F(\theta + \sigma \epsilon) \cdot \epsilon \right]$$

Monte Carlo Approximation:

With $n$ independent samples $\epsilon_1, \dots, \epsilon_n$:

$$\nabla_\theta \tilde{J}(\theta) \approx \frac{1}{n \sigma} \sum_{i=1}^n F(\theta + \sigma \epsilon_i) \cdot \epsilon_i$$

Update Rule:

$$\theta_{t+1} = \theta_t + \alpha \cdot \nabla_\theta \tilde{J}(\theta_t)$$

where $\alpha$ is the learning rate.

Algorithm Pseudocode:

# Evolution Strategies Training Loop
def train_ES(policy, population_size, sigma, learning_rate, num_generations):
    theta = initialize_parameters(policy)
    
    for generation in range(num_generations):
        # 1. Generate population
        perturbations = [sample_gaussian() for _ in range(population_size)]
        
        # 2. Evaluate fitness
        rewards = []
        for epsilon in perturbations:
            theta_perturbed = theta + sigma * epsilon
            reward = evaluate_policy(theta_perturbed)
            rewards.append(reward)
        
        # 3. Estimate gradient
        gradient = (1 / (population_size * sigma)) * sum(
            reward * epsilon for reward, epsilon in zip(rewards, perturbations)
        )
        
        # 4. Update parameters
        theta = theta + learning_rate * gradient
    
    return theta

Key Advantages:

  • ๐Ÿš€ No backpropagation required
  • ๐Ÿ”„ Highly parallelizable
  • ๐Ÿ“Š Variance independent of episode length
  • ๐ŸŽฏ Effective in sparse reward settings

Deep Q-Networks (DQN)

DQN approximates the optimal action-value function using a neural network:

Bellman Optimality Equation:

$$Q^*(s, a) = \mathbb{E}_{s'} \left[ r + \gamma \max_{a'} Q^*(s', a') \,|\, s, a \right]$$

Loss Function:

$$L(\theta) = \mathbb{E}_{(s,a,r,s') \sim D} \left[ \left( y - Q(s, a; \theta) \right)^2 \right]$$

where the target is:

$$y = r + \gamma \max_{a'} Q(s', a'; \theta^{-})$$

and $\theta^{-}$ are parameters of the target network.

Proximal Policy Optimization (PPO)

PPO uses a clipped surrogate objective for stable policy updates:

Clipped Objective:

$$L^{CLIP}(\theta) = \hat{\mathbb{E}}_t[\min(r_t(\theta)\hat{A}_t, \text{clip}(r_t(\theta), 1-\epsilon, 1+\epsilon)\hat{A}_t)]$$

where:

  • $r_t(\theta) = \frac{\pi_\theta(a_t|s_t)}{\pi_{\theta_{old}}(a_t|s_t)}$ is the probability ratio
  • $\hat{A}_t$ is the advantage estimate
  • $\epsilon$ is the clipping parameter (typically 0.2)

๐Ÿ—๏ธ Architecture & Implementation


๐Ÿ—๏ธ Architecture & Implementation

Project Structure

ES_DRL/
โ”œโ”€โ”€ src/es_drl/
โ”‚   โ”œโ”€โ”€ main_es.py              # Main training script for ES
โ”‚   โ”œโ”€โ”€ main_finetune.py        # Main script for DRL fine-tuning
โ”‚   โ”œโ”€โ”€ es/
โ”‚   โ”‚   โ”œโ”€โ”€ base.py             # Base ES class with common functionality
โ”‚   โ”‚   โ”œโ”€โ”€ basic_es.py         # Basic ES implementation
โ”‚   โ”‚   โ”œโ”€โ”€ brax_training_utils.py  # Training utilities for Brax
โ”‚   โ”‚   โ”œโ”€โ”€ ppo.py              # PPO implementation
โ”‚   โ”‚   โ”œโ”€โ”€ ppo_training_utils.py   # PPO training utilities
โ”‚   โ”‚   โ”œโ”€โ”€ pretraining.py      # ES + DRL pretraining strategy
โ”‚   โ”‚   โ””โ”€โ”€ tr_es.py            # Trust-region ES variant
โ”‚   โ”œโ”€โ”€ dpg/
โ”‚   โ”‚   โ””โ”€โ”€ td3_trainer.py      # TD3 implementation
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ callbacks.py        # Training callbacks
โ”‚       โ””โ”€โ”€ logger.py           # Logging utilities
โ”œโ”€โ”€ configs/
โ”‚   โ”œโ”€โ”€ common.yaml             # Common configuration
โ”‚   โ”œโ”€โ”€ es/                     # ES-specific configs
โ”‚   โ”‚   โ”œโ”€โ”€ basic_es.yaml
โ”‚   โ”‚   โ”œโ”€โ”€ ppo.yaml
โ”‚   โ”‚   โ”œโ”€โ”€ pretraining.yaml
โ”‚   โ”‚   โ””โ”€โ”€ tr_es.yaml
โ”‚   โ”œโ”€โ”€ td3/                    # TD3-specific configs
โ”‚   โ”‚   โ””โ”€โ”€ td3_finetune.yaml
โ”‚   โ””โ”€โ”€ [environment].yaml      # Environment-specific configs
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ env.sh                  # Environment setup
โ”‚   โ”œโ”€โ”€ run_es.sh               # ES training script
โ”‚   โ””โ”€โ”€ run_finetune.sh         # Fine-tuning script
โ”œโ”€โ”€ results/                    # Training results and plots
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ RL_project.pdf             # Full research paper
โ””โ”€โ”€ Evolution_Strategies_for_Deep_RL_pretraining___Poster.pdf

Neural Network Architectures

Flappy Bird & Breakout (Discrete Actions)

  • Policy Network: Fully connected MLP
    • Hidden layers: [64, 64] with Tanh activation
    • Output: Q-values for each discrete action
    • Parameters: ~4,000 (Flappy Bird), ~850,000 (Breakout CNN)

MuJoCo Environments (Continuous Control)

  • Actor Network: Fully connected MLP

    • Hidden layers: [32, 32, 32, 32]
    • Output: Mean and std for action distribution
    • Parameters: ~10,000 - 15,000 depending on environment
  • Critic Network (PPO only):

    • Same architecture as actor
    • Output: Single value estimate

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8+
  • CUDA-capable GPU (recommended for faster training)
  • 8GB+ RAM

Installation

  1. Clone the repository:
git clone https://github.com/MarioRicoIbanez/ES_DRL.git
cd ES_DRL
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Verify installation:
python -c "import jax; import brax; print('โœ“ Installation successful!')"

โšก Quick Start Commands

Train an agent in 30 seconds:

# Evolution Strategies on Walker2d
python src/es_drl/main_es.py --config configs/es/basic_es.yaml --env_config configs/walker2d.yaml --seed 42

# PPO on Hopper
python src/es_drl/main_es.py --config configs/es/ppo.yaml --env_config configs/hopper.yaml --seed 42

# ES Pretraining โ†’ PPO Fine-tuning
python src/es_drl/main_es.py --config configs/es/pretraining.yaml --env_config configs/hopper.yaml --seed 42

๐Ÿ“‹ Detailed Usage

Training with Evolution Strategies

# Basic ES training on Walker2d
python src/es_drl/main_es.py \
    --config configs/es/basic_es.yaml \
    --env_config configs/walker2d.yaml \
    --seed 42

# ES training on Hopper
python src/es_drl/main_es.py \
    --config configs/es/basic_es.yaml \
    --env_config configs/hopper.yaml \
    --seed 42

Training with PPO (DRL)

# PPO training on Walker2d
python src/es_drl/main_es.py \
    --config configs/es/ppo.yaml \
    --env_config configs/walker2d.yaml \
    --seed 42

Pretraining with ES + Fine-tuning with PPO

# Step 1: Pretrain with ES
python src/es_drl/main_es.py \
    --config configs/es/pretraining.yaml \
    --env_config configs/hopper.yaml \
    --seed 42

# Step 2: Fine-tune with PPO (automatically loads ES weights)
python src/es_drl/main_finetune.py \
    --config configs/td3/td3_finetune.yaml \
    --env_config configs/hopper.yaml \
    --pretrained_path results/es/hopper/checkpoint.pkl \
    --seed 42

Using Shell Scripts

# Set up environment variables
source scripts/env.sh

# Run ES training
bash scripts/run_es.sh walker2d 42

# Run fine-tuning
bash scripts/run_finetune.sh walker2d 42

โš™๏ธ Configuration

Configuration Files

Training is configured through YAML files with hierarchical structure:

Common Settings (configs/common.yaml):

training:
  num_timesteps: 1000000
  episode_length: 1000
  num_envs: 2048
  
logging:
  wandb_project: "es-drl"
  log_interval: 100
  save_interval: 1000

ES-Specific (configs/es/basic_es.yaml):

algorithm:
  name: "basic_es"
  sigma: 0.05              # Noise standard deviation
  population_size: 128     # Number of perturbations per iteration
  learning_rate: 0.01      # Update step size
  elite_fraction: 0.2      # Top performers for fitness shaping
  
network:
  hidden_sizes: [32, 32, 32, 32]
  activation: "tanh"

PPO-Specific (configs/es/ppo.yaml):

algorithm:
  name: "ppo"
  learning_rate: 3e-4
  batch_size: 512
  num_minibatches: 32
  num_updates_per_batch: 64
  gamma: 0.997             # Discount factor
  gae_lambda: 0.95         # GAE parameter
  clip_epsilon: 0.2        # PPO clipping parameter
  entropy_coef: 0.0
  value_coef: 0.5

Environment-Specific (configs/walker2d.yaml):

environment:
  name: "walker2d"
  backend: "brax"          # Physics engine
  reward_scaling: 5.0
  
  # Environment parameters
  ctrl_cost_weight: 1e-3
  forward_reward_weight: 1.0
  healthy_reward: 1.0
  healthy_z_range: [0.8, 2.0]

Key Hyperparameters

Parameter ES PPO Description
population_size 128 - Number of parameter perturbations
sigma 0.05 - Noise standard deviation for ES
learning_rate 0.01 3e-4 Step size for updates
num_envs - 2048-8192 Parallel environments for PPO
gamma 0.99 0.997 Discount factor
clip_epsilon - 0.2 PPO clipping parameter

๐Ÿงช Experimental Results

Environments Tested

Environment Type State Dim Action Dim Complexity
Flappy Bird Discrete Low (~10) 2 Simple
Breakout Discrete High (84ร—84ร—4) 4 Medium
Hopper Continuous 11 3 Medium
Walker2d Continuous 17 6 High
HalfCheetah Continuous 17 6 High

Key Findings

1. Flappy Bird (Simple Environment)

โœ… ES shows strong early performance

  • Quickly finds stable policies
  • Reaches intermediate rewards ~5x faster than DQN
  • Effective pretraining for DQN acceleration

๐Ÿ“Š Results:

  • ES: Converges in ~100 episodes
  • DQN: Requires ~500 episodes for similar performance
  • ESโ†’DQN: Reaches high rewards ~2x faster than DQN alone

2. Breakout (High-Dimensional State Space)

โŒ ES struggles with complexity

  • Plateaus at mean reward ~1.5 (image-based)
  • Limited improvement even with large populations (n=50)
  • RAM-based input (128-D) only marginally better (reward ~4)

๐ŸŽฏ DQN outperforms:

  • Achieves mean reward ~30
  • CNN architecture effectively processes visual input
  • Higher variance but better final performance

3. MuJoCo Environments (Continuous Control)

โš ๏ธ Mixed results for ES pretraining

HalfCheetah:

  • โœ… PPO converges 20ร— faster than ES
  • โŒ ES pretraining provides no benefit

Walker2d:

  • โŒ PPO fails to converge consistently
  • โš ๏ธ ES shows stable but slow learning
  • โŒ ES pretraining doesn't improve PPO robustness

Hopper:

  • โš ๏ธ PPO shows high variance across seeds
  • โœ… ES demonstrates more stable training
  • โŒ ES pretraining doesn't enhance PPO performance

Performance Comparison Summary

Algorithm Performance Across Key Metrics

Method Training Speed Final Performance Stability Hyperparameter Sensitivity Best Use Case
ES ๐ŸŸก Moderate ๐ŸŸก Moderate ๐ŸŸข High ๐ŸŸข Low Simple environments, initial exploration
DQN/PPO ๐ŸŸข Fast* ๐ŸŸข High ๐ŸŸก Moderate ๐Ÿ”ด High Complex tasks when tuned
ESโ†’DRL ๐ŸŸข Fast** ๐ŸŸข High ๐ŸŸก Moderate ๐ŸŸก Moderate Simple to medium complexity

*When properly tuned | **Only in simple environments

Detailed Performance by Environment

Environment ES Performance DRL Performance ES Pretraining Benefit Winner
Flappy Bird ๐ŸŸข Good ๐ŸŸข Excellent โœ… Significant ESโ†’DQN
Breakout ๐Ÿ”ด Poor ๐ŸŸข Excellent โŒ None DQN
HalfCheetah ๐ŸŸก Moderate ๐ŸŸข Excellent โŒ None PPO
Hopper ๐ŸŸก Moderate ๐ŸŸก Unstable โŒ None ES (stability)
Walker2d ๐ŸŸก Moderate ๐Ÿ”ด Poor โŒ None ES

Legend:

  • ๐ŸŸข Excellent/High - ๐ŸŸก Moderate/Medium - ๐Ÿ”ด Poor/Low
  • โœ… Beneficial - โŒ Not beneficial - โš ๏ธ Conditional

๐Ÿ“ˆ Monitoring & Logging

Weights & Biases Integration

All experiments are tracked using W&B:

# Automatic logging includes:
- Episode rewards (mean, std, min, max)
- Training time and timesteps
- Parameter statistics (norm, updates)
- Environment-specific metrics
- Videos of agent behavior

View logs:

wandb login
# Logs automatically sync to your W&B project

Local Logging

CSV files are saved to results/[algorithm]/[environment]/:

results/
โ””โ”€โ”€ es/
    โ””โ”€โ”€ walker2d/
        โ”œโ”€โ”€ basic_es_seed42.csv
        โ”œโ”€โ”€ basic_es_seed42.png
        โ””โ”€โ”€ checkpoints/
            โ””โ”€โ”€ generation_1000.pkl

Visualization

Generate training plots:

python scripts/plot_results.py \
    --results_dir results/es/walker2d \
    --output plots/walker2d_comparison.png

๐Ÿ”ฌ Reproducing Paper Results

Flappy Bird Experiments

# ES training
python src/es_drl/main_es.py \
    --config configs/es/basic_es.yaml \
    --env_config configs/flappy_bird.yaml \
    --seed 42

# DQN training  
python src/es_drl/main_es.py \
    --config configs/dqn/dqn.yaml \
    --env_config configs/flappy_bird.yaml \
    --seed 42

# ES pretraining + DQN fine-tuning
python src/es_drl/main_es.py \
    --config configs/es/pretraining.yaml \
    --env_config configs/flappy_bird.yaml \
    --seed 42

Breakout Experiments

# ES on RAM-based input
python src/es_drl/main_es.py \
    --config configs/es/basic_es.yaml \
    --env_config configs/breakout_ram.yaml \
    --seed 42

# DQN on image-based input
python src/es_drl/main_es.py \
    --config configs/dqn/dqn_cnn.yaml \
    --env_config configs/breakout.yaml \
    --seed 42

MuJoCo Experiments

# Run all MuJoCo experiments with different seeds
for env in hopper walker2d halfcheetah; do
    for seed in 42 123 456; do
        # ES
        python src/es_drl/main_es.py \
            --config configs/es/basic_es.yaml \
            --env_config configs/${env}.yaml \
            --seed ${seed}
        
        # PPO
        python src/es_drl/main_es.py \
            --config configs/es/ppo.yaml \
            --env_config configs/${env}.yaml \
            --seed ${seed}
        
        # ESโ†’PPO pretraining
        python src/es_drl/main_es.py \
            --config configs/es/pretraining.yaml \
            --env_config configs/${env}.yaml \
            --seed ${seed}
    done
done

๐Ÿ’ก Key Insights & Takeaways

When to Use Evolution Strategies

โœ… ES is effective for:

  • Simple environments with low-dimensional state spaces
  • Sparse or deceptive reward landscapes
  • Quick prototyping and initial exploration
  • Parallel computation with limited communication
  • Non-differentiable environments

โŒ ES struggles with:

  • High-dimensional observations (images, complex sensors)
  • Environments requiring fine-grained control
  • Tasks demanding very high final performance
  • Long-horizon temporal dependencies

Pretraining Recommendations

Effective pretraining requires:

  1. โœ… Environment simplicity (low-dimensional states)
  2. โœ… Architectural compatibility (ES and DRL networks must align)
  3. โœ… Sparse rewards where ES excels at initial exploration
  4. โŒ Not recommended for actor-critic methods (PPO, SAC) where ES only optimizes actor

Architectural Considerations

Limitation: ES pretraining is less effective for actor-critic algorithms (PPO, SAC) because:

  • ES optimizes a single policy network
  • Actor-critic methods require separate value functions
  • Transferring only the actor may not provide sufficient benefit

Future directions:

  • Co-evolving actor and critic networks
  • Architecture-aware hybrid approaches
  • Adaptive transfer strategies

๐Ÿ‘ฅ Authors

ร‰cole Polytechnique Fรฉdรฉrale de Lausanne (EPFL)

Adrian Martรญnez Lรณpez
EPFL
Ananya Gupta
EPFL
Hanka Goralija
EPFL
Mario Rico Ibรกรฑez
EPFL
Saรบl Fenollosa Arguedas
EPFL
Tamar Alphaidze
EPFL

๐Ÿค Collaboration

This research was conducted in collaboration with the Swiss Data Science Center (SDSC), a joint venture between EPFL and ETH Zurich. The SDSC provided:

  • ๐ŸŽ“ Academic Supervision: Expert guidance on research methodology
  • ๐Ÿ’ป Computational Resources: Access to high-performance computing infrastructure
  • ๐Ÿ“Š Data Science Expertise: Technical support and best practices
  • ๐ŸŒ Research Network: Connections to the broader data science community

About Swiss Data Science Center:

The Swiss Data Science Center develops and deploys cutting-edge data science and machine learning techniques to help solve complex societal challenges. By bridging the gap between academic research and real-world applications, SDSC enables researchers to leverage state-of-the-art tools and methodologies.

๐Ÿ”— Learn more: www.datascience.ch


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

We would like to express our gratitude to:

  • ๐Ÿ›๏ธ Swiss Data Science Center (SDSC) for their invaluable collaboration, computational resources, and technical guidance throughout this research project
  • ๐ŸŽ“ ร‰cole Polytechnique Fรฉdรฉrale de Lausanne (EPFL) for providing the academic environment and infrastructure
  • ๐Ÿ”ฌ Brax Team at Google Research for the differentiable physics engine that enabled efficient experimentation
  • ๐ŸŽฎ OpenAI Gym for standardized RL environment interfaces
  • ๐Ÿ“š Stable-Baselines3 team for reference implementations and best practices
  • ๐ŸŒ JAX Team for the high-performance numerical computing framework
  • ๐Ÿ“Š Weights & Biases for experiment tracking and visualization tools
  • ๐Ÿ’ก The broader reinforcement learning research community for open-source tools and reproducible research practices

Special Thanks:

  • To our reviewers and colleagues who provided valuable feedback
  • To the open-source community for making this research possible
  • To all contributors and users of this codebase

๐Ÿ“– References

  1. Salimans, T., et al. (2017). "Evolution Strategies as a Scalable Alternative to Reinforcement Learning." arXiv preprint arXiv:1703.03864.

  2. Mnih, V., et al. (2013). "Playing Atari with Deep Reinforcement Learning." arXiv preprint arXiv:1312.5602.

  3. Schulman, J., et al. (2017). "Proximal Policy Optimization Algorithms." arXiv preprint arXiv:1707.06347.

  4. Todorov, E., et al. (2012). "MuJoCo: A physics engine for model-based control." IROS 2012.

  5. Freeman, C. D., et al. (2021). "Brax - A Differentiable Physics Engine for Large Scale Rigid Body Simulation." NeurIPS 2021 Datasets and Benchmarks Track.


๐Ÿ› Troubleshooting

Common Issues

1. CUDA out of memory

# Reduce number of parallel environments
# In config file: num_envs: 1024  # instead of 8192

2. Wandb authentication

wandb login
# Enter your API key from https://wandb.ai/authorize

3. MuJoCo installation issues

# Install MuJoCo dependencies
sudo apt-get install libglew-dev patchelf

4. Slow training

# Enable JAX GPU acceleration
pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

โ“ Frequently Asked Questions

Q: When should I use ES instead of DRL?

Use ES when:

  • ๐ŸŽฏ You have a simple environment with low-dimensional states
  • ๐Ÿ” You need quick initial exploration
  • ๐Ÿ’ป You have access to many parallel workers
  • ๐ŸŽฒ Your reward function is sparse or deceptive

Use DRL when:

  • ๐Ÿ–ผ๏ธ You have high-dimensional observations (images)
  • ๐ŸŽฏ You need the highest possible performance
  • โฑ๏ธ Sample efficiency is critical
  • ๐Ÿ”ง You can afford hyperparameter tuning
Q: Why doesn't ES pretraining help PPO in MuJoCo?

ES only optimizes a single policy network, while PPO uses separate actor and critic networks. When we pretrain with ES:

  • โœ… We get a reasonable actor initialization
  • โŒ The critic still starts from scratch
  • โš ๏ธ The architectural mismatch limits knowledge transfer

Future work: Co-evolution of actor and critic networks may address this limitation.

Q: How do I choose hyperparameters?

For ES:

  • Start with sigma=0.05, population_size=128, lr=0.01
  • Increase population size for complex environments
  • Reduce sigma if training is unstable

For PPO:

  • Use configs from configs/es/ppo.yaml as baseline
  • Adjust num_envs based on available memory
  • Tune learning rate if training diverges

General advice: ES is more robust to hyperparameters than PPO!

Q: Can I use this for my own environments?

Yes! The code is designed to be extensible:

  1. Create a new environment config in configs/your_env.yaml
  2. Ensure your environment follows the Gym API
  3. Run training with your config
python src/es_drl/main_es.py --config configs/es/basic_es.yaml --env_config configs/your_env.yaml

For Brax environments, no changes needed. For custom environments, you may need to add a wrapper.

Q: How can I visualize my trained agents?

During training:

  • Enable video recording in your config
  • Videos are saved to results/[algorithm]/[env]/videos/

After training:

python scripts/visualize_agent.py \
    --checkpoint results/es/hopper/checkpoint.pkl \
    --env hopper \
    --num_episodes 5
Q: What computational resources do I need?

Minimum:

  • 8GB RAM
  • 4 CPU cores
  • Training time: Hours to days

Recommended:

  • 16GB+ RAM
  • GPU with 8GB+ VRAM
  • 8+ CPU cores for parallelization
  • Training time: Minutes to hours

Note: ES benefits more from CPU parallelization, while DRL benefits more from GPU acceleration.

Q: Where can I find more details about the experiments?

๐Ÿ“„ Full paper: RL_project.pdf - Contains complete methodology, results, and analysis

๐ŸŽจ Poster: Poster PDF - Visual summary of key findings

๐Ÿ“Š Code: Browse src/ for implementation details

๐Ÿ“ˆ Results: Check results/ for training curves and checkpoints


๐Ÿ”„ Future Work

  • Implement co-evolution of actor and critic networks
  • Test on more complex environments (Humanoid, manipulation tasks)
  • Explore trust-region ES variants
  • Integrate with other DRL algorithms (SAC, TD3)
  • Develop architecture-aware transfer learning
  • Multi-task and transfer learning experiments

๐Ÿ’ฌ Getting Help & Contributing

Need Help?

  • ๐Ÿ“– Documentation: Start with this README and the full paper
  • โ“ Issues: Open an issue on GitHub for bugs or questions
  • ๐Ÿ’ฌ Discussions: Use GitHub Discussions for general questions
  • ๐Ÿ“ง Contact: Reach out to the authors for research-related inquiries

Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿ› Report bugs via GitHub Issues
  2. ๐Ÿ’ก Suggest features or improvements
  3. ๐Ÿ”ง Submit pull requests with bug fixes or enhancements
  4. ๐Ÿ“ Improve documentation or add examples
  5. ๐ŸŒŸ Star the repo if you find it useful!

Contribution Guidelines:

  • Follow existing code style
  • Add tests for new features
  • Update documentation as needed
  • Reference related issues in PRs

Research Collaboration

Interested in collaborating or extending this research? We're open to:

  • ๐Ÿ”ฌ Joint research projects
  • ๐ŸŽ“ Supervising thesis projects
  • ๐Ÿค Industry partnerships
  • ๐Ÿ“Š Applying these methods to new domains

Contact the authors or Swiss Data Science Center for collaboration opportunities.


For questions, collaboration opportunities, or research inquiries, please open an issue or contact the authors.

Made with โค๏ธ at EPFL in collaboration with Swiss Data Science Center

ยฉ 2025 ร‰cole Polytechnique Fรฉdรฉrale de Lausanne. All rights reserved.

About

A comprehensive research project investigating Evolution Strategies as pretraining mechanisms for Deep Reinforcement Learning algorithms

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors