TL;DR
AutoSG is a fully automated framework that translates natural language task prompts into highly customized code solvers for computationally expensive optimization problems. By combining Retrieval-Augmented Generation (RAG), structure-preserving self-refinement, and an instance-free LLM-as-a-Judge evaluation mechanism, AutoSG eliminates the common pitfalls of LLM code generation—namely hallucinations, structural code degradation, and prohibitive simulation costs. The resulting solvers consistently outperform both human-designed state-of-the-art frameworks and existing automated LLM methods.
What Problem Does This Paper Address?
"Expensive optimization problems" are everywhere in engineering and machine learning, from tuning neural network hyperparameters to designing optimal airfoil shapes or satellite antennas. In these domains, evaluating a single configuration requires running high-fidelity simulations or building physical prototypes, which can take hours or cost thousands of dollars.
While using Large Language Models (LLMs) to automatically generate optimization code is a promising frontier, current approaches fail when applied to these expensive problems due to three major bottlenecks:
- Factual Hallucinations: LLMs lack specialized domain knowledge out of the box, often generating mathematically flawed or non-existent algorithmic structures.
- Structural Destruction: Iterative code refinement loops tend to catastrophically overwrite locally optimal code blocks that were already working well.
- Prohibitive Evaluation Costs: Existing frameworks evaluate generated code by actually executing it on training instances. When a single simulation takes hours, running an evolutionary loop with hundreds of candidate solvers becomes completely impossible.
Methods
AutoSG mimics the workflow of human domain experts by automating a three-stage pipeline:
- RAG-based Solver Generation: Instead of generating code from scratch, AutoSG rewrites the user's task prompt into academic search queries. It queries databases like arXiv and OpenAlex, retrieves the full text of the most relevant state-of-the-art (SOTA) paper, and uses a two-stage prompt pipeline to faithfully implement the paper's pseudocode into an initial Python solver ($S_{init}$). Crucially, it annotates critical algorithmic components to protect them later.
- One-Step Solver Self-Refinement: Rather than running a long, destructive evolutionary loop, AutoSG applies a targeted "learn-and-improve" operator. It introduces task-specific enhancements tailored to the prompt's exact constraints while strictly preserving the core mathematical structures identified in the RAG stage.
- Elo-based LLM-as-a-Judge Evaluation: To bypass the massive time and financial cost of running code simulations, AutoSG evaluates candidate solvers statically. An LLM acts as a judge, conducting pairwise comparisons of the code variants within a smart-pairing tournament. The tournament dynamically updates Elo ratings to efficiently crown the optimal solver ($S^*$).
Datasets
The authors evaluated AutoSG across three distinct optimization scenarios:
- BBOB Test Suite: 24 continuous optimization problems used to test high-dimensional performance (20-dimensional space with a strict budget of 300 function evaluations).
- CEC2013 Test Suite: 15 large-scale continuous optimization problems ranging from 905 to 1000 dimensions.
- Bayesmark Suite: A real-world hyperparameter tuning benchmark consisting of 5 machine learning models (RandomForest, SVM, DecisionTree, MLP, AdaBoost) evaluated across 5 public datasets and 3 strictly unseen private datasets.
Key Insights and Ideas
- Grounding Beats Guessing: Relying on an LLM's internal weights to generate complex mathematical code leads to broken algorithms. Explicitly grounding the generation process in peer-reviewed literature provides a rock-solid algorithmic foundation.
- Less is More in Code Evolution: Traditional genetic programming (crossover and mutation) often ruins good code. A targeted, one-step refinement that explicitly protects "important components" yields significantly better optimization performance than multi-step iterations.
- Static Judgment is Viable: You don't always need to spend 75 hours running simulation code to know if an algorithm is well-designed. Advanced LLMs possess deep enough programming comprehension to accurately rank optimization strategies purely through static code analysis and pairwise Elo tournaments.
Key Results
- Outperforming the Baselines: Across the 24 BBOB benchmark functions, AutoSG-generated solvers secured the top three positions in overall average ranking, significantly outperforming established human-designed baselines like CMA-ES, TuRBO, and HEBO.
- Excellent Generalization: On the Bayesmark hyperparameter tuning tasks, AutoSG achieved the lowest average regret. Crucially, its performance advantage widened on the private datasets, proving that the generated solvers generalize exceptionally well to entirely unseen tasks.
- Tournament Efficiency: The Elo-based LLM-as-a-Judge mechanism successfully identified the top-performing solver while requiring only 63.64% of the matches an exhaustive pairwise comparison would need, saving massive computational overhead.
Limitations and Future Work
- API Dependency: As a fully LLM-driven workflow, AutoSG is highly sensitive to external API stability. A network timeout or API error can halt the pipeline, requiring manual intervention to restart. The authors note that future work will focus on wrapping AutoSG into a self-reflective, autonomous agent framework capable of diagnosing and recovering from runtime errors.
- Interpolation vs. Extrapolation: Because the generation engine is rooted in RAG, AutoSG excels at interpolating and recombining existing human knowledge. Inventing entirely novel optimization paradigms completely outside the current distribution of human literature remains an open challenge that the authors hope to address via advanced mathematical reasoning mechanisms.
Summary updated