arXiv:2508.07468cs.AIcs.CL2025-08被引 8

用智能体自动把自然语言转为精确的约束模型,101个问题全对。

CP-Agent: Agentic Constraint Programming

  • 基于ReAct框架的智能体,边执行边根据求解反馈优化约束代码
  • 在修正后的CP-Bench上,101个问题全部正确求解
  • 少指导反而比详细步骤更有效,适合做约束编程自动化

将自然语言转化为形式化约束模型需要领域知识和建模经验。为探索智能体工作流的有效性,我们提出CP-Agent,一个基于ReAct框架、使用持久IPython内核的Python编码智能体。通过提供少于50行的项目提示来注入相关领域知识,该算法通过迭代执行代码、观察求解器反馈并基于执行结果改进约束模型来工作。我们在来自CP-Bench的101个约束规划问题上评估了CP-Agent。我们对基准进行了微调,以解决原始问题描述中的系统性模糊性和真值模型中的错误。在清理后的基准上,CP-Agent在全部101个问题上实现了完美准确率。实验表明,少量引导优于详细的程序支架;同时,显式的任务管理工具在专注建模任务中可能带来正负双重影响。

原文摘要 · Abstract (English)

The translation of natural language to formal constraint models requires expertise in the problem domain and modeling frameworks. To explore the effectiveness of agentic workflows, we propose CP-Agent, a Python coding agent that uses the ReAct framework with a persistent IPython kernel. We provide the relevant domain knowledge as a project prompt of under 50 lines. The algorithm works by iteratively executing code, observing the solver's feedback, and refining constraint models based on execution results. We evaluate CP-Agent on 101 constraint programming problems from CP-Bench. We made minor changes to the benchmark to address systematic ambiguities in the problem specifications and errors in the ground-truth models. On the clarified benchmark, CP-Agent achieves perfect accuracy on all 101 problems. Our experiments show that minimal guidance outperforms detailed procedural scaffolding. Our experiments also show that explicit task management tools can have both positive and negative effects on focused modeling tasks.

约束编程智能体自然语言转代码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。