形式化,而非优化:LLM生成组合求解器中的启发式陷阱
Formalize, Don't Optimize: The Heuristic Trap in LLM-Generated Combinatorial Solvers
AI总结:
本文研究LLM生成组合求解器时形式化与优化的矛盾,通过CP-SynC-XL基准测试,发现Python+OR-Tools在正确性上最优,而MiniZinc+OR-Tools虽使用相同后端但覆盖度较低,启发式优化导致部分问题速度下降和正确性降低。
摘要:
大型语言模型(LLMs)在直接推理解决复杂组合问题时表现不佳,因此近期神经符号系统越来越多地利用它们来合成可执行求解器。核心设计问题在于LLM应如何表示求解器,以及是否应尝试优化搜索。我们引入了包含100个组合问题(4,577个实例)的CP-SynC-XL基准测试,并评估了三种求解器构建范式:原生算法搜索(Python)、通过Python求解器API进行约束建模(Python + OR-Tools)以及声明式约束建模(MiniZinc + OR-Tools)。我们发现存在一致的表示分歧:Python + OR-Tools在LLM中正确性最高,而MiniZinc + OR-Tools尽管使用相同的OR-Tools后端,但绝对覆盖度较低。原生Python最可能返回一个模式有效的解决方案,但会失败验证,而基于求解器的路径在更高的条件保真度上更优。在启发式轴上,提示搜索优化仅带来小的中位数加速(1.03-1.12倍)和强烈双峰效应:许多实例变慢,且在问题长尾上正确性急剧下降。一次配对代码级别审计追踪这些退化到一个反复出现的启发式陷阱。在效率导向的提示下,LLM可能会用局部近似(Python)替代完整搜索,注入未经验证的界限(Python + OR-Tools),或添加冗余的声明性机器,使模型超载或过度约束。这些发现支持一种保守的设计原则:LLM应主要用于为验证求解器正式化变量、约束和目标,并单独检查任何LLM编写的搜索优化后再使用。
英文摘要:
Large Language Models (LLMs) struggle to solve complex combinatorial problems through direct reasoning, so recent neuro-symbolic systems increasingly use them to synthesize executable solvers. A central design question is how the LLM should represent the solver, and whether it should also attempt to optimize search. We introduce CP-SynC-XL, a benchmark of 100 combinatorial problems (4,577 instances), and evaluate three solver-construction paradigms: native algorithmic search (Python), constraint modeling through a Python solver API (Python + OR-Tools), and declarative constraint modeling (MiniZinc + OR-Tools). We find a consistent representational divergence: Python + OR-Tools attains the highest correctness across LLMs, while MiniZinc + OR-Tools has lower absolute coverage despite using the same OR-Tools back-end. Native Python is the most likely to return a schema-valid solution that fails verification, whereas solver-backed paths preserve higher conditional fidelity. On the heuristic axis, prompting for search optimization yields only small median speed-ups (1.03-1.12x) and a strongly bimodal effect: many instances slow down, and correctness drops sharply on a long tail of problems. A paired code-level audit traces these regressions to a recurring heuristic trap. Under an efficiency-oriented prompt, the LLM may replace complete search with local approximations (Python), inject unverified bounds (Python + OR-Tools), or add redundant declarative machinery that overwhelms or over-constrains the model (MiniZinc + OR-Tools). These findings support a conservative design principle for LLM-generated combinatorial solvers: use the LLM primarily to formalize variables, constraints, and objectives for verified solvers, and separately check any LLM-authored search optimization before use.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。