Evolutionary algorithm that uses Large Language Models (LLMs) to automatically improve programs through iterative mutation and selection.
- Quick Start - Get running in 5 minutes
- Architecture Guide - Understand the system design
- DAG System - Comprehensive guide to GigaEvo's execution engine
- Evolution Strategies - MAP-Elites and multi-island evolution system
- Tools - Helper utilities for analysis, debugging, and problem scaffolding
- Usage Guide - Detailed usage instructions
- Changelog - Version history and changes
- Contributing - Guidelines for contributors
Requirements: Python 3.12+
pip install -e .Create a .env file with your OpenRouter API key:
OPENAI_API_KEY=sk-or-v1-your-api-key-here
# Optional: Langfuse tracing (for observability)
LANGFUSE_PUBLIC_KEY=<your_langfuse_public_key>
LANGFUSE_SECRET_KEY=<your_langfuse_secret_key>
LANGFUSE_HOST=https://cloud.langfuse.com # or your self-hosted URLredis-serverpython run.py problem.name=heilbronThat's it! Evolution will start and logs will be saved to outputs/.
To study results, check tools or start tensorboard / wandb.
Sample analysis code is available at tools/playground.ipynb.
- Loads initial programs from
problems/heilbron/ - Mutates programs using LLMs (GPT, Claude, Gemini, etc.)
- Evaluates fitness by running the programs
- Selects best solutions using MAP-Elites algorithm
- Repeats for multiple generations
# Multi-island evolution (explores diverse solutions)
python run.py experiment=multi_island_complexity problem.name=heilbron
# Multi-LLM exploration (uses multiple models)
python run.py experiment=multi_llm_exploration problem.name=heilbron# Limit generations
python run.py problem.name=heilbron max_generations=10
# Use different Redis database
python run.py problem.name=heilbron redis.db=5
# Change LLM model
python run.py problem.name=heilbron model_name=anthropic/claude-3.5-sonnetGigaEvo uses a modular configuration system based on Hydra. All configuration is in config/:
experiment/- Complete experiment templates (start here!)base.yaml- Simple single-island evolution (default)full_featured.yaml- Multi-island + multi-LLM explorationmulti_island_complexity.yaml- Two islands: performance + simplicitymulti_llm_exploration.yaml- Multiple LLMs for diverse mutations
-
algorithm/- Evolution algorithmssingle_island.yaml- Standard MAP-Elitesmulti_island.yaml- Multiple independent populations with migration
-
llm/- Language model setupssingle.yaml- One LLM for all mutationsheterogeneous.yaml- Multiple LLMs (GPT, Claude, Gemini, etc.) for diverse mutations
-
pipeline/- DAG execution pipelinesauto.yaml- Automatically selects pipeline (standard or contextual) based on problemstandard.yaml- Basic validation → execution → metricswith_context.yaml- Includes contextual information extractioncustom.yaml- Template for custom pipelines
-
constants/- Tunable parameters grouped by domainevolution.yaml- Generation limits, mutation rates, selection pressurellm.yaml- Temperature, max tokens, retry logicislands.yaml- Island sizes, migration frequency, diversity settingspipeline.yaml- Stage timeouts, parallelization settingsredis.yaml- Connection settings, key patternslogging.yaml- Log levels, output formatsrunner.yaml- DAG execution settingsendpoints.yaml- API endpoint defaults
-
loader/- Program loading strategiesdirectory.yaml- Load initial programs from filesystemredis_selection.yaml- Load from existing Redis archive
-
logging/- Logging backendstensorboard.yaml- TensorBoard integrationwandb.yaml- Weights & Biases tracking
-
metrics/- Metric computationdefault.yaml- Basic fitness metricscode_complexity.yaml- Includes cyclomatic complexity, LOC, etc.
-
redis/- Redis storage backend -
runner/- DAG runner configuration -
evolution/- Core evolution engine settings
Override any setting via command line:
# Override experiment
python run.py experiment=full_featured
# Override specific settings
python run.py problem.name=heilbron max_generations=50 temperature=0.8
# Override nested settings
python run.py constants.evolution.mutation_rate=0.3See individual YAML files for detailed documentation on each component.
Results are saved to outputs/YYYY-MM-DD/HH-MM-SS/:
- Logs:
evolution_YYYYMMDD_HHMMSS.log - Programs: Stored in Redis for fast access
- Metrics: TensorBoard logs (if enabled)
If you see:
ERROR: Redis database is not empty!
Flush the database manually:
redis-cli -n 0 FLUSHDBOr use a different database number:
python run.py redis.db=1Check your API key in .env:
echo $OPENAI_API_KEYVerify OpenRouter is accessible:
curl -H "Authorization: Bearer $OPENAI_API_KEY" https://openrouter.ai/api/v1/models┌─────────────┐
│ Problem │ Define task, initial programs, metrics
└──────┬──────┘
│
v
┌─────────────┐
│ Evolution │ MAP-Elites algorithm
│ Engine │ Selects parents, generates mutations
└──────┬──────┘
│
v
┌─────────────┐
│ LLM │ Generates code mutations
│ Wrapper │ (GPT, Claude, Gemini, etc.)
└──────┬──────┘
│
v
┌─────────────┐
│ Evaluator │ Runs programs, computes fitness
│ (DAG Runner)│ Validates solutions
└──────┬──────┘
│
v
┌─────────────┐
│ Storage │ Redis for fast program access
│ (Redis) │ Maintains archive of solutions
└─────────────┘
- MAP-Elites: Algorithm that maintains diverse solutions across behavior dimensions
- Islands: Independent populations that can exchange solutions (migration)
- DAG Pipeline: Stages for validation, execution, complexity analysis, etc.
- Behavior Space: Multi-dimensional grid dividing solutions by characteristics
Create problem scaffolding from YAML configuration:
python -m tools.wizard heilbron.yamlSee tools/README.md for detailed wizard documentation.
-
Create directory in
problems/:problems/my_problem/ - validate.py # Fitness evaluation function - metrics.yaml # Metrics specification - task_description.txt # Problem description - initial_programs/ # Directory with initial programs - strategy1.py # Each contains entrypoint() function - strategy2.py - helper.py # Optional: utility functions - context.py # Optional: runtime context builder -
Run:
python run.py problem.name=my_problem
See problems/heilbron/ for a complete example.
Copy an existing experiment and modify:
cp config/experiment/base.yaml config/experiment/my_experiment.yaml
# Edit my_experiment.yaml...
python run.py experiment=my_experimentGigaEvo includes utilities for analysis and visualization:
tools/redis2pd.py- Export evolution data to CSVtools/comparison.py- Compare multiple runs with plotstools/dag_builder/- Visual DAG pipeline designertools/wizard/- Interactive problem setup
See tools/README.md for detailed documentation.
MIT License - see LICENSE file for details.
If you use GigaEvo in your research, please cite:
@misc{khrulkov2025gigaevoopensourceoptimization,
title={GigaEvo: An Open Source Optimization Framework Powered By LLMs And Evolution Algorithms},
author={Valentin Khrulkov and Andrey Galichin and Denis Bashkirov and Dmitry Vinichenko and Oleg Travkin and Roman Alferov and Andrey Kuznetsov and Ivan Oseledets},
year={2025},
eprint={2511.17592},
archivePrefix={arXiv},
primaryClass={cs.NE},
url={https://arxiv.org/abs/2511.17592},
}