Title: ReCode: Unify Plan and Action for Universal Granularity Control
Primary area: applications to robotics, autonomy, planning
Keywords: Language agent, decision making, planning

Abstract: Real-world tasks require decisions at varying granularities, ranging from planning daily schedules to choosing which shoes to wear. Humans effortlessly shift granularity by leveraging hierarchical organization and unified cognitive representations. Despite impressive isolated-task performance, Large Language Model (LLM)-based agents struggle to fluidly transition across granularities. Current paradigms separate high-level planning from low-level actions, creating rigid boundaries that impair dynamic adaptability and limit generalization due to predefined action spaces.
We propose ReCode (Recursive Code Generation), a novel approach that unifies planning and action within a single executable code framework, reflecting the insight that planning is fundamentally high-level action. ReCode conceptualizes goals as placeholder functions, recursively decomposing them into finer-grained sub-functions until reaching executable action APIs. This recursive approach naturally integrates strategic oversight and immediate execution, enabling agents to dynamically generate actions without reliance on predefined sets, thus achieving effectively infinite action spaces.
ReCode inherently generates comprehensive multi-granularity decision-making data. Models fine-tuned on this data learn complete reasoning processes, significantly enhancing adaptive granularity control and generalization capabilities. Extensive experiments across complex benchmark environments show ReCode surpasses advanced baselines by over 20.9\% in inference settings and demonstrates exceptional sample efficiency in training, using fewer tokens than traditional methods while achieving superior performance, highlighting the power of unified granularity control through recursive code generation.