Exploring the True Potential: Evaluating the Black-box Optimization Capability of Large Language Models

Beichen Huang, Xingyu Wu, Yu Zhou, Jibin Wu, Liang Feng, Ran Cheng, Kay Chen Tan

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:

  1. Baseline Performance: Testing a variety of open- and closed-source LLMs on simple optimization tasks to identify top performers.
  2. 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.
  3. 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.

Fig. 1: An illustration of our evaluation on applying popular LLMs for black-box optimization. (a) Overall evaluation process. First, we will assess the baseline performance of different models through a series of simple tasks. These baseline experiments will help identify a subset of top-performing models, which will then be utilized to evaluate the essential properties of optimizers on LLMs in detail. We will begin by examining basic properties, which are typical of most optimizers, and subsequently move on to advanced properties that only LLMs may possess. (b) Process of evaluating each property. First, we will design a task that can reflect the property in question. Next, we will create a prompt template tailored to this task. Finally, we will employ multiple models to conduct the optimization process, thereby assessing their performance regarding the evaluated property.

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.
Visualization of the continuous numerical benchmark function landscapes.

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.
Impact of numerical precision (number of decimal digits) on LLM optimization fitness.
  • 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.
Fig. 4: Evaluation results of LLMs’ scalability on problem dimensions. We scale the number of dimensions from 16 to 256 using a sphere function.
  • 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

BibTeX
@misc{huang2024exploring,
  author = {Beichen Huang and Xingyu Wu and Yu Zhou and Jibin Wu and Liang Feng and Ran Cheng and Kay Chen Tan},
  title = {{Exploring the True Potential: Evaluating the Black-box Optimization Capability of Large Language Models}},
  year = {2024},
  eprint = {2404.06290},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.06290},
}
Figure