Skip to content
Open access

Code-driven planning in grid worlds with large language models

Oct 2026 · Royal Society Open Science · Vol 13 · 3 citations · 60 references
Medicine

TL;DR

An iterative programmatic planning framework that solves grid-based tasks by using large language models to synthesize interpretable, executable programs that act as agent policies mapping environment states to action sequences, underscoring the advantages of planning as program synthesis over per-instance inference.

Abstract

Abstract We propose an iterative programmatic planning (IPP) framework that solves grid-based tasks by using large language models (LLMs) to synthesize interpretable, executable programs that act as agent policies mapping environment states to action sequences, rather than relying on traditional search or reinforcement learning. Alongside prompting strategies such as direct code generation, pseudocode conditioned refinement and curriculum-based prompting, IPP centres on an iterative refinement mechanism that updates code from coarse, task-level feedback. We evaluate our approach using six leading LLMs and two challenging grid-based benchmarks (grid-based reasoning for assessing spatial planning (GRASP) and MiniGrid). Our IPP framework demonstrates improvements over direct code generation for five of the six models, with net energy gains ranging from a few per cent to roughly threefold and, for Gemini-2.5-Pro, a sign flip from a negative baseline to a strongly positive score, establishes a new state-of-the-art result for GRASP and significantly outperforms direct elicitation from GPT-o3-mini (by 43% on the hardest MiniGrid task to 116% on GRASP). While code generation has a higher initial prompting cost compared to direct solution elicitation ($0.08 per task versus $0.002 per instance for GPT-o3-mini), the code can be reused for any number of instances, making the amortized cost significantly lower (by 400 times on GPT-o3-mini across the complete GRASP benchmark). Beyond performance gains, IPP produces reusable, human-readable policies that support transparent inspection and modification, underscoring the advantages of planning as program synthesis over per-instance inference. The code and results can be found at http://github.com/Mystic-Slice/LLM-Planning-CodeGen.

Read PDF

Similar papers

Open access Oct 2026

TESS: LLM-guided Translation, Exploration, Simulation, and Search for Embodied Task Planning

In this work we focus on the problem of embodied task planning, which requires an agent to accomplish a complex task by separating it into atomic actions. Recent studies have developed LLM-based methods to address this problem. However, the executability and correctness of the generated plans remain suboptimal in compl...

Pei-Ran Xu, Yi-Xiang Yang, Jing-Han Li et al. · 0 citations
#artificial intelligence Open access Sep 2026

GRASP: Generating, Revising, and Assessing for Strategic Planning with Agentic AI

Empirical evaluations show that GRASP consistently establishes a new state-of-the-art frontier across diverse datasets, yielding substantial accuracy gains over direct LLM planners on Natural Plan Calendar Scheduling, ZebraLogic, and SciBench Math.

Arunabh Srivastava, M. Khojastepour, S. Chakradhar et al. · 0 citations

CodeActionBench: Evaluating Agentic Code-as-Policy for Embodied Manipulation

CodeActionBench is introduced, a benchmark of 25 manipulation tasks that evaluates this capability through agentic Code-as-Policy and provides a controlled testbed for measuring how general-purpose models translate their capabilities into manipulation behavior and for examining typical failure scenarios in that process...

Yiheng Lyu, Xueying Jiang, Wen-Hao Li et al. · 3 citations
Open access 2026

HeroBench: An Executable Benchmark for Long-Horizon Planning and Feasibility Reasoning in Large Language Models

Large language models (LLMs) perform well on many stepwise reasoning tasks, yet their ability to construct reliable plans over long horizons remains difficult to measure. Existing evaluations often use compact symbolic domains or allow execution-time feedback, making it harder to isolate failures in end-to-end plan con...

P. Anokhin, Roman Khalikov, Stefan Rebrikov et al. · 0 citations

SAGE: Symbolic Action-Gating and Editing for LLM Task Planners

SAGE (Symbolic Action-Gating and Editing), a single-LLM planner built from two lightweight mechanisms: a domain-agnostic symbolic gate that blocks precondition-violating actions with typed reasons as a runtime safety monitor, and a local edit that regenerates only the failed sub-goal's suffix, keeping completed and unt...

T. Bui, Jongsul Moon, Youngouk Kim et al. · 0 citations
#artificial intelligence Preprint Oct 2026

Hierarchical World Models with Implicit Dynamics

This work introduces ID-WM (Implicit Dynamics World Models), a hierarchical world model that decouples state-space reachability from local control and yields a 135% performance gain over single-level world model MPC, particularly in complex, unseen configurations for long-horizon tasks.

Gao-Yue Zhou, Yvonne Wu, Zichen Jeff Cui et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.