Classical Planning with LLM-Generated Heuristics: Challenging the State of the Art with Python Code
Augusto B. Corrêa, André Grahl Pereira, Jendrik Seipp
Abstract
In recent years, large language models (LLMs) have shown remarkable performance in many problems. However, they fail to plan reliably. Specialized attempts to improve their planning capabilities still produce incorrect plans and fail to generalize to larger tasks. Furthermore, LLMs designed for explicit "reasoning" fail to compete with automated planners while increasing computational costs, which reduces one of the advantages of using LLMs. In this paper, we show how to use LLMs to always 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 with a greedy best-first search, and choose the best one. The resulting LLM-generated heuristic functions solve substantially more unseen out-of-distribution test tasks than end-to-end LLM planning, particularly for nonreasoning LLMs. Moreover, they also solve many more tasks than state-of-the-art domain-independent heuristics for classical planning, and are competitive with the strongest learning algorithm for domain-dependent planning. These results are impressive given that our implementation is based on a 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, showing that they are not only efficiently computable but also more informative than the state-of-theart heuristics. Overall, our results show that sampling a set of planning heuristic functions can significantly improve the planning capabilities of LLMs.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers2
- Satisficing and Optimal Generalised Planning via Goal RegressionDillon Z. Chen, Till Hofmann, Toryn Q. Klassen, Sheila A. McIlraithAAAI 2026 · 1 citation
- Beyond Single-Step Updates: Reinforcement Learning of Heuristics with Limited-Horizon SearchGal Hadar, Forest Agostinelli, Shahaf S. ShperbergAAAI 2026
Builds on9
- Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
- On the Planning Abilities of Large Language Models - A Critical InvestigationKarthik Valmeekam, Matthew Marquez, Sarath Sreedharan, Subbarao KambhampatiNeurIPS 2023 · 509 citations
- Leveraging Pre-trained Large Language Models to Construct and Utilize World Models for Model-based Task PlanningLin Guan, Karthik Valmeekam, Sarath Sreedharan, Subbarao KambhampatiNeurIPS 2023 · 347 citations
- Generalized Planning in PDDL Domains with Pretrained Large Language ModelsTom Silver, Soham Dan, Kavitha Srinivas, Joshua B. Tenenbaum et al.AAAI 2024 · 194 citations
- Chain of Thoughtlessness? An Analysis of CoT in PlanningKaya Stechly, Karthik Valmeekam, Subbarao KambhampatiNeurIPS 2024 · 156 citations
Related papers
- Thought of Search: Planning with Language Models Through The Lens of EfficiencyMichael Katz, Harsha Kokel, Kavitha Srinivas, Shirin SohrabiNeurIPS 2024 · 50 citations
- Can LLMs Fix Issues with Reasoning Models? Towards More Likely Models for AI PlanningTurgay Caglar, Sirine Belhaj, Tathagata Chakraborti, Michael Katz et al.AAAI 2024 · 11 citations
- LLMs Can Plan Only If We Tell ThemBilgehan Sel, Ruoxi Jia, Ming JinICLR 2025
- SayCanPay: Heuristic Planning with Large Language Models Using Learnable Domain KnowledgeRishi Hazra, Pedro Zuidberg Dos Martires, Luc De RaedtAAAI 2024 · 74 citations
- Is Programming by Example Solved by LLMs?Wen-Ding Li, Kevin EllisNeurIPS 2024 · 45 citations
