OpenEvolve: Evolving Code with LLMs

Published on 9/4/2026

OpenEvolve is an open-source implementation of AlphaEvolve (DeepMind) - instead of editing code by hand, an LLM takes on the role of “mutator” in an evolutionary loop, with selection driven by scores from an evaluator.

How the loop works

Four main components:

Each round: pick 2 programs (1 to score, 1 to “inspire”) → the LLM generates a new variant → the evaluator scores it → the database is updated. The database is split into multiple islands (separate populations) that occasionally migrate individuals between each other - avoiding premature convergence on a local solution.

Installing and trying it out

pip install openevolve
export OPENAI_API_KEY="your-key"

python openevolve-run.py \
  examples/function_minimization/initial_program.py \
  examples/function_minimization/evaluator.py \
  --iterations 50

Works with OpenAI, Gemini, local models, or any OpenAI-compatible API.

Evaluator cascade

The evaluator doesn’t just return a score - it also returns artifacts: stderr, profiling logs, build warnings, feedback from another LLM. These artifacts are fed directly into the next round’s prompt, forming an error feedback loop:

evaluator:
  enable_artifacts: true      # đưa lỗi vào prompt vòng sau
  cascade_evaluation: true    # chấm nhiều giai đoạn, loại sớm code tệ
  use_llm_feedback: true      # dùng LLM chấm chất lượng code

Notable config options

ParameterMeaning
database.num_islandsnumber of parallel populations
database.population_sizenumber of individuals per island
database.feature_dimensionsquality-diversity axes used to classify individuals
prompt.num_top_programs / num_diverse_programsselects the best / most diverse code to include in the prompt
random_seedfixed seed for reproducible results

Results

When it’s worth using

Well-suited to problems with a clear, fast, measurable evaluation function (speed, accuracy, cost) - since the entire loop depends on the scores returned by the evaluator. Not suited to cases requiring subjective human judgment or problems where an automated evaluator can’t be written.