TL;DR
This paper introduces Algorithm Evolution using Large Language Model (AEL), a novel framework that leverages Large Language Models (LLMs) within an evolutionary computing paradigm to automatically design optimization algorithms. AEL evolves algorithms themselves, not just solutions, significantly reducing the need for human expertise and domain-specific model training, and demonstrates superior performance on the Traveling Salesman Problem (TSP) compared to human-designed heuristics and LLM-generated solutions.
What Problem Does This Paper Address?
Designing effective algorithms for complex optimization problems is a challenging and time-consuming task, typically requiring deep domain knowledge and extensive manual effort from human experts. While automated algorithm design (AAD) methods and machine learning approaches have made strides, they often rely on pre-defined algorithm frameworks, require substantial training data, or involve complex model crafting. Existing attempts to use LLMs for optimization often treat them as black-box optimizers or search operators, which can lead to poor generalization on large-scale problems due to their inherent limitations in handling complex representations and vast search spaces. This paper aims to bridge this gap by proposing a method that uses LLMs to evolve algorithms at a higher level, within an evolutionary framework, without requiring domain-specific model training.
Methods
The core of the paper is the Algorithm Evolution using Large Language Model (AEL) framework. AEL adapts the standard evolutionary computing (EC) paradigm, but with a crucial difference: each "individual" in the population represents an algorithm rather than a solution.
Here's how it works:
- Individual Representation: Each algorithm is represented by three components: a natural language description, a Python code block in a predefined format, and its fitness value.
- Initialization: The initial population of algorithms can be created either by using existing manually crafted algorithms or, as in the paper's experiments, by prompting an LLM to generate novel algorithms based on a task description.
- Evolutionary Operators (LLM-powered):
- Crossover: Two or more parent algorithms are fed to an LLM, along with the problem description, to generate a new offspring algorithm that combines aspects of its parents.
- Mutation: A single parent algorithm is provided to the LLM, along with the problem description, to generate a modified version of the algorithm.
- Prompt Engineering: A significant aspect of AEL is the careful design of prompts for the LLM. These prompts include a description of the task, the parent algorithm(s) (for crossover and mutation), and specific hints to guide the LLM in generating innovative and functional code.
- Fitness Evaluation: Algorithms are evaluated on a set of instances for the target problem, and their fitness is determined by their performance (e.g., the gap to the optimal solution).
- Population Management: Standard EC techniques like selection and population management are used to iteratively refine the population of algorithms, aiming to discover the fittest algorithm.
AEL distinguishes itself by evolving algorithms at the "algorithm level" without requiring model training, and by integrating LLMs as creative engines within a structured evolutionary process.
Datasets
The paper uses 64 randomly generated TSP50 instances for evaluating the fitness of algorithms during the evolutionary process. For the final evaluation of the optimized algorithms, they use TSP instances of varying sizes, ranging from TSP20 to TSP1000, with 64 randomly generated instances for each size. The performance is compared against the commercial solver Gurobi.
Key Insights and Ideas
- LLMs as Algorithm Designers, Not Just Solvers: The most significant insight is the shift from using LLMs to generate solutions to using them to generate the algorithms that produce solutions. This elevates the LLM's role from a direct solver to a creative partner in algorithm design.
- Evolutionary Framework for LLM Creativity: Combining LLMs with an evolutionary framework provides a structured way to explore the LLM's generative capabilities. The evolutionary process guides the LLM towards better algorithms by rewarding performance, preventing the LLM from getting stuck in suboptimal or overly random outputs.
- Algorithm-Level Evolution: AEL's focus on evolving the algorithm's structure and logic, rather than just tuning parameters or selecting operators, is a novel approach to automated algorithm design.
- Reduced Human Expertise: The framework significantly lowers the barrier to entry for algorithm design by abstracting away much of the need for deep domain knowledge and manual coding. Prompt engineering, while still requiring skill, is more accessible than traditional algorithm development.
- Scalability of LLM-Generated Algorithms: The paper demonstrates that algorithms evolved by AEL exhibit excellent scalability, outperforming domain model-based approaches that can overfit to specific problem sizes.
Key Results
- Superior Performance on TSP: The algorithms generated by AEL consistently outperform a human-designed greedy algorithm and LLM-generated heuristics across various TSP problem sizes (TSP20 to TSP1000).
- Significant Gap Reduction: For TSP1000, AEL reduced the average gap to the optimal solution from 25.2% (Greedy) to 12.8% (AEL with GPT-4).
- Excellent Scalability: AEL-generated algorithms show robust performance across different problem sizes, unlike domain models that tend to overfit. For instance, the average gap for the domain model increased dramatically from less than 1% to over 50% on large-scale problems.
- LLM vs. AEL: Directly instructing LLMs to generate algorithms (LLM) yielded results that were competitive with the greedy algorithm but inferior to AEL. Interestingly, GPT-4, while more powerful, sometimes produced worse results when directly prompted, suggesting that the evolutionary guidance of AEL is crucial for harnessing its capabilities effectively.
- Complex Generated Algorithms: The best algorithm generated by AEL for TSP was significantly more complex than the greedy heuristic, incorporating multiple factors and a sophisticated scoring function, which would be challenging for a human expert to design manually.
Limitations and Future Work
- LLM Creativity vs. Structure: The paper acknowledges the debate on whether LLMs truly create novel knowledge or merely splice existing information. While AEL's generated algorithms are largely novel, this remains an open question.
- Basic Constructive Framework: The current demonstration is based on a basic constructive heuristic framework for TSP. Integrating AEL with more advanced frameworks or complex algorithms could further enhance performance.
- Prompt Engineering Effort: While AEL reduces expert knowledge requirements, effective prompt engineering for each component remains a key workload for designers.
- Future Work:
- Integrating External Tools: Equipping LLMs with external tools and existing optimization algorithms could create a more flexible and robust framework.
- Additional Information for LLMs: Providing LLMs with more context, such as search trajectories or historical data, could lead to more powerful algorithm evolution.
- Complex Optimization Problems: Adapting AEL for highly complex problems might require decomposing them into simpler tasks or employing hierarchical evolution.
- Multi-objective AEL: Extending AEL to handle multi-objective optimization problems is a promising direction, given the prevalence of such problems in real-world scenarios.
Summary updated