ReCode: Unify Plan and Action for Universal Granularity Control

📅 2025-10-27
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing LLM-based agents suffer from limited dynamism and generalization due to rigid separation of high-level planning and low-level action execution, hindering multi-granularity decision-making. This paper proposes ReCode, a paradigm centered on recursive code generation that unifies planning and action through decomposable, abstract function structures—enabling dynamic granular control. By leveraging function placeholders and top-down recursive expansion, ReCode simultaneously supports cross-granularity reasoning and execution while autonomously generating hierarchical training data. Experiments demonstrate that ReCode significantly outperforms state-of-the-art baselines in reasoning performance and markedly improves training data efficiency. It provides the first systematic validation of a unified planning–action framework for general-purpose granular control, establishing its effectiveness across diverse decision scales.

Technology Category

Application Category

📝 Abstract
Real-world tasks require decisions at varying granularities, and humans excel at this by leveraging a unified cognitive representation where planning is fundamentally understood as a high-level form of action. However, current Large Language Model (LLM)-based agents lack this crucial capability to operate fluidly across decision granularities. This limitation stems from existing paradigms that enforce a rigid separation between high-level planning and low-level action, which impairs dynamic adaptability and limits generalization. We propose ReCode (Recursive Code Generation), a novel paradigm that addresses this limitation by unifying planning and action within a single code representation. In this representation, ReCode treats high-level plans as abstract placeholder functions, which the agent then recursively decomposes into finer-grained sub-functions until reaching primitive actions. This recursive approach dissolves the rigid boundary between plan and action, enabling the agent to dynamically control its decision granularity. Furthermore, the recursive structure inherently generates rich, multi-granularity training data, enabling models to learn hierarchical decision-making processes. Extensive experiments show ReCode significantly surpasses advanced baselines in inference performance and demonstrates exceptional data efficiency in training, validating our core insight that unifying planning and action through recursive code generation is a powerful and effective approach to achieving universal granularity control. The code is available at https://github.com/FoundationAgents/ReCode.
Problem

Research questions and friction points this paper is trying to address.

Unifying planning and action across decision granularities
Overcoming rigid separation between high-level and low-level tasks
Enabling dynamic control of decision-making abstraction levels
Innovation

Methods, ideas, or system contributions that make the work stand out.

Unifies planning and action in code representation
Recursively decomposes plans into finer-grained functions
Generates multi-granularity data for hierarchical learning
🔎 Similar Papers
No similar papers found.