TL;DR
LLaMEA-BO is an automated framework that uses an evolutionary strategy to guide Large Language Models (LLMs) in generating complete, fully functional Python code for Bayesian Optimization (BO) algorithms. Without any fine-tuning, the evolved algorithms consistently outperform state-of-the-art baselines on standard optimization benchmarks and generalize remarkably well to higher dimensions and unseen machine learning tasks.
What Problem Does This Paper Address?
Bayesian Optimization (BO) is the gold standard for optimizing expensive, black-box functions—such as tuning hyperparameters for deep neural networks or designing new materials. However, crafting an effective BO algorithm is a highly manual, expertise-driven endeavor. Designers must carefully select and tune multiple modular components, including an initial sampling design, a surrogate model (like a Gaussian Process), and an acquisition function to balance exploration and exploitation.
While recent research has leveraged LLMs to assist with individual components of this pipeline (like proposing new acquisition functions), autonomously generating a complete, end-to-end BO algorithm implementation remained an open challenge. The authors tackle this gap by treating the LLM not just as a code assistant, but as an evolutionary co-designer capable of iteratively refining full algorithmic structures.
Methods
The authors introduce LLaMEA-BO, an extension of the Large-Language-Model Evolutionary Algorithm (LLaMEA) framework tailored specifically for the BO domain.
Instead of asking the LLM to write code from a blank slate—which frequently leads to syntax errors and poor convergence—LLaMEA-BO provides a fully fledged but generic BO loop template. The LLM is then prompted to innovate within this template, focusing its creative capacity on trust-region logic, kernel selection, or acquisition scheduling.
The framework operates in a closed-loop generate-evaluate-improve cycle using population-based Evolution Strategies (ES), such as $(4+16)$-ES and $(8, 16)$-ES:
- Initialization: The LLM generates an initial population of candidate algorithms using a prompt designed to maximize algorithmic diversity.
- Evaluation: Each candidate's code is executed and evaluated on a subset of benchmark functions to compute its Area Over the Convergence Curve (AOCC).
- Crossover & Mutation: Top-performing algorithms are selected as parents. LLaMEA-BO introduces a novel crossover prompt that feeds the source code of two successful algorithms back to the LLM, instructing it to combine and refine their underlying strategies.
Datasets
- In-Loop Evaluation: A representative subset of 10 noiseless functions from the Black-Box Optimization Benchmarking (BBOB) test suite (part of the COCO platform) in 5 dimensions, utilizing a tight budget of 100 function evaluations.
- Final Benchmarking: The full suite of 24 BBOB functions evaluated across multiple dimensions ($d \in \{5, 10, 20, 40\}$).
- Generalization Testing: 25 hyperparameter tuning tasks from the Bayesmark framework (encompassing 5 real-world public datasets paired with 5 machine learning models like RandomForest, SVM, and MLP) along with 3 complex synthetic multimodal functions (Rosenbrock, Griewank, KTablet).
Key Insights and Ideas
- The Power of the Skeleton: Providing a structured code template rather than a blank slate was critical. Early experiments without the BO-specific template failed entirely, proving that guiding the LLM's search space accelerates meaningful algorithmic discovery.
- Population Dynamics Over (1+1): Moving from a simple $(1+1)$ evolutionary strategy to population-based methods with a "comma" selection strategy significantly improved performance. Larger populations prevent the framework from stalling when the LLM inevitably generates invalid or broken code.
- Algorithmic "Cheating" Caught: The authors discovered that some LLM-generated algorithms learned to exploit known coordinate biases in certain benchmark functions (sampling heavily near the origin where the optimum was located). To ensure true generalization, the authors proactively excluded these biased functions from their final evaluation pipeline.
- Natural Selection of Trust Regions: The top-evolved algorithms (such as ATRBO and TREvol) independently converged on incorporating trust-region mechanisms. This was an elegant emergent property driven by the benchmark's strict evaluation budget, which heavily rewards rapid local exploitation.
Key Results
- Baseline Superiority: The best LLM-generated algorithms outperformed state-of-the-art baselines (including CMA-ES, HEBO, TuRBO1, and Vanilla BO) on 19 out of 24 BBOB functions in 5 dimensions.
- Cross-Dimension Generalization: Algorithms evolved in 5D generalized exceptionally well to higher dimensions. ATRBO dominated lower dimensions (5D and 10D), while TREvol achieved the highest performance in 20D and 40D.
- Efficiency: Unlike other LLM-based optimization methods that query an LLM at every single iteration during runtime, LLaMEA-BO's generated code runs natively in Python. It executes in the same ballpark as TuRBO1 (~0.3 seconds) and an order of magnitude faster than HEBO.
Limitations and Future Work
While highly successful, the authors note a few key limitations:
- Inductive Bias: The template and tight evaluation budget inherently biased discoveries toward trust-region variants, leaving other paradigms (like information-theoretic or batch policies) underrepresented.
- Single Backend: All experiments relied exclusively on the
gemini-2.0-flashmodel due to budget constraints. - Scope: The empirical study was strictly limited to noiseless, continuous, single-objective tasks.
Future work aims to diversify prompts to encourage non-trust-region innovations and extend the framework to handle mixed-integer, constrained, noisy, or multi-objective optimization landscapes.
Summary updated