TL;DR
This paper introduces a novel pipeline that leverages Large Language Models (LLMs) to automatically generate PDDL (Planning Domain Definition Language) models from existing JavaScript code for a Minecraft agent. This approach aims to bridge the gap between low-level operational code and high-level task planning, reducing the significant human effort typically required for manual PDDL model creation.
What Problem Does This Paper Address?
Automated planning systems rely on formal domain models (like PDDL) to generate plans. Creating these models is a labor-intensive process, usually requiring domain experts. While LLMs have shown promise in generating task models from natural language, there's a gap in using operational code (like JavaScript) as a source for these models. This paper addresses the challenge of automatically translating existing, functional code into formal PDDL action definitions, thereby democratizing the creation of planning models.
Methods
The authors propose a two-stage pipeline:
- Summarization Stage: An LLM (Llama3) takes a JavaScript function implementing an action and generates two natural-language summaries: a concise overview and a more detailed summary of the action's goals, preconditions, and effects.
- Extraction Stage: Another LLM (Codestral, chosen for its code understanding capabilities) uses these summaries, along with provided domain background information, a pool of allowed predicates, and object types, to:
- Select the necessary types and predicates for the action.
- Generate the final PDDL action definition.
The pipeline is designed to be iterative, processing each action function to build a complete PDDL domain.
Datasets
The primary "dataset" used for evaluation consists of JavaScript functions from the Voyager project, which implements a Minecraft agent. These functions represent operational models for actions like crafting, collecting, and placing items. The ground-truth PDDL models were manually authored based on these JavaScript functions.
Key Insights and Ideas
- Operational Code as a Source: The core idea is that existing, working code already encodes the logic of actions, making it a rich, albeit implicit, source for planning models. This bypasses the need for explicit natural language descriptions of actions.
- LLM Synergy: The pipeline effectively combines the strengths of different LLMs: Llama3 for natural language summarization and Codestral for code-to-PDDL translation.
- Temperature Tuning: LLM temperature settings significantly impact the quality of generated PDDL actions. Lower temperatures tend to produce more correct but less creative actions, while higher temperatures can lead to more errors but sometimes improve slightly flawed outputs.
- Predicate Specificity Matters: The level of abstraction in predicates (e.g., generic
object_in_inventoryvs. item-specificHasWoodBlock) influences the LLM's ability to generate correct PDDL. Item-specific predicates generally led to better results for crafting actions, while generic ones were better for simpler actions like collecting and placing.
Key Results
- The pipeline successfully converted JavaScript functions into valid PDDL actions for crafting items in Minecraft (craft table, planks, sticks, wooden sword).
- Lower LLM temperatures (specifically, Codestral at 0.1) generally resulted in more correct PDDL actions, especially for crafting tables, sticks, and wooden swords.
- The accuracy of generated actions varied by item, with craft table actions being the most consistently correct, followed by wooden sword, sticks, and planks.
- The study identified common error types, including missing parameters, incorrect predicate usage, and issues with object uniqueness constraints.
- Experiment 2 showed that using item-specific predicates improved the accuracy of crafting actions, while a combination of abstract and specific predicates yielded the highest overall accuracy.
Limitations and Future Work
- Error Proneness: Despite improvements, the pipeline still generates incorrect actions, with common errors related to parameter handling, predicate usage, and object uniqueness.
- Domain Specificity: The current work is demonstrated on Minecraft, and generalizability to other domains requires further investigation.
- LLM Sensitivity: Codestral's performance was sensitive to prompt wording and the inclusion of specific domain background information.
- Future Work: The authors suggest several areas for improvement:
- Error Detection Loop: Implementing a mechanism to detect and correct errors automatically.
- Enhanced Summarization: Providing more context to the summarization LLM (e.g., sub-function code, call hierarchies).
- Predicate/Type Suggestion: Prompting LLMs to suggest new predicates and types.
- Structured Generation: Using libraries like Outlines to reduce syntax errors.
- Complex Function Decomposition: Identifying when complex functions need to be broken down into multiple PDDL actions.
- Testing Other LLMs: Evaluating the pipeline's performance with different LLMs.
Summary updated