OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modeling

Maxime Bouscary, Saurabh AminarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) often struggle with generating reliable optimization code, frequently producing solutions with logical flaws or suboptimality. We present OptiHive, a framework that shifts from iterative "self-correction" to a parallel "generate-then-select" paradigm. By generating an ensemble of solvers, problem instances, and tests, and applying a Dawid-Skene latent-class model, OptiHive identifies the most trustworthy solvers. Our results demonstrate significant performance boosts, raising optimality from 5% to over 92% on complex vehicle routing tasks.

Introduction

While LLMs excel at translating natural language into code, their application in mathematical optimization is hindered by "soft deficiencies"—logic that produces suboptimal or mathematically invalid solutions despite being syntactically correct. Traditional iterative debugging loops suffer from high latency and the "verification gap," where the model cannot reliably judge its own output without ground truth. OptiHive addresses these challenges by leveraging a "wisdom of the crowd" approach, treating LLM-generated components as noisy signals to be statistically aggregated.

Methodology: The Generate-then-Select Paradigm

OptiHive replaces slow, sequential feedback loops with a two-stage parallel process.

The OptiHive pipeline: from parallel generation of components to statistical selection of the best solver.

1. Parallel Generation and Filtering

The framework prompts an LLM to simultaneously generate a pool of candidate solvers, a set of diverse problem instances (including infeasible ones to act as "traps"), and a suite of validity tests. An Integer Linear Program (ILP) filters out non-interpretable combinations that fail basic execution, ensuring a clean data cube for analysis.

2. Statistical Characterization

The core of OptiHive is a Dawid-Skene latent-class model. This model treats solver outputs and test results as noisy observations. It jointly estimates the true feasibility of instances, the validity of solver solutions, and the specific error rates (Type I and Type II) of both solvers and tests. A scalarized objective function then ranks solvers, rewarding those that consistently find high-quality solutions while penalizing those that hallucinate solutions for infeasible problems.

Experimental Results

We evaluated OptiHive on challenging problems including the Multi-Depot Vehicle Routing Problem (MDVRP) with 2D obstacles and variants of the Weighted Set Cover Problem (WSCP).

Performance of OptiHive across DCMDVRP and MDVRP+OBS tasks, showing rapid gains in feasibility and optimality as the ensemble size increases.

Performance Gains

The results show massive improvements over single-shot LLM baselines. On the MDVRP with obstacles—a task requiring complex visibility graph construction—optimality rates soared from a baseline of 5% to 92.1%. Similarly, feasibility on the DCMDVRP task jumped from 43% to 98.7%.

Key Insights

  • Parallelism vs. Iteration: Generating 100 candidates in one batch provides lower and more consistent latency than iterative fixing.
  • Signal from Noise: Consensus, weighted by inferred reliability, proves highly accurate even when individual components are noisy.
  • Test Asymmetry: LLMs are generally more proficient at writing verification tests than the solvers themselves; OptiHive exploits this gap to grade solver performance.

Conclusion and Future Work

OptiHive demonstrates that statistical modeling can transform unreliable LLM outputs into high-performance optimization tools. While it increases token consumption, the trade-off in reliability and latency is substantial. Future research will explore heterogeneous ensembles—mixing models from different LLM families—to further enhance the diversity and robustness of the solver pool.

Summary updated

BibTeX
@misc{bouscary2025optihive,
  author = {Maxime Bouscary and Saurabh Amin},
  title = {{OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modeling}},
  year = {2025},
  eprint = {2508.02503},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.02503},
}
Figure