| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An open-source implementation of the AlphaEvolve system described in the Google DeepMind paper "AlphaEvolve: A coding agent for scientific and algorithmic discovery" (2025).
OpenEvolve is an evolutionary coding agent that uses Large Language Models to optimize code through an iterative process. It orchestrates a pipeline of LLM-based code generation, evaluation, and selection to continuously improve programs for a variety of tasks.
Key features:
OpenEvolve follows an evolutionary approach with the following components:
The controller orchestrates interactions between these components in an asynchronous pipeline, maximizing throughput to evaluate as many candidate solutions as possible.
To install natively, use:
git clone https://github.com/codelion/openevolve.git
cd openevolve
pip install -e .We use the OpenAI SDK, so you can use any LLM or provider that supports an OpenAI compatible API. Just set the OPENAI_API_KEY environment variable and update the api_base in config.yaml if you are using a provider other than OpenAI. For local models, you can use an inference server like optillm.
from openevolve import OpenEvolve
# Initialize the system
evolve = OpenEvolve(
initial_program_path="path/to/initial_program.py",
evaluation_file="path/to/evaluator.py",
config_path="path/to/config.yaml"
)
# Run the evolution
best_program = await evolve.run(iterations=1000)
print(f"Best program metrics:")
for name, value in best_program.metrics.items():
print(f" {name}: {value:.4f}")OpenEvolve can also be run from the command line:
python openevolve-run.py path/to/initial_program.py path/to/evaluator.py --config path/to/config.yaml --iterations 1000OpenEvolve automatically saves checkpoints at intervals specified by the checkpoint_interval config parameter (default is 10 iterations). You can resume an evolution run from a saved checkpoint:
python openevolve-run.py path/to/initial_program.py path/to/evaluator.py \
--config path/to/config.yaml \
--checkpoint path/to/checkpoint_directory \
--iterations 50When resuming from a checkpoint:
Example workflow with checkpoints:
# Run for 50 iterations (creates checkpoints at iterations 10, 20, 30, 40, 50)
python openevolve-run.py examples/function_minimization/initial_program.py \
examples/function_minimization/evaluator.py \
--iterations 50
# Resume from checkpoint 50 for another 50 iterations (creates checkpoints at 60, 70, 80, 90, 100)
python openevolve-run.py examples/function_minimization/initial_program.py \
examples/function_minimization/evaluator.py \
--checkpoint examples/function_minimization/openevolve_output/checkpoints/checkpoint_50 \
--iterations 50Each checkpoint directory contains the best program found up to that point, making it easy to compare solutions over time:
checkpoints/
checkpoint_10/
best_program.py # Best program at iteration 10
best_program_info.json # Metrics and details
programs/ # All programs evaluated so far
metadata.json # Database state
checkpoint_20/
best_program.py # Best program at iteration 20
...
You can compare the evolution of solutions by examining the best programs at different checkpoints:
# Compare best programs at different checkpoints
diff -u checkpoints/checkpoint_10/best_program.py checkpoints/checkpoint_20/best_program.py
# Compare metrics
cat checkpoints/checkpoint_*/best_program_info.json | grep -A 10 metricsYou can also install and execute via Docker:
docker build -t openevolve .
docker run --rm -v $(pwd):/app openevolve examples/function_minimization/initial_program.py examples/function_minimization/evaluator.py --config examples/function_minimization/config.yaml --iterations 1000OpenEvolve is highly configurable. You can specify configuration options in a YAML file:
# Example configuration
max_iterations: 1000
llm:
primary_model: "gemini-2.0-flash-lite"
secondary_model: "gemini-2.0-flash"
temperature: 0.7
database:
population_size: 500
num_islands: 5Sample configuration files are available in the configs/ directory:
See the Configuration Guide for a full list of options.
See the examples/ directory for complete examples of using OpenEvolve on various problems:
A comprehensive example demonstrating OpenEvolve's application to symbolic regression tasks using the LLM-SRBench benchmark. This example shows how OpenEvolve can evolve simple mathematical expressions (like linear models) into complex symbolic formulas that accurately fit scientific datasets.
Explore the Symbolic Regression Example
Key features:
Our implementation of the circle packing problem from the AlphaEvolve paper. For the n=26 case, where one needs to pack 26 circles in a unit square we also obtain SOTA results.
Explore the Circle Packing Example
We have sucessfully replicated the results from the AlphaEvolve paper, below is the packing found by OpenEvolve after 800 iterations
This is exactly the packing reported by AlphaEvolve in their paper (Figure 14):
An example showing how OpenEvolve can transform a simple random search algorithm into a sophisticated simulated annealing approach.
Explore the Function Minimization Example
To use OpenEvolve for your own problems:
If you use OpenEvolve in your research, please cite:
@software{openevolve,
title = {OpenEvolve: Open-source implementation of AlphaEvolve},
author = {Asankhaya Sharma},
year = {2025},
publisher = {GitHub},
url = {https://github.com/codelion/openevolve}
}
| Back | FazBrowse Home | New Git URL |