Step-by-Step Optimization-like Reasoning in LLMs over Expanding Search Spaces

Nicolás Astorga, Nabeel Seedat, Mihaela van der Schaar

TL;DR

The paper introduces OPT⋆, a framework that leverages constrained optimization problems to automatically generate scalable, verifiable training data for Large Language Models (LLMs). By utilizing cheap programmatic feasibility checkers and evaluators, the authors demonstrate that both search-based offline reinforcement learning (RL) and solver-guided online RL significantly enhance an LLM's ability to execute complex, step-by-step reasoning over expanding search spaces.

What Problem Does This Paper Address?

While verifiable reward training (like the STaR framework) has successfully boosted LLM performance in math and coding, these domains typically focus on finding a single, exact correct answer. Many real-world problems—such as scheduling, logistics routing, and resource allocation—are fundamentally different: they are constrained optimization problems. In these scenarios, many solutions are technically "feasible," but only a few provide high value.

LLMs notoriously struggle with these tasks because a single locally plausible but short-sighted step can inadvertently violate a hard constraint later down the line or result in a highly suboptimal final plan. Furthermore, generating diverse optimization benchmarks and obtaining step-by-step human supervision to train models against these pitfalls is incredibly expensive.

Methods

To bridge this gap, the authors formalize OPT⋆ (OPTimization-based Scalable Tasks for Auto-verifiable Reasoning). An OPT⋆ task scales its difficulty via a complexity parameter ($\alpha$) that expands the search space without requiring new human labels.

The authors propose two distinct training regimes depending on whether an exact algorithmic solver is available:

  1. Solver-Guided Online Policy Optimization ($\nu$PO): When a fast solver is available, it acts as a "value oracle" for partial states. Candidate next steps are sampled from the LLM, scored by the solver based on the best possible completion reachable from that step, and the policy is updated using rank-shaped rewards (e.g., via an extension of GRPO).
  2. Search-Based Offline RL: When a fast solver is unavailable or too expensive, the framework relies on structure-aware tree search (like Monte Carlo Tree Search, termed $\nu$MCTS) guided only by terminal objective values. To make search efficient, they introduce two plug-and-play structural interventions:
  3. [C1] Feasibility Pruning: Immediately discarding invalid actions using a cheap programmatic checker.
  4. [C2] Duplicate-Action Merging: Grouping distinct textual outputs that map to the exact same logical action to avoid wasting search budget.

The best trajectories discovered during search are subsequently distilled into the LLM via Supervised Fine-Tuning (SFT).

Figure 1: OPT⋆overview using a Traveling Salesman-style example. (a) Tasks can be instantiated by humans, programs, or LLM-assisted generators. (b1) Classical optimization problems naturally expose objectives and constraints, making them auto-verifiable. (b2) Difficulty can be scaled by changing a complexity parameter α, such as the number of customers or the structure of the instance. Increasing α enlarges the search space while feasibility and objective evaluation remain cheap. (c) We study two training recipes: solver-guided next-step supervision when a solver is available, and search-based discovery when only feasibility checks and terminal objective values are available. (d) A model action can correspond to fixing one or more structured decision variables.

Datasets

The authors evaluate their framework using a diverse suite of traditional combinatorial optimization task families:

  • Role Assignment with Conflicts (Combinatorial matching)
  • Constrained MaxSAT (Logical reasoning)
  • Single-Machine Weighted Tardiness Scheduling (Temporal planning)
  • Polyomino Target Cover (Spatial reasoning)
  • 0-1 Knapsack and Quadratic Assignment Problem (QAP)

They also utilize auxiliary Grid-Spatial QA tasks to test low-level spatial operation transfer, as well as standard out-of-domain math benchmarks (MATH-500, AMC'23, AIME'24/25) and coding benchmarks (MBPP) to measure broader reasoning generalization.

Visual overview of the studied OPT⋆ task families

Key Insights and Ideas

  • Optimization as Infinite Supervision: Optimization problems naturally possess the exact ingredients needed for scalable LLM training: automated instance generation, cheap partial action validation, and objective scoring functions.
  • The Information Bottleneck: Mathematically, as the complexity ($\alpha$) and search space grow, a model must extract exponentially more information per unit of search budget to maintain a constant success rate.
  • Structural Search Interventions are Vital: Simply pruning invalid steps and merging text duplicates dramatically reduces the effective branching factor ($b_{\text{eff}}$). This allows standard search algorithms to find high-value trajectories that would otherwise be completely lost in massive search spaces.
  • Cross-Domain Generalization: Quite surprisingly, training an LLM to solve structured optimization tasks (like Role Assignment) transfers positive reasoning capabilities to completely unrelated domains, significantly boosting performance on competitive math benchmarks like AMC and AIME.

Key Results

  • Search Efficiency Gains: Incorporating feasibility pruning and duplicate merging reduced the effective branching factor ($b_{\text{eff}}$) of $\nu$MCTS from roughly 25 down to 15.04, drastically outperforming standard unconstrained LLM sampling.
  • Substantial Performance Boosts: On out-of-distribution (OOD) MaxSAT tasks at the highest complexity level ($\alpha_4$), the trained model achieved a 62.9% Pass@1 accuracy compared to the base model's 45.1%.
  • Curriculum Training Wins: Comparing different training trajectories on the Polyomino task revealed that a mixed curriculum ($\alpha_1 \to \alpha_4$) outperformed both "easy-only" and "hard-only" training, proving essential for mastering complex spatial operations.
Growth of search spaces and unique solutions as complexity increases

Limitations and Future Work

While highly effective, the current implementation primarily relies on synthetic optimization tasks. The authors note that a compelling next step is to scale optimization reasoning using LLM priors to automate the generation of substantially more complex, diverse, and real-world tasks. Additionally, the framework still depends on having access to programmatic checkers or evaluators, meaning its application to completely open-ended, non-formalizable reasoning domains remains an open challenge.

Summary updated

BibTeX
@inproceedings{astorga2026step,
  author = {Nicolás Astorga and Nabeel Seedat and Mihaela van der Schaar},
  title = {{Step-by-Step Optimization-like Reasoning in LLMs over Expanding Search Spaces}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Juf7k3U9xW},
}
Figure