用大模型生成代码化启发式函数,让规划更准更快。
Classical Planning with LLM-Generated Heuristics: Challenging the State of the Art with Python Code
- 让大模型写Python代码生成领域特定启发式函数。
- 在未见过的任务上,解决率超过现有顶尖规划算法。
- 适合对高效规划、代码生成感兴趣的开发者和研究者。
近年来,大语言模型(LLMs)在多种人工智能任务中表现出色,但在可靠规划方面仍表现不佳,即使给出详细任务定义也难以生成正确计划。尽管已有链式思维提示、微调和显式推理等方法尝试提升其规划能力,仍常出现错误且泛化性差。本文提出一种新方法:针对特定规划领域,让大模型生成多个依赖领域的启发式函数(以Python代码形式),在一组训练任务上通过贪心最佳优先搜索评估并选择最强函数。结果表明,该方法生成的启发式函数能解决更多未见测试任务,超越当前最先进的领域无关启发式函数,甚至媲美最强的领域相关学习算法。值得注意的是,实验基于未经优化的Python规划器,而基线均基于高度优化的C++代码。在某些领域,生成的启发式函数展开状态数少于基线,说明其不仅计算高效,有时还比现有最优启发式更有效。总体而言,通过采样规划启发式函数程序,可显著提升大模型的规划能力。
原文摘要 · Abstract (English)
In recent years, large language models (LLMs) have shown remarkable capabilities in various artificial intelligence problems. However, they fail to plan reliably, even when prompted with a detailed definition of the planning task. Attempts to improve their planning capabilities, such as chain-of-thought prompting, fine-tuning, and explicit "reasoning" still yield incorrect plans and usually fail to generalize to larger tasks. In this paper, we show how to use LLMs to generate correct plans, even for out-of-distribution tasks of increasing size. For a given planning domain, we ask an LLM to generate several domain-dependent heuristic functions in the form of Python code, evaluate them on a set of training tasks within a greedy best-first search, and choose the strongest one. The resulting LLM-generated heuristics solve many more unseen test tasks than state-of-the-art domain-independent heuristics for classical planning. They are even competitive with the strongest learning algorithm for domain-dependent planning. These findings are especially remarkable given that our proof-of-concept implementation is based on an unoptimized Python planner and the baselines all build upon highly optimized C++ code. In some domains, the LLM-generated heuristics expand fewer states than the baselines, revealing that they are not only efficiently computable, but sometimes even more informative than the state-of-the-art heuristics. Overall, our results show that sampling a set of planning heuristic function programs can significantly improve the planning capabilities of LLMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。