ReCode: Unify Plan and Action for Universal Granularity Control
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.
69003a0022d452aac6dd438f
Zhaoyang Yu
claimed_verified
2025-11-20T08:50:36.355Z
640dc84b474aa6f89554d518
/avatars/9fcee1023ed5c6cddb3c342e19f18295.svg
Zhaoyang Yu
MoshiQAQ
user
MoshiQAQ
69003a0022d452aac6dd4390
Jiayi Zhang
claimed_verified
2025-10-28T15:36:18.381Z
65f40e83653c231cbaf7defe
/avatars/afa5ce72324112739e539865c9aee26b.svg
Jiayi Zhang
didiforhugface
user
didiforhugface
69003a0022d452aac6dd4391
Huixue Su
69003a0022d452aac6dd4392
Yufan Zhao
69003a0022d452aac6dd4393
Yifan Wu
69003a0022d452aac6dd4394
Mingyi Deng
69003a0022d452aac6dd4395
Jinyu Xiang
claimed_verified
2025-11-25T09:06:33.700Z
649ea7106282cb41e77760bc
https://cdn-avatars.huggingface.co/v1/production/uploads/649ea7106282cb41e77760bc/HlWjaqxr03ob93vdKg_LQ.jpeg
Isaac
XiangJinYu
user
XiangJinYu
69003a0022d452aac6dd4396
Yizhang Lin
69003a0022d452aac6dd4397
Lingxiao Tang
69003a0022d452aac6dd4398
Yingchao Li
claimed_verified
2025-10-28T15:36:16.025Z
6742e356f8883755e01c6053
https://cdn-avatars.huggingface.co/v1/production/uploads/6742e356f8883755e01c6053/11gforECOJfeY5_O9ERuO.png
Yingchao YL Li
yclee0716
user
yclee0716
69003a0022d452aac6dd4399
Yuyu Luo
69003a0022d452aac6dd439a
Bang Liu
claimed_verified
2025-10-29T12:50:13.393Z
654a97282d2fcd6bf2851173
https://cdn-avatars.huggingface.co/v1/production/uploads/654a97282d2fcd6bf2851173/9zXf940gr4WNt4e-oOt4k.png
Bang Liu
Bang-UdeM-Mila
user
Bang-UdeM-Mila
69003a0022d452aac6dd439b
Chenglin Wu
ReCode: Unify Plan and Action for Universal Granularity Control
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.
ReCode, a recursive code generation paradigm, unifies high-level planning and low-level action in a single representation, enhancing decision granularity and data efficiency in LLM-based agents.
Large Language Model ReCode Recursive Code Generation high-level planning low-level action decision granularity abstract placeholder functions primitive actions hierarchical decision-making processes inference performance data efficiency