用语义锚点迭代修正模型,提升LLM生成优化代码的准确性
SAC-Opt: Semantic Anchors for Iterative Correction in Optimization Modeling
- 基于问题语义锚点,逐步对比并修正生成代码中的逻辑偏差
- 在7个数据集上平均准确率提升7.7%,复杂问题最高达21.9%提升
- 无需额外训练,适合需要高可靠性优化建模的工程与科研场景
大语言模型(LLMs)使从自然语言描述生成可执行求解器代码成为可能。然而,现有方法多依赖单次前向生成和基于求解器错误信息的有限后处理,难以发现隐性语义错误,导致生成的代码虽语法正确但逻辑错误。为此,我们提出SAC-Opt,一种以问题语义为导向的逆向引导修正框架。每一步中,SAC-Opt将原始语义锚点与由生成代码重构的锚点对齐,并仅修正不匹配部分,推动模型向语义一致的方向收敛。该锚点驱动的修正机制实现了约束与目标逻辑的细粒度优化,提升了模型保真度与鲁棒性,且无需额外训练或监督。在七个公开数据集上的实验证明,SAC-Opt将平均建模准确率提升7.7%,在ComplexLP数据集上最高提升达21.9%。结果表明,语义锚定修正在基于LLM的优化工作流中至关重要,能有效保障问题意图到可执行代码的忠实转化。
原文摘要 · Abstract (English)
Large language models (LLMs) have opened new paradigms in optimization modeling by enabling the generation of executable solver code from natural language descriptions. Despite this promise, existing approaches typically remain solver-driven: they rely on single-pass forward generation and apply limited post-hoc fixes based on solver error messages, leaving undetected semantic errors that silently produce syntactically correct but logically flawed models. To address this challenge, we propose SAC-Opt, a backward-guided correction framework that grounds optimization modeling in problem semantics rather than solver feedback. At each step, SAC-Opt aligns the original semantic anchors with those reconstructed from the generated code and selectively corrects only the mismatched components, driving convergence toward a semantically faithful model. This anchor-driven correction enables fine-grained refinement of constraint and objective logic, enhancing both fidelity and robustness without requiring additional training or supervision. Empirical results on seven public datasets demonstrate that SAC-Opt improves average modeling accuracy by 7.7%, with gains of up to 21.9% on the ComplexLP dataset. These findings highlight the importance of semantic-anchored correction in LLM-based optimization workflows to ensure faithful translation from problem intent to solver-executable code.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。