Generalized Planning in PDDL Domains with Pretrained Large Language Models

Tom Silver, Soham Dan, Kavitha Srinivas, Joshua B. Tenenbaum, Leslie Pack Kaelbling, Michael Katz

TL;DR

Researchers have demonstrated that GPT-4 can act as a powerful "generalized planner" by synthesizing Python programs to solve entire classes of planning problems. By combining natural language summarization with an automated debugging loop, this approach produces human-readable code that is significantly faster than state-of-the-art classical planners and can solve complex tasks that traditional generalized planning baselines fail to handle.

What Problem Does This Paper Address?

In AI planning, we typically distinguish between planning (finding a sequence of actions for one specific task) and generalized planning (finding a single program or policy that can solve any task within a domain). For example, instead of just finding a path for one robot in one specific warehouse, generalized planning seeks the "algorithm" for warehouse navigation itself.

Traditional generalized planning methods often rely on restrictive representations like "lifted decision lists" or finite state machines. These methods struggle to discover high-level concepts (like "find the heaviest item in a set") and often require complex search-based synthesis. The authors investigate whether Large Language Models (LLMs), specifically GPT-4, can bridge this gap by writing general-purpose Python code directly from PDDL (Planning Domain Definition Language) descriptions.

Methods

The authors developed a multi-stage pipeline to guide GPT-4 through the synthesis process:

  1. Chain-of-Thought (CoT) Summarization: Instead of asking for code immediately, the LLM is first prompted to summarize the PDDL domain and example tasks in natural language, then propose a high-level solution strategy "without using search."
  2. Code Implementation: GPT-4 implements the proposed strategy as a Python function get_plan(objects, init, goal).
  3. Automated Interactive Debugging: The generated code is automatically tested against small training tasks. If it fails—due to Python exceptions, timeouts, syntax errors, or semantic plan errors (validated by the VAL tool)—the error message and traceback are fed back to GPT-4 for a fix. This loop repeats up to four times.
Figure 1: Overview of pipeline for generalized planning with pretrained LLMs. See text for details.

Datasets

The approach was evaluated on seven PDDL domains:

  • Six standard/recent benchmarks: Delivery (newspaper delivery), Forest (hiking navigation), Gripper (robot moving balls), Miconic (elevator control), Ferry (transporting cars), and Spanner (collecting tools in a one-way corridor).
  • One novel domain: Heavy, introduced by the authors. In this domain, items must be stacked by weight, requiring the planner to discover the concept of a "heaviest overall" item from pairwise relations—a task that traditional generalized planning baselines failed to solve.

Key Insights and Ideas

  • Code as a Powerful Representation: Python code is far more expressive than traditional logic-based policies. It allows the LLM to easily implement sorting, loops, and conditional logic that are difficult for classical generalized planners to synthesize.
  • The Criticality of Debugging: Automated feedback is the "secret sauce." Performance improved dramatically even after a single debugging step, as GPT-4 is adept at fixing local coding errors when presented with a traceback.
  • Semantic Names are Essential: Unlike classical planners that treat names as arbitrary symbols, GPT-4 relies heavily on human-readable names (e.g., pick-up, paper). When names were replaced with random identifiers, performance crashed, confirming that the LLM leverages its pre-trained common sense about these terms.
  • Extreme Data Efficiency: GPT-4 often required only two small training examples to synthesize a program that generalized perfectly to massive evaluation tasks with hundreds of objects.

Key Results

  • Strong Performance: GPT-4 achieved high success rates in 5 out of 7 domains, notably solving the Heavy domain where all other generalized planning baselines failed.
  • Superior Efficiency: The synthesized Python programs were orders of magnitude faster than the state-of-the-art classical planner, Fast Downward. As problem sizes grew, the Python code scaled linearly, while the classical planner's runtime exploded due to the overhead of "grounding" PDDL operators.
Runtime comparison in the Delivery domain
  • GPT-4 vs. GPT-3.5: The jump in capability is stark; GPT-3.5 failed almost entirely across all domains, highlighting that generalized planning requires the advanced reasoning and coding skills unique to the latest generation of LLMs.

Limitations and Future Work

Despite its success, the approach has clear boundaries:

  • Logical Blind Spots: GPT-4 consistently failed in domains requiring specific topological insights, such as recognizing the one-way nature of the Spanner domain or the implicit building structures in Miconic.
  • Search-Free Assumption: The method is designed for domains where a "simple strategy" exists. It is not a replacement for planners in domains like Sokoban, where search is fundamentally necessary.
  • Future Directions: The authors suggest that giving LLMs access to classical planners via APIs could create a powerful hybrid system, combining the LLM's high-level strategic reasoning with the planner's low-level search capabilities.
Figure 3: Fraction of evaluation tasks solved by GPT-4 ver- sus number of debugging steps allowed, averaged over all domains and seeds. The shaded region is standard error.

Summary updated

Abstract

Recent work has considered whether large language models (LLMs) can function as planners: given a task, generate a plan. We investigate whether LLMs can serve as generalized planners: given a domain and training tasks, generate a program that efficiently produces plans for other tasks in the domain. In particular, we consider PDDL domains and use GPT-4 to synthesize Python programs. We also consider (1) Chain-of-Thought (CoT) summarization, where the LLM is prompted to summarize the domain and propose a strategy in words before synthesizing the program; and (2) automated debugging, where the program is validated with respect to the training tasks, and in case of errors, the LLM is re-prompted with four types of feedback. We evaluate this approach in seven PDDL domains and compare it to four ablations and four baselines. Overall, we find that GPT-4 is a surprisingly powerful generalized planner. We also conclude that automated debugging is very important, that CoT summarization has non-uniform impact, that GPT-4 is far superior to GPT-3.5, and that just two training tasks are often sufficient for strong generalization.
BibTeX
@inproceedings{silver2024generalized,
  author = {Tom Silver and Soham Dan and Kavitha Srinivas and Joshua B. Tenenbaum and Leslie Pack Kaelbling and Michael Katz},
  title = {{Generalized Planning in PDDL Domains with Pretrained Large Language Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i18.30006},
}
Figure