Research map / Large language models / Agents, code and math
Classical Planning with LLM-Generated Heuristics: Challenging the State of the Art with Python Code
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Prompts LLMs to write domain-dependent heuristics as Python code, selects the best of 25 by training-set GBFS performance, and uses it in Pyperplan to solve IPC 2023 Learning Track out-of-distribution tasks.
Problem
LLMs fail to plan reliably end-to-end, especially on larger out-of-distribution tasks, and existing domain-independent or learned heuristics are either weak or costly to train per domain.
Approach
Sample n LLM-written Python heuristic functions per planning domain from a single prompt containing PDDL domain/examples and Pyperplan code, select the best on training tasks via greedy best-first search, and reuse it for all test tasks with no feedback loop to the LLM.
Key results
- DeepSeek R1-generated heuristics in Pyperplan solve 373 of 720 test tasks, vs 243 for FF in Pyperplan and 295 for FF in Fast Downward.
- End-to-end LLM planning solves 174 tasks with DeepSeek R1 and 19 with Gemini 2.0 Flash, while heuristic generation with Gemini 2.0 Flash solves 296.
- DeepSeek R1 heuristics (373 tasks) are competitive with WL-GPR (371 tasks) implemented in Fast Downward.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| generate and select a domain-dependent heuristic instead of generating plans end-to-end | DeepSeek R1 · IPC 2023 test (720 tasks) | solved tasks: 174 -> 373 | Helped |
| generate and select a domain-dependent heuristic instead of generating plans end-to-end | Gemini 2.0 Flash · IPC 2023 test (720 tasks) | solved tasks: 19 -> 296 | Helped |
| use DeepSeek R1-generated heuristic instead of WLF-GPR | Classical planning GBFS · IPC 2023 test (720 tasks) | solved tasks: 371 -> 373 | Helped |
| use DeepSeek R1-generated heuristic instead of Fast Downward h_add | Classical planning GBFS · IPC 2023 test (720 tasks) | solved tasks: 324 -> 373 | Helped |
| remove detailed prompt instructions (ablation) | Gemini 2.0 Flash Thinking heuristic generation · IPC 2023 test (720 tasks) | best coverage: 423 -> 359 | Hurt |
| include the PDDL domain description (ablation) | Gemini 2.0 Flash Thinking heuristic generation · IPC 2023 test (720 tasks) | best coverage: 368 -> 423 | Helped |
| include example PDDL tasks (ablation) | Gemini 2.0 Flash Thinking heuristic generation · IPC 2023 test (720 tasks) | best coverage: 401 -> 423 | Helped |
| include domain-dependent heuristic examples (ablation) | Gemini 2.0 Flash Thinking heuristic generation · IPC 2023 test (720 tasks) | best coverage: 404 -> 423 | Helped |
| include the Pyperplan code (ablation) | Gemini 2.0 Flash Thinking heuristic generation · IPC 2023 test (720 tasks) | average coverage: 270.0 -> 267.0 | Mixed |
| use standard Spanner semantics where spanners break after use | LLM-generated heuristic · Modified Spanner | plan length | Mixed |
| obfuscate Blocksworld symbols | DeepSeek R1 heuristic · Blocksworld | solved tasks: 66 -> 40 | Hurt |
| use an o3-generated heuristic on an unseen domain | Pyperplan GBFS · Rod-Rings | solved tasks: 58 vs 59 | No clear effect |
Surprising findings
- Pyperplan with LLM-generated heuristics outperforms all traditional Fast Downward heuristics and is competitive with the learned WL-GPR despite being a much slower Python planner.
- Non-reasoning models such as DeepSeek V3 and Gemini 2.0 Flash generate heuristics that greatly outperform their own end-to-end planning.
Limitations
- Depends on a formal PDDL description, so it cannot directly use natural language tasks.
- The selection of the best heuristic from the pool is heuristic and does not guarantee generalization to the out-of-distribution test set.
- Proof-of-concept in Pyperplan, which is much slower than Fast Downward, so direct performance comparison is limited.
Experimental setup
Datasets: IPC 2023 Learning Track domains (8 domains, training and test tasks) Autoscale benchmark set (exploratory) Rod-Rings (new domain) Obfuscated Blocksworld
Benchmarks: IPC 2023 Learning Track (8 domains, 90 test tasks each) Rod-Rings Obfuscated Blocksworld
Metrics: coverage (solved tasks) expansions plan length cost (USD) expansions per second
Baselines: blind heuristic h0 FF heuristic (Pyperplan) goal-count heuristic landmark count heuristic FF heuristic (Fast Downward) context-enhanced additive heuristic causal graph heuristic additive heuristic WL-GPR end-to-end LLM planning
Builds on: Pyperplan Fast Downward FF heuristic WL-GPR (Weisfeiler-Leman + Gaussian process regression) FunSearch
Closest papers by meaning
- Planning Anything with Rigor: General-Purpose Zero-Shot Planning with LLM-based Formalized Programming (ICLR 2025 · similarity 0.91)
- SayCanPay: Heuristic Planning with Large Language Models Using Learnable Domain Knowledge (AAAI 2024 · similarity 0.91)
- Thought of Search: Planning with Language Models Through The Lens of Efficiency (NeurIPS 2024 · similarity 0.90)
- SPIRAL: Symbolic LLM Planning via Grounded and Reflective Search (AAAI 2026 · similarity 0.89)
- Can LLMs Fix Issues with Reasoning Models? Towards More Likely Models for AI Planning (AAAI 2024 · similarity 0.89)
- PathWise: Planning through World Model for Automated Heuristic Design via Self-Evolving LLMs (ICML 2026 · similarity 0.88)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
