Property-Guided LLM Program Synthesis for Planning
Abstract
LLMs have shown impressive success in program synthesis, discovering programs that surpass previously known solutions. However, these approaches rely on simple numeric scores to signal program quality, such as the value of the solution or the number of passed tests. Because such a score offers no guidance on why a program failed, the system must generate and evaluate many candidates per problem in the hope that some succeed, increasing both LLM inference and evaluation costs. We study a different approach: property-guided LLM program synthesis. Instead of scoring programs after evaluation, we check whether a candidate satisfies a formally defined property. When the property is violated, we stop the evaluation early and provide the LLM with a concrete counterexample showing exactly how the program failed. In our experiments, this feedback reduces both the number of program generations and the evaluation cost, and guides the LLM to stronger programs. We evaluate this approach on PDDL planning domains, asking the LLM to synthesize direct heuristic functions: every non-goal state reachable from the initial state by strictly improving transitions has a strictly improving successor. A heuristic with this property leads the hill-climbing algorithm directly to a goal state. A counterexample-guided repair loop generates one candidate program, checks the property over a training set, and returns the first case that violates the property. On the ten IPC 2023 Learning Track domains, our approach with Gemini 3.1 Pro generates seven times fewer programs than the best prior generation method, spends about 40 times less time evaluating candidates on training tasks, and solves more out-of-distribution test tasks using only hill climbing. Although the property is checked only on small training tasks, hill climbing with the synthesized heuristics gets stuck in only one of 2,700 test runs. The coverage advantage also holds with GPT-5.5 and the small open-weight Gemma 4 31B. On three newly created domains that were not publicly available when Gemini 3.1 Pro was trained, the synthesized heuristics expand about 3.5 times fewer states than the best prior generation method, and hill climbing never encounters a property violation on the test tasks. Our results show that property-guided LLM program synthesis can reduce the synthesis and evaluation cost of heuristic functions while improving their quality.