PEARL: Solver-in-the-Loop Interactive Optimization Modeling from Natural Language

Hongliang Lu, Zhong Li, Yuxuan Chen, Yuan Lan, Fan Zhang, Zaiwen Wen

TL;DR

PEARL introduces an agentic reinforcement learning framework that transforms optimization modeling from a fragile, one-shot text generation task into an interactive, multi-turn "solve-debug-revise" process. By training a compact 4B-parameter model to dynamically execute code and learn from real-time solver feedback, PEARL allows smaller models to outperform giant models like the 685B DeepSeek-V3.2 on complex optimization benchmarks.

What Problem Does This Paper Address?

Optimization modeling involves translating real-world business or engineering problems described in natural language into formal mathematical formulations and executable solver code (e.g., using Python libraries like Pyomo).

While Large Language Models (LLMs) are capable code generators, standard approaches treat optimization modeling as a one-shot task. The model generates the code once, and that's it. In reality, human experts rarely write perfect optimization code on the first try; they write a partial model, run it, inspect solver diagnostics or infeasibility reports, and iteratively fix errors. Because one-shot LLMs lack this feedback loop, they frequently suffer from hallucinated constraints, indexing mismatches, or silent runtime failures. Even existing tool-augmented LLM workflows rely on rigid, hand-designed heuristics to fix code rather than letting the model dynamically learn how to debug.

Methods

The authors introduce PEARL (Interactive Optimization Modeling with Tool-Integrated Agentic Reinforcement Learning), which formalizes optimization modeling as a Partially Observable Markov Decision Process (POMDP).

Instead of treating the solver as a post-hoc evaluator, PEARL integrates it directly into the model's environment loop:

  • Action Space: At each turn, the agent can choose a natural-language action (drafting or revising an implementation plan) or a tool action (Execute to run Python/Pyomo code in a sandbox, or Validate to check constraint satisfaction).
  • Solver-in-the-Loop Feedback: Runtime logs, syntax exceptions, solver statuses (optimal, infeasible, unbounded), and objective values are fed directly back into the model's observation stream for the next turn.
  • Verifiable Reward Decomposition: To train the model via reinforcement learning, the authors design a trajectory-level reward $R(\tau) = r_{fmt}(\tau) + r_{corr}(\tau)$. It combines a dense format reward (incentivizing correct tool syntax) with a sparse correctness reward (awarded only when the solver-reported objective value matches the ground-truth reference within a tight numerical tolerance).
  • Policy Optimization: The policy is trained using Group Relative Policy Optimization (GRPO) with decoupled clipping to stabilize learning under high-variance, multi-turn tool trajectories.
Figure 2: Workflow of PEARL. Colors indicate elements of the POMDP ⟨S, O, A, P, R, T⟩: ob- servations O (blue), agent policy πθ (red), actions A (purple), environment transitions P (orange), reward R (green, dashed), and termination T (gray). The latent state S is not shown.

Datasets

PEARL was trained on a mixed corpus of roughly 14,000 optimization modeling instances, combining 10,000 cleaned open-source problems (from OR-Instruct/ORLM, OptMATH, and OptiBench) with 3,800 newly constructed and manually curated instances.

Evaluation was conducted across a diverse suite of established benchmarks: NL4Opt, MAMO (EasyLP and ComplexLP), NLP4LP, OptMATH, IndustryOR, ComplexOR, and Resocratic.

Key Insights and Ideas

  • Interaction Trumps Scale: A 4B parameter model trained specifically to interact with a solver can beat a massive 685B general-purpose model. Teaching a model how to use tools and debug its own errors is far more parameter-efficient than simply scaling up model size.
  • Scaffolding Alone is Insufficient: Simply wrapping a base model in a fixed Python loop (a "scaffold control") does not yield high accuracy. Base models use tools sparsely and struggle to interpret complex solver diagnostics. The model itself must undergo RL training to learn when to test partial models and how to respond to failures.
  • A Shift in Failure Modes: Before agentic training, the base model's failures are dominated by low-level code and runtime crashes (66.2%). PEARL successfully eliminates these basic implementation bugs, shifting the remaining failures to deeper, more substantive mathematical or semantic mismatches (objective value mismatches).

Key Results

  • Massive Accuracy Gains: PEARL-Qwen3-4B achieved a macro-averaged Pass@1 accuracy of 69.71%, dramatically outperforming its base model Qwen3-4B-Instruct (22.20%) and the reasoning-focused Qwen3-4B-Think (30.86%).
  • Outperforming the Giants: As shown in Figure 1, the 4B PEARL model outperformed the much larger DeepSeek-V3.2-685B (66.51%) in macro-averaged accuracy across the benchmark suite.
  • Thriving on Complexity: The gains were most pronounced on difficult, interactive datasets. On MAMO ComplexLP, PEARL achieved a massive absolute accuracy jump to 76.12%, compared to the base model's 13.51%.
Figure 1: Macro-averaged Pass@1 versus reported model scale across representative optimization- modeling methods. PEARL (Ours) uses a 4B backbone yet matches or exceeds much larger general- purpose models such as DeepSeek-V3.2-685B, highlighting that solver-mediated interaction and optimization-specific training can deliver strong accuracy in a compact model regime that is more practical for repeated agentic invocation [Kwon et al., 2023, Abdin et al., 2024, Belcak et al., 2025].

Limitations and Future Work

  • Bounded Horizon: PEARL operates under a maximum budget of 8 turns. Extremely complex industrial problems requiring long debugging chains or extensive data inspection might exhaust this budget.
  • Partial Oracles: Objective-value matching is a strong proxy for correctness, but it is a partial oracle. It can occasionally miss latent structural defects or accept alternative formulations that happen to output the correct target value for a specific instance.
  • Inference Cost: Multi-turn interaction inherently increases serving memory and latency compared to one-shot generation. The authors note that future systems should explicitly learn when interaction is worth the cost versus when a direct, one-shot solution is sufficient.

Summary updated

BibTeX
@inproceedings{lu2026pearl,
  author = {Hongliang Lu and Zhong Li and Yuxuan Chen and Yuan Lan and Fan Zhang and Zaiwen Wen},
  title = {{PEARL: Solver-in-the-Loop Interactive Optimization Modeling from Natural Language}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=W3LmdJrHns},
}
Figure