ReLoop提升LLM优化代码可靠性,解决语义错误问题。
ReLoop: Structured Modeling and Behavioral Verification for Reliable LLM-Based Optimization
- 分四阶段结构化生成代码,从源头避免建模错误
- 通过扰动测试发现生成后仍存在的语义缺陷
- 适合需要高可靠性的工业级优化场景应用
大型语言模型(LLMs)可将自然语言转化为优化代码,但存在隐性失败风险:代码虽可执行且返回求解器可行解,却可能编码语义错误的公式,导致可行性与正确性之间差距高达90个百分点。我们提出ReLoop,通过两种互补机制解决该问题。结构化生成将代码生成分解为理解、形式化、合成、验证四个阶段,从源头预防建模错误;行为验证通过测试公式对求解器参数扰动的响应是否正确,检测生成后残留的错误——这是一种外部语义信号,无需真实标签且绕过LLM自我审查。前者在组合问题上效果显著(RetailOpt-190上使用Claude Opus 4.6提升8.5个百分点),后者在局部缺陷上表现更优(MAMO-ComplexLP提升4.4个百分点)。结合诊断式执行恢复,ReLoop在Claude Opus 4.6上实现100%可执行代码,并持续提升三种基准上聊天调优基础模型的准确率。我们还揭示了微调模型对思维链提示的脆弱性,其学习的输出格式难以适应链式推理提示。我们发布了RetailOpt-190,包含190个组合零售优化场景,聚焦于LLM最常出错的多约束交互区域。
原文摘要 · Abstract (English)
Large language models (LLMs) can translate natural language into optimization code, but silent failures pose a critical risk: code that executes and returns solver-feasible solutions may encode semantically incorrect formulations---a feasibility--correctness gap reaching 90 percentage points on compositional problems. We introduce ReLoop, which addresses this gap through two complementary mechanisms. Structured generation decomposes code production into a four-stage reasoning chain (understand, formalize, synthesize, verify), preventing formulation errors at their source. Behavioral verification detects errors that survive generation by testing whether the formulation responds correctly to solver-based parameter perturbation---an external semantic signal that bypasses LLM self-review and requires no ground truth. The two mechanisms are complementary by error structure: structured generation drives the largest gains on compositional problems (+8.5pp accuracy on RetailOpt-190 with Claude Opus 4.6), while behavioral verification dominates on localized defects +4.4pp on MAMO-ComplexLP, its largest contribution across benchmarks). Combined with diagnostic execution recovery, ReLoop reaches 100% executable code on Claude Opus 4.6 and consistently improves accuracy on chat-tuned foundation models across three benchmarks; we further identify a known limitation of narrowly-tuned SFT models, whose learned output formats are brittle to chain-of-thought prompts---an interaction we document and analyze. We release RetailOpt-190, 190 compositional retail optimization scenarios targeting the multi-constraint interactions where LLMs most frequently fail.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。