NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Large Language Models as Evolutionary Optimizers

Shengcai Liu, Caishun Chen, Xinghua Qu, Ke Tang, Yew-Soon Ong

TL;DR

Researchers have developed LMEA (LLM-driven Evolutionary Algorithm), a framework that uses Large Language Models as "zero-shot" evolutionary optimizers. Instead of humans hand-coding complex crossover and mutation rules, LMEA simply describes the optimization problem in natural language and lets the LLM generate new solutions, achieving results competitive with traditional heuristics on Traveling Salesman Problems (TSPs) of up to 20 nodes.

What Problem Does This Paper Address?

Evolutionary Algorithms (EAs) are powerful tools for solving "combinatorial optimization" problems—tasks like finding the shortest delivery route or the most efficient factory schedule. However, EAs have a major bottleneck: they require handcrafted operators.

To make an EA work well, an expert must carefully design "crossover" (combining two good solutions) and "mutation" (randomly tweaking a solution) rules specific to that problem. This process is time-consuming, requires deep domain expertise, and often needs to be redone from scratch for every new type of problem. The authors ask: Can we skip the manual coding and use the latent reasoning capabilities of LLMs to handle the "evolution" part of the search?

Methods

The authors introduce LMEA, which follows the standard evolutionary loop but replaces hard-coded logic with natural language prompting:

  1. Prompt Construction: In each generation, LMEA builds a prompt for the LLM (specifically GPT-3.5) containing:
  2. Problem Description: A plain-text explanation of the task (e.g., "Find the shortest path through these coordinates").
  3. In-context Examples: A list of current solutions (the "population") and their scores, sorted from best to worst.
  4. Task Instructions: Explicitly telling the LLM to select parents, perform crossover, and mutate them to create new "offspring."
  5. Zero-Shot Evolution: The LLM generates new solutions based on the prompt. No additional training or fine-tuning of the model is required.
  6. Self-Adaptation: To prevent the search from getting stuck in a "local optimum" (a good but not perfect solution), LMEA includes a mechanism that automatically increases the LLM's temperature (randomness) if no improvement is found for several generations. This forces the model to explore more creative, diverse paths.

Datasets

The study evaluates LMEA on the Traveling Salesman Problem (TSP), a classic benchmark in optimization.

  • Instances: They used 2D TSP instances generated via the portgen (uniform distribution) and portcgen (clustered distribution) generators from the 8th DIMACS Implementation Challenge.
  • Scale: They tested problem sizes of 10, 15, 20, and 25 nodes.
  • Baselines: LMEA was compared against traditional heuristics like Nearest Neighbor (NN) and various Insertion heuristics (FI, NI, RI), as well as OPRO, a recent LLM-based optimization method that doesn't use evolutionary operators.

Key Insights and Ideas

  • LLMs as Intuitive Designers: The results suggest that LLMs have "internalized" the logic of optimization through their massive training data. They don't need to be told how to do a 2-opt swap; they intuitively understand how to rearrange a sequence to make it shorter.
  • The Power of Evolutionary Structure: LMEA significantly outperformed OPRO (which simply asks the LLM for better solutions). This proves that the structure of an evolutionary algorithm—specifically the concepts of selection, crossover, and mutation—is highly effective even when the "engine" is a language model.
  • Temperature as a Search Controller: In traditional EAs, you might adjust "mutation rates." In LMEA, the "temperature" parameter serves a similar role, acting as a knob to balance exploration (searching new areas) and exploitation (refining known good paths).

Key Results

  • Near-Perfect Performance at Small Scales: On TSP instances with 10 and 15 nodes, LMEA consistently found the mathematically optimal solution.
  • Competitive with Heuristics: At 20 nodes, LMEA performed competitively with classic hand-designed heuristics, often finding better solutions than "Nearest Neighbor" and staying within a small percentage of the best-known insertion methods.
  • Superiority over Non-EA LLM Methods: LMEA consistently beat OPRO across all test sets, with the performance gap widening as the problems became more complex.

Limitations and Future Work

  • The Scalability Wall: Performance dropped noticeably at 25 nodes. LLMs have a "context window" limit, and as the number of coordinates grows, the prompt becomes too long and complex for the model to process accurately.
  • Cost and Speed: Running an optimization loop through an API (like ChatGPT) is currently slow and expensive compared to running a local C++ script. The authors suggest that using smaller, fine-tuned local models could solve this.
  • Future Directions: The authors propose "local search" prompting—instructing the LLM to only fix small parts of a large solution—as a way to scale LMEA to problems with hundreds or thousands of nodes.

Summary updated

BibTeX
@inproceedings{liu2024large,
  author = {Shengcai Liu and Caishun Chen and Xinghua Qu and Ke Tang and Yew-Soon Ong},
  title = {{Large Language Models as Evolutionary Optimizers}},
  booktitle = {CEC},
  year = {2024},
  doi = {10.1109/cec60901.2024.10611913},
}
Figure