⭐ If you like this, please give the repo a star – it helps!
The fully open alternative to Google DeepMind's AlphaEvolve for automated algorithm discovery. First released 📅 Nov 2024 • MIT License • 100 % reproducible • 🥈 Silver Humies 2025 at GECCO.
LLaMEA couples large-language-model reasoning with an evolutionary loop to invent, mutate and benchmark algorithms fully autonomously: the LLM writes code, your evaluation function scores it, and the feedback drives the next generation.
Table of Contents
- News
- Introduction
- LLaMEA variants
- Installation
- Quick Start
- Running experiments with BLADE
- Configuration
- Examples
- Publications
- Awards
- Reproducibility
- Contributing
- License
- Citation
🔥 News
- 2026.11 ✨ LLaMEA v1.6.0: ready-made variants
LLaMEA_HPO,LLaMEA_BO,LLaMEA_MOandLLaMEA_SAGE, adaptive operator selection that now really adapts, and a round of bug fixes (changelog). - 2026.11 ✨ BLADE v1.2: benchmark LLaMEA against other methods from a single YAML file.
- 2026.08 📄 "Evolving Executable Pipeline Programs for AutoML with Language Models" on arXiv.
- 2026.07 📄 "LLM-Driven Evolutionary Generation of Multi-Objective Bayesian Optimization Algorithms" on arXiv.
- 2026.01 📄 "LLaMEA-SAGE: Guiding Automated Algorithm Design with Structural Feedback from Explainable AI" on arXiv.
- 2025.08 🥉 A LLaMEA-generated agent won 3rd prize at the IEEE CoG 2025 Planet Wars RTS competition.
- 2025.07 🥈 LLaMEA won the Silver award at the Humies @ GECCO 2025.
- 2025.07 🏆 LLaMEA won the Anytime Performance on Many-Affine BBOB competition at GECCO 2025.
- 2025.06 📄 "LLaMEA-BO" on arXiv.
- 2025.05 🎉 "Optimizing Photonic Structures with LLM-Driven Algorithm Discovery" and "BLADE" at GECCO 2025.
- 2025.04 🎉 LLaMEA-HPO in ACM TELO: "In-the-loop Hyper-Parameter Optimization for LLM-Based Automated Design of Heuristics".
- 2025.04 🎉 "Code Evolution Graphs" accepted as a full paper at GECCO 2025.
- 2025.01 🎉 LLaMEA paper in IEEE TEVC: "LLaMEA: A Large Language Model Evolutionary Algorithm for Automatically Generating Metaheuristics".
Introduction
LLaMEA (Large Language Model Evolutionary Algorithm) uses LLMs such as GPT, Gemini, Claude or local models (Ollama, LM Studio, MLX) to generate and refine algorithms, typically optimisation heuristics, but equally ML pipelines or any other code you can score. Candidates evolve on measured performance and runtime feedback, so no prior algorithm-design expertise is needed.
Key features
| 🧬 Evolution strategies | (μ+λ) and (μ,λ) with random, tournament or roulette parent selection |
| 🔀 Operators | Mutation and crossover prompts with fixed weights or adaptive selection (e.g. discounted UCB) |
| 🎛️ LLaMEA-HPO | In-the-loop hyper-parameter optimisation (SMAC) so the LLM focuses on structure |
| 🎯 Multi-objective | Pareto-based selection (non-dominated sorting + crowding) over named objectives |
| 🌱 Diversity | Fitness sharing, clearing, novelty search and MAP-Elites |
| 🔍 Explainable guidance | LLaMEA-SAGE: XGBoost + TreeSHAP on code features steer mutations |
| ✂️ Diff mode | SEARCH/REPLACE patches instead of full rewrites, saving tokens |
| ⚡ Parallel & robust | Parallel evaluation with timeouts, population-level evaluation, warm start |
Use cases: problem-specific optimisation algorithms, new Bayesian optimisation algorithms for expensive problems, ML pipelines, photonic structure design, game agents, and more.
🧬 LLaMEA variants
The configurations from our papers are available as ready-made classes. They
only change defaults, so any LLaMEA argument still works and overrides the
preset.
| Variant | What it does | Preset | Paper |
|---|---|---|---|
LLaMEA |
The base algorithm | (5+5), mutation |
IEEE TEVC 2025 |
LLaMEA_HPO |
LLM writes the algorithm and its ConfigSpace; your evaluation tunes it (e.g. SMAC) | HPO=True, (5+5), refine-or-redesign |
ACM TELO 2025 |
LLaMEA_BO |
Evolves complete Bayesian optimisation algorithms | (4+16), crossover 0.6, budget 100, BO prompt |
arXiv:2505.21034 |
LLaMEA_MO |
Several objectives, NSGA-II-style selection, returns a Pareto front | multi_objective=True, (5+10) |
– |
LLaMEA_SAGE |
Mutations guided by explainable-AI analysis of code features | feature_guided_mutation=True |
arXiv:2601.21511 |
from llamea import LLaMEA_BO, LLaMEA_MO, get_variant
optimizer = LLaMEA_BO(evaluate, llm) # paper defaults
optimizer = LLaMEA_BO(evaluate, llm, budget=200) # override any argument
optimizer = LLaMEA_MO(evaluate_mo, llm, objectives=["Distance", "Fuel"],
task_prompt="...")
Variant = get_variant("hpo") # look up by name
🎁 Installation
pip install llamea
Optional extras:
pip install "llamea[feature-guidance]" # XGBoost for LLaMEA_SAGE / feature_guided_mutation (~290 MB)
pip install llamea-lite # slim install without bundled LLM / HPO dependencies
pip install iohblade # BLADE, to benchmark LLaMEA against other methods
From source with uv
git clone https://github.com/XAI-liacs/LLaMEA.git
cd LLaMEA
uv sync # core
uv sync --dev --group examples # tests and example dependencies
Some examples need SWIG
(brew install swig / sudo apt-get install swig). The plasmonic photonics
problem in benchmarks/tuto_global_optimization_photonics also needs
pyGDM2 (uv pip install pyGDM2), which
requires numpy<=2.3 and is therefore not part of any group.
💻 Quick Start
from llamea import LLaMEA, OpenAI_LLM
llm = OpenAI_LLM(api_key="...", model="gpt-6.2-sol") # or Gemini_LLM, Anthropic_LLM, Ollama_LLM, ...
def evaluate(solution, logger=None):
# solution.code holds the generated Python code, solution.name its class name.
namespace = {}
exec(solution.code, namespace)
algorithm = namespace[solution.name](budget=1000, dim=5)
score = ... # run it on your problem
solution.set_scores(score, feedback=f"The algorithm scored {score:.3f}.")
return solution
optimizer = LLaMEA(evaluate, llm, n_parents=4, n_offspring=8, budget=100)
best = optimizer.run()
print(best.name, best.fitness)
print(best.code)
budget is the number of generated and evaluated candidates. LLaMEA
maximises by default; pass minimization=True otherwise. Errors raised by the
candidate code are best caught in evaluate and passed on with
solution.set_scores(score, feedback, error=e), so the LLM can repair them.
🧪 Running experiments with BLADE
BLADE (Benchmarking LLM-driven Automated Design and Evolution, GECCO '25) is our benchmarking platform for LLM-driven algorithm design. It runs LLaMEA, including any variant configuration, next to other methods on built-in problem suites (BBOB, MA-BBOB, SBOX-COST, photonics, AutoML, ...) with isolated evaluation, the same budget for every method, seeding, logging, plots and a results web app.
Use LLaMEA directly for your own problem and evaluation function; use BLADE to benchmark, compare and report.
pip install iohblade
iohblade init my-exp # starter experiment.yml
iohblade check my-exp/experiment.yml
iohblade run my-exp/experiment.yml
# experiment.yml
experiment: {output_dir: results/my-exp, runs: 5, budget: 100}
llms:
gemini: {provider: gemini, model: gemini-3.8-flash, api_key: "${env:GEMINI_API_KEY}"}
methods:
- {type: llamea, name: "LLaMEA-{llm}", llm: gemini}
- type: llamea # LLaMEA-HPO
name: "LLaMEA-HPO-{llm}"
llm: gemini
params: {HPO: true, n_parents: 5, n_offspring: 5}
- {type: random_search, name: "RS-{llm}", llm: gemini}
problems:
- {type: bbob_sbox, name: SBOX-COST} # supports HPO (SMAC)
When you run LLaMEA on its own it prints a one-line pointer to BLADE; set
LLAMEA_NO_BLADE_HINT=1 to hide it. See the
BLADE documentation for all problems and
methods.
🔧 Configuration
The most used arguments of LLaMEA:
| Parameter | Description |
|---|---|
n_parents, n_offspring, elitism |
Population sizes and (μ+λ) (default) vs. (μ,λ) selection |
budget |
Number of candidates to generate and evaluate |
operators, operator_weight_updater |
Mutation/crossover prompts (Operator) and adaptive operator selection |
parent_selection, tournament_size |
"random", "tournament" or "roulette" |
role_prompt, task_prompt, example_prompt, output_format_prompt |
Prompt components |
HPO |
Ask for a ConfigSpace next to the code (LLaMEA-HPO) |
multi_objective, multi_objective_keys |
Pareto-based multi-objective mode |
niching |
"sharing", "clearing", "novelty" or "map_elites", with related options |
diff_mode |
SEARCH/REPLACE patches instead of full code |
adaptive_mutation, adaptive_prompt, feature_guided_mutation |
Mutation-rate control, co-evolving task prompt, XAI guidance |
evaluate_population |
f receives the whole offspring population |
eval_timeout, max_workers, parallel_backend |
Evaluation time limit and parallelism |
See the documentation for every parameter.
💡 Examples
| Script | Shows |
|---|---|
examples/minimum_example.py |
The smallest complete set-up |
examples/black-box-optimization.py |
Metaheuristics for the 24 BBOB functions, scored by AOCC |
examples/black-box-opt-with-HPO.py |
LLaMEA-HPO with SMAC tuning in the loop |
examples/black-box-optimization-diff-mode.py |
Diff mode (SEARCH/REPLACE patches) |
examples/crossover.py |
Mutation and crossover operators, tournament selection, discounted UCB |
examples/multi_objective.py |
LLaMEA-MO on a vehicle-routing problem (distance and fuel) |
examples/automl_example.py |
Evolving ML pipelines instead of optimisers |
examples/warm-start-tests.py |
Resuming a run from its archive |
Run any of them with uv run python examples/<script>.py after setting the
model and API key in the script. benchmarks/ holds the set-ups of our papers
(MA-BBOB, photonics, mini-Bragg).
To browse the LLM conversation of a run: uv run python logreader/app.py --logfile path/to/conversationlog.jsonl
and open http://localhost:5001.
📚 Publications
LLaMEA is developed by the XAI group of NACO at LIACS, Leiden University (project page, video).
Methodology
- LLaMEA: A Large Language Model Evolutionary Algorithm for Automatically Generating Metaheuristics. IEEE Transactions on Evolutionary Computation 29(2), 2025. DOI
- In-the-loop Hyper-Parameter Optimization for LLM-Based Automated Design of Heuristics (LLaMEA-HPO). ACM Transactions on Evolutionary Learning and Optimization, 2025. DOI
- Controlling the Mutation in Large Language Models for the Efficient Evolution of Algorithms. EvoApplications (Springer LNCS), 2025. DOI
- LLaMEA-BO: A Large Language Model Evolutionary Algorithm for Automatically Generating Bayesian Optimization Algorithms. arXiv:2505.21034
- LLaMEA-SAGE: Guiding Automated Algorithm Design with Structural Feedback from Explainable AI. arXiv:2601.21511
- LLM-Driven Evolutionary Generation of Multi-Objective Bayesian Optimization Algorithms. arXiv:2607.08791
- Large Language Models and Evolutionary Computation: A Critical Review of Bidirectional Interaction, Automated Algorithm Design, and Co-adaptive Systems. Computer Science Review, 2026. Article
Benchmarking & analysis
- BLADE: Benchmark Suite for LLM-driven Automated Design and Evolution of Iterative Optimisation Heuristics. GECCO '25 Companion. DOI · code
- Code Evolution Graphs: Understanding Large Language Model Driven Design of Algorithms. GECCO '25. DOI
- Behaviour Space Analysis of LLM-driven Meta-heuristic Discovery. arXiv:2507.03605
- From Heuristic Selection to Automated Algorithm Design: LLMs Benefit from Strong Priors. arXiv:2603.02792
Applications
- Optimizing Photonic Structures with Large Language Model Driven Algorithm Discovery. GECCO '25 Companion. DOI
- Landscape-aware Automated Algorithm Design: An Efficient Framework for Real-world Optimization. arXiv:2602.04529
- LLM Driven Design of Continuous Optimization Problems with Controllable High-level Properties. arXiv:2601.18846
- Evolving Executable Pipeline Programs for AutoML with Language Models. arXiv:2608.16416
🏆 Awards
- 🥈 Silver award, Humies @ GECCO 2025 (awards)
- 🏆 Winner, Anytime Performance for Affine BBOB competition, GECCO 2025 (results)
- 🏆 Winner, Anytime Algorithms for Many-affine BBOB Functions, GECCO 2024 (results)
- 🥉 Bronze, IEEE CoG 2025 Planet Wars RTS competition (results)
🔁 Reproducibility
Each paper has a Zenodo record with code, generated algorithms and logs:
- van Stein, N. (2025). BLADE – Code and Results for the paper. doi:10.5281/zenodo.15119985
- van Stein, N., Vermetten, D., & Bäck, T. (2025). LLaMEA-HPO: code, generated algorithms and IOH logging data. doi:10.5281/zenodo.14917719
- van Stein, N., Kononova, A. V., Kotthoff, L., & Bäck, T. (2025). Figures and code for Code Evolution Graphs. doi:10.5281/zenodo.14770672
- van Stein, N., & Bäck, T. (2024). LLaMEA. doi:10.5281/zenodo.13842144
🤝 Contributing
Contributions are welcome: report bugs or request features in GitHub Issues, or open a pull request. See CONTRIBUTING.md.
🪪 License
Distributed under the MIT License.
✨ Citation
If you use LLaMEA in your research, please cite:
@article{van2025llamea,
author = {van Stein, Niki and B{\"a}ck, Thomas},
journal = {IEEE Transactions on Evolutionary Computation},
title = {LLaMEA: A Large Language Model Evolutionary Algorithm for Automatically Generating Metaheuristics},
year = {2025},
volume = {29},
number = {2},
pages = {331--345},
doi = {10.1109/TEVC.2024.3497793}
}
LLaMEA-HPO, mutation control and BLADE
@article{van2025intheloop,
author = {van Stein, Niki and Vermetten, Diederick and B{\"a}ck, Thomas},
title = {In-the-loop Hyper-Parameter Optimization for LLM-Based Automated Design of Heuristics},
journal = {ACM Transactions on Evolutionary Learning and Optimization},
year = {2025},
doi = {10.1145/3731567}
}
@inproceedings{yin2025controlling,
author = {Yin, Haoran and Kononova, Anna V. and B{\"a}ck, Thomas and van Stein, Niki},
title = {Controlling the Mutation in Large Language Models for the Efficient Evolution of Algorithms},
booktitle = {Applications of Evolutionary Computation},
publisher = {Springer Nature Switzerland},
year = {2025},
pages = {403--417},
doi = {10.1007/978-3-031-90065-5_25}
}
For BLADE, see the BLADE citation (GECCO '25, doi:10.1145/3712255.3734347).
Metadata
Release files for llamea 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llamea-1.6.1.tar.gz | 9.0 MB | Without provenance | Details for llamea-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llamea-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for llamea-1.6.1-py3-none-any.whl |
Total release size: 9.1 MB
Release files / llamea-1.6.1.tar.gz
| Download URL | llamea-1.6.1.tar.gz |
|---|---|
| Size | 9.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1fb8935d19c1b4def062c77a43a9345f11d2f52350ceb33d92f64105749c44f
|
|
BLAKE2b-256 checksum How to use checksums |
ec63d86382d05c0f7ae5370ffc13fa63cd55aef7c090031af4710c9938243409
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.19
|
Release files / llamea-1.6.1-py3-none-any.whl
| Download URL | llamea-1.6.1-py3-none-any.whl |
|---|---|
| Size | 64.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0554543ed9b39a7d63f22de9013fa79d27f43544395da1949dfd6925373bae65
|
|
BLAKE2b-256 checksum How to use checksums |
f7a70b2a089c61e5f1b99c5883dc87660e2f9f740c1c4051c2a92c88d3ecb434
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.19
|
Security for llamea 1.6.1
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.