TL;DR
This paper presents the first systematic evaluation of Large Language Models (LLMs) as black-box numerical optimizers. The authors reveal that while LLMs can leverage semantic heuristics from prompts, they perform poorly on pure numerical optimization due to a fundamental mismatch between token-based string processing and floating-point arithmetic.
What Problem Does This Paper Address?
Black-box optimization involves finding the global minimum or maximum of an objective function whose underlying mathematical structure is unknown. Recently, a popular trend has emerged where researchers use LLMs as optimizers (e.g., feeding the model a history of good solutions and asking it to generate a better one).
However, it has been unclear whether LLMs genuinely offer distinct algorithmic advantages or if they are simply riding the wave of generative AI hype. This paper addresses this knowledge gap by rigorously evaluating whether LLMs possess the foundational properties required for effective numerical optimization, across both discrete and continuous domains.
Methods
The authors introduce a progressive evaluation framework to analyze LLMs as optimizers:
- Baseline Performance: Testing a variety of open- and closed-source LLMs on simple optimization tasks to identify top performers.
- Basic Properties: Evaluating the chosen models on core traits inherent to traditional optimizers: numerical precision understanding, scalability to higher dimensions, adaptability to coordinate shifts, and the balance between exploration and exploitation.
- Advanced Properties: Testing capabilities unique to LLMs, specifically their ability to extract and utilize implicit semantic heuristics from prompts (e.g., using city names or spatial coordinates to solve optimization problems).
The optimization loop mimics an evolutionary algorithm: the LLM is prompted with an iteratively updated list of the top $n$ historical solutions and their fitness scores, and is tasked with generating $m$ new candidate solutions.
Datasets
The models were evaluated using classic optimization benchmarks:
- Discrete Optimization: The Traveling Salesman Problem (TSP), scaled from 10 to 30 cities.
- Continuous Optimization: Five standard benchmark functions: Ackley, Griewank, Rastrigin, Rosenbrock, and Sphere.
Additionally, the authors curated a custom TSP variant using real US city names and their true geographical coordinates to test the models' high-level semantic knowledge retrieval.
Key Insights and Ideas
- The Tokenization Mismatch: Traditional optimizers excel because they operate directly on binary representations of numbers. LLMs process numbers as string tokens. Consequently, increasing the decimal precision in a prompt does not consistently improve performance and can even cause unpredictable performance degradation.
- Pronounced Exploitation Bias: Top-tier models like GPT-4 exhibit a strong "greedy" bias toward exploitation. They tend to cluster new samples tightly around previously discovered good solutions, risking premature convergence in complex landscapes.
- Lack of Shift-Invariance: Traditional optimizers are invariant to constant coordinate shifts. LLMs, however, are highly sensitive to shifts because changing the numbers alters the input string tokens completely, leading to wildly fluctuating optimization paths.
- The Semantic Knowledge Gap: While LLMs can successfully use explicit 2D coordinates to optimize a path, they fail to connect high-level semantic knowledge (like recalling a city's location from its name) into an actionable spatial optimization strategy.
Key Results
- Model Standouts: GPT-4 emerged as the most capable optimizer, followed by Gemini and GPT-3.5. Open-source models like LLaMA2 and InternLM struggled significantly with formatting constraints and verbosity.
- Precision Fluctuation: As shown in the precision tests, adding more decimal places to the input numbers led to highly unstable fitness outcomes rather than steady convergence.
- Dimensionality Collapse: LLMs do not scale well to high-dimensional spaces. When scaling the Sphere function from 16 to 256 dimensions, all models experienced an exponential decline in performance. GPT-3.5 failed completely at 128 dimensions due to context length limitations.
- TSP Formatting Failures: For discrete problems like the TSP, the failure rate (generating invalid permutations or repeating cities) increased drastically as the number of cities grew.
Limitations and Future Work
The primary limitations of LLM-based optimizers are their high computational cost, slow response times, strict context length constraints, and a lack of robust numerical understanding.
To overcome these roadblocks, the authors suggest that future research should focus on neuro-symbolic approaches: instead of forcing LLMs to compute numbers directly, they should be used to generate optimization code or call external computational tools (like calculators or specialized local search algorithms). Furthermore, exploring LLMs for non-numerical optimization tasks—such as prompt engineering and automated code generation—remains a highly promising frontier.
Summary updated