arXiv:2508.13876cs.AIcs.CL2025-08被引 5

用伪代码调试和反思机制提升大模型生成通用规划的准确性

Improved Generalized Planning with LLMs through Strategy Refinement and Reflection

  • 生成策略时使用伪代码并自动调试,提前发现错误
  • 通过反思分析失败原因,提升规划修复效率,平均覆盖率达82%
  • 结合多版本生成与筛选,适合需要高可靠性的自动化规划场景

大语言模型近期被用于在PDDL规划领域生成泛化计划的Python程序,即能跨任务通用的规划。先前方法分三步:先生成领域自然语言摘要和策略,再实现为Python程序,并在示例任务上调试。但仅生成一个策略直接转代码,若策略错误,结果必然失败。本文提出新方法:将策略以伪代码形式生成,并支持自动调试,可在生成程序前发现并修正错误;扩展了Python调试阶段,引入反思步骤,让模型分析计划失败原因;借鉴代码生成经验,生成多个程序变体并择优。在17个基准领域上,使用两个推理型和两个非推理型大模型实验,结果表明这些改进显著提升了泛化计划质量,最优配置在所有领域平均覆盖率达82%。

原文摘要 · Abstract (English)

LLMs have recently been used to generate Python programs representing generalized plans in PDDL planning, i.e., plans that generalize across the tasks of a given PDDL domain. Previous work proposed a framework consisting of three steps: the LLM first generates a summary and then a strategy for the domain, both in natural language, and then implements that strategy as a Python program, that gets debugged on example planning tasks. In that work, only one strategy is generated and passed directly to the program generation. If the strategy is incorrect, its implementation will therefore result in an incorrect generalized plan. Here, we introduce an approach that generates the strategy in the form of pseudocode and enables automatic debugging of the pseudocode, hence allowing us to identify and fix errors prior to the generation of the generalized plan itself. Additionally, we extend the Python debugging phase with a reflection step prompting the LLM to pinpoint the reason for the observed plan failure. Finally, we take inspiration from LLM code generation to produce several program variants and pick the best one. Running experiments on 17 benchmark domains with two reasoning and two non-reasoning LLMs, we show that these extensions substantially improve the quality of the generalized plans. Our best performing configuration achieves an average coverage of 82% across the domains.

规划生成大模型伪代码反思机制

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