TL;DR
LLaMEA-SAGE advances Automated Algorithm Design (AAD) by introducing a structured feedback loop that analyzes the code features of LLM-generated optimization algorithms. By training a surrogate model on abstract syntax tree (AST) properties and using explainable AI (SHAP) to generate natural-language mutation hints, it guides LLMs to discover superior black-box optimization algorithms significantly faster than vanilla evolutionary approaches.
What Problem Does This Paper Address?
Large Language Models (LLMs) have recently emerged as powerful tools for Automated Algorithm Design (AAD), capable of generating entirely new optimization heuristics from natural-language prompts. Frameworks like LLaMEA drive this process using an evolutionary loop: the LLM generates an algorithm, the algorithm is evaluated on a benchmark, and its performance score (fitness) is fed back to the LLM to guide the next iteration.
However, this traditional setup treats the generated code as a complete black box. The LLM only receives a single scalar fitness score, completely ignoring the rich structural information hidden inside the code itself (such as its complexity, depth, or token distribution). This lack of structural awareness often leads to inefficient exploration, premature stagnation, or a reliance on rigid, predefined code templates.
This paper introduces LLaMEA-SAGE (Structural Feedback from Explainable AI) to bridge the gap between code structure and performance feedback, allowing the evolutionary process to learn why certain code structures work better.
Methods
LLaMEA-SAGE enhances template-free algorithm evolution by extracting structural features from code and translating them into actionable prompt guidance.
The architecture operates in four main phases:
- Feature Extraction via ASTs: Every time the LLM generates a candidate Python algorithm, the framework parses it into an Abstract Syntax Tree (AST) and models it as a directed graph. It extracts graph-theoretic properties (e.g., node/edge counts, degree statistics, tree depth, clustering coefficients) alongside static complexity metrics (e.g., cyclomatic complexity, token counts).
- Archive-Based Surrogate Modeling: The framework maintains an archive of all evaluated algorithms, mapping their structural feature vectors to their actual benchmark performance (AOCC). Once the archive is large enough, an XGBoost regressor is trained to model the non-linear relationship between code structure and performance.
- Feature Importance via SHAP: To extract human- and LLM-understandable insights, the authors apply SHAP (SHapley Additive exPlanations) to the trained XGBoost model. This identifies which specific structural feature has the highest absolute impact on predicting high performance.
- Guided Mutation Prompting: The sign of the top SHAP value determines the direction of guidance. This insight is appended to the LLM's mutation prompt as a lightweight natural-language instruction, such as: "Based on archive analysis, try to increase the total cyclomatic complexity of the solution."
Datasets
The authors evaluated LLaMEA-SAGE on two continuous black-box optimization benchmarks using the IOH-BLADE profiling toolbox:
- SBOX-COST: A benchmark suite consisting of noiseless, single-objective, box-constrained optimization problems. The authors utilized a subset of five separable functions in 10 dimensions (10D) for their controlled proof-of-concept experiment.
- MA-BBOB (Many Affine BBOB): A highly diverse benchmark suite from the official GECCO competition featuring various affine combinations of BBOB functions. Training was conducted on 10 instances in 10D, and final validation was scaled to 50 unseen instances across 5D, 10D, and 20D to test generalizability.
Key Insights and Ideas
- Noisy Correlations are Enough: The surrogate model doesn't need to find perfect causal relationships between code structure and performance. Even imperfect, noisy correlations are sufficient to beneficially bias the LLM's exploration during early AAD stages.
- LLMs Ignore Guidance When Told to Innovate: An analysis of prompt consistency revealed that when the LLM is prompted to generate a "random new" algorithm, it completely ignores the structural SHAP guidance. However, when given a "refine" prompt, it consistently follows instructions to increase or decrease specific code features.
- Task-Specific Complexity Bias: For the SBOX-COST benchmark, the surrogate model overwhelmingly recommended increasing structural metrics like total cyclomatic complexity and parameter counts, indicating that more sophisticated algorithmic logic was required for better performance.
Key Results
Faster Convergence
In the SBOX-COST experiment, LLaMEA-SAGE achieved better performance much faster than vanilla LLaMEA, showing a massive relative speed-up (up to ~8x) in the early stages of the evolutionary run.
Outperforming State-of-the-Art
On the larger MA-BBOB benchmark, LLaMEA-SAGE consistently outperformed vanilla LLaMEA as well as prominent SOTA baselines like MCTS-AHD and LHNS. Remarkably, at just 50 evaluations, LLaMEA-SAGE reached an average fitness level that vanilla LLaMEA failed to achieve even after its full budget of 200 evaluations.
Token Efficiency
Despite adding an advanced XAI analysis loop, LLaMEA-SAGE only marginally increased token costs compared to vanilla LLaMEA. Meanwhile, competing methods like MCTS-AHD consumed more than twice the number of tokens because they query the LLM multiple times per solution.
Limitations and Future Work
While highly effective, the authors note several limitations:
- Static Features Only: The current feature extraction pipeline relies entirely on static code analysis. It does not capture dynamic execution behaviors, such as runtime memory usage or actual internal variable trajectories during an optimization run.
- Single-Feature Guidance: The SHAP guidance currently picks only the single most influential feature per mutation step, potentially missing complex interaction effects between multiple code properties.
- Benchmark Scope: The framework was primarily validated on continuous, noiseless black-box optimization problems at moderate dimensionalities; its efficacy on noisy objectives or combinatorial problem spaces remains an open question.
Future work aims to combine these static structural features with dynamic runtime descriptors and explore multi-feature guidance strategies.
Summary updated