TL;DR
This paper demonstrates that Large Language Models (LLMs) can act as highly effective automated heuristic engineers for Hierarchical Task Network (HTN) planning. By generating domain-specific Python heuristic functions, the proposed pipeline nearly matches the problem-solving coverage of state-of-the-art specialized planners while drastically reducing search effort (node expansions) on 83% of shared problems.
What Problem Does This Paper Address?
Hierarchical Task Network (HTN) planning is a powerful AI formalism used in robotics, game AI, and intelligent assistants. Unlike classical planning, which searches for a flat sequence of actions to reach a goal state, HTN planning breaks down high-level abstract tasks into smaller sub-tasks using a predefined library of methods.
While this hierarchical structure naturally embeds domain knowledge, it introduces unique search challenges. Traditional domain-independent heuristics for HTN planning (such as Task Decomposition Graphs or landmark counting) often struggle to provide tight bounds because they ignore complex ordering constraints or state interactions. This leads to massive search spaces and out-of-memory errors on large problems. Hand-crafting domain-specific heuristics requires deep expertise and significant manual effort. The authors address this gap by investigating whether LLMs can automatically synthesize high-quality, domain-specific search heuristics directly from planning domain definitions.
Methods
The authors adapt a "generate-evaluate-select" pipeline (originally designed for classical planning) to the more complex semantics of total-order HTN planning:
- Prompting with Context: The LLM is provided with the domain name, the full HDDL (Hierarchical Domain Definition Language) file, the smallest and largest training instances, a worked example of a correct heuristic, and a domain-specific "hint block" (developed with LLM assistance to highlight bottlenecks and representation caveats).
- Batch Generation: The pipeline invokes the LLM 20 times independently to generate candidate heuristic functions written in Python.
- Automated Selection: Candidates are filtered by running them on the smallest training instance with a 60-second timeout. Those that crash, fail to parse, or time out are discarded. Of the survivors, the heuristic that minimizes the number of expanded nodes is selected.
- Deployment: The chosen heuristic is integrated into the
PYTRICHplanner and evaluated across three search algorithms: Standard A, Greedy Best-First Search (GBFS), and Weighted A.
Datasets
The approach is evaluated on six standard total-order HTN benchmark domains from the International Planning Competition (IPC) 2020 HTN planning track:
- Barman-BDI
- Blocksworld-GTOHP
- Depots
- Robot
- Rover-GTOHP
- Towers
A total of 139 benchmark problems were used to test scalability and search efficiency. No new benchmarks were introduced.
Key Insights and Ideas
- Exploiting Semantic Richness: Unlike classical planning where heuristics look at flat state features, HTN heuristics must reason about task networks (pending abstract tasks and decomposition methods). LLMs successfully grasp these hierarchical semantics, allowing them to identify which compound tasks are costly or cheap.
- Value Proportional to Complexity: The performance gains of LLM heuristics over traditional baselines are most pronounced in domains with complex, pronounced hierarchical structures (like Barman-BDI and Rover-GTOHP). In highly regular domains like Towers (Tower of Hanoi), traditional graph-based bounds are already tight, leaving less room for LLM-driven semantic guidance.
- High Model Variance: Newer or larger models are not uniformly better. Claude Opus 4 was exceptionally strong, whereas several other advanced models (like GPT-4o and Claude Sonnet 4.5) failed to generate executable code across most domains due to API misunderstandings (e.g., assuming the world state was a set rather than a bitset integer).
Key Results
- Coverage: The LLM-generated virtual best solved 131 out of 139 problems, significantly outperforming the PYTRICH baselines (LMCOUNT solved 118, TDG solved 117) and nearly matching the state-of-the-art PANDA $\text{RC}^{\text{FF}}$ planner (134 solved).
- Search Efficiency: On the 125 problems solved by both the LLM approach and PANDA $\text{RC}^{\text{FF}}$, the LLM heuristics required fewer node expansions on 104 instances (83%).
- Standout Model: Claude Opus 4 achieved full coverage on 5 out of 6 domains, outperforming PANDA $\text{RC}^{\text{FF}}$ in median search effort (1,878 vs 2,178 nodes).
Limitations and Future Work
- Scope Restrictions: The evaluation is strictly limited to total-order HTN planning. It does not address partial-order planning, numerical fluents, or temporal domains.
- Combinatorial Ordering: Extending this to partial-order HTN planning is a major open challenge, as the heuristic would need to reason about a combinatorial ordering space rather than a fixed linear sequence.
- Prompt Dependency: The current pipeline relies on domain-specific hint blocks. Future work is needed to evaluate a completely domain-independent prompting setup to see how much the LLM can reason purely from raw planning structure.
- API Fragility: Many models suffered from high failure rates at the selection step due to subtle misunderstandings of the planner's bitwise state representation, indicating that domain-specific prompting at default sampling temperatures is not yet fully reliable across all major LLM providers.
Summary updated