Robotic Long-Horizon Manipulation with Progressive In-Context Code Generation and Episodic Feedback
Yuan Meng, Xiangtong Yao, Haihui Ye, Yirui Zhou, Shengqiang Zhang, Zhenguo Sun, Xukun Li, Zhenshan Bing, Alois Knoll IEEE fellow · 2025
Read Robotic Long-Horizon Manipulation with Progressive In-Context Code Generation and Episodic Feedback by Yuan Meng, Xiangtong Yao, Haihui Ye, Yirui Zhou, Shengqiang Zhang, Zhenguo Sun, Xukun Li, Zhenshan Bing, Alois Knoll IEEE fellow (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2503-21969.txt.
Introduction
Yuan Meng and colleagues let a language model write robot programs episode by episode, checking results only when each episode ends. Long-horizon manipulation chains perception, reasoning, and action over many steps. Dense step-by-step feedback is costly, and learned policies generalize poorly. Their framework, DAHLIA, treats the task as planning plus evaluation in code.
Progressively organized examples with chain-of-thought reasoning guide the model to synthesize executable plans from instructions. After each execution, a vision-language reporter grades the outcome and returns structured feedback. Replanning uses that feedback, sparing per-step inference. Across four testbeds, including real-world tasks, the system handled over thirty long-horizon jobs strongly. Generalization reached cluttered scenes and occluded objects it had not seen. The design is data-agnostic: no task-specific training data props it up.
Catalog record
| CREATOR | Yuan Meng, Xiangtong Yao, Haihui Ye, Yirui Zhou, Shengqiang Zhang, Zhenguo Sun, Xukun Li, Zhenshan Bing, Alois Knoll IEEE fellow |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 43 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2503-21969
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Robotic Long-Horizon Manipulation with Progressive In-Context Code Generation and Episodic Feedback Yuan Meng, Xiangtong Yao, Haihui Ye, Yirui Zhou, Shengqiang Zhang, Zhenguo Sun, Xukun Li, Zhenshan Bing, Alois Knoll IEEE fellow Abstract Robotic long-horizon manipulation requires robots to compose perception, reasoning, and action over extended task sequences, yet existing language-conditioned frameworks often rely on dense step-wise feedback, learned action policies, or unstructured prompting, which limits robustness and generalization. We propose DAHLIA, a data-agnostic code-generation framework that treats long-horizon manipulation as episodic task planning and evaluation. DAHLIA uses progressively organized in-context examples with chain-of-thought reasoning to guide an LLM in synthesizing executable code plans from language instructions. To improve robustness under partial observability, a VLM-based reporter evaluates task outcomes only after each execution episode and provides structured feedback for replanning, avoiding the overhead of per-step inference. Experiments on LoHoRavens, CALVIN, Franka Kitchen, and real-world manipulation tasks show that DAHLIA achieves strong performance on over 30 long-horizon tasks and improves generalization to unseen scenarios, including cluttered scenes and occluded objects. I INTRODUCTION Long-horizon robotic manipulation requires a robot to interpret high-level language instructions, reason over object relations, and execute temporally extended action sequences. Recent vision-language-action models (VLAs) have shown promising progress in language-conditioned manipulation, but they typically require large-scale robot data and extensive training, while their performance often degrades when tasks become longer, more compositional, or substantially different from the training distribution [ 1 , 2 , 3 ] . This limitation is particularly critical in practical manipulation scenarios, where robots must solve diverse tasks under partial observability, clutter, and changing object configurations. User Code Plan Build a red head pyramid? Red block is on the top. Succeed. P l a n n e r T u R e p Structured Context Feedback Partial Observability Failure Recovery Chain-of-Thought Incremental Few-shot adaptation L o n g - H o r i z o Fig. 1: Overview of our proposed framework. The dual-tunnel structure generates executable task plans and enables task-level closed-loop feedback. Large language models provide an alternative route by serving as high-level task planners. Existing hierarchical approaches decompose instructions into subgoals and execute them with pretrained low-level policies or manipulation skills [ 4 , 5 , 6 , 7 ] . Although such methods improve semantic task decomposition, they often depend on the reliability of the underlying action policy and require frequent feedback or step-wise reasoning. These requirements increase inference cost and make the system vulnerable to cumulative errors, especially in long-horizon tasks where a single incorrect intermediate decision may lead to task failure. Code-generation-based manipulation has recently emerged as a promising paradigm, where an LLM directly synthesizes executable programs that compose predefined robot APIs [ 8 ] . Compared with natural-language plans, executable code provides a more structured interface for long-horizon task execution and can reduce dependence on task-specific policy learning. However, existing code-generation methods still face two main challenges. First, many approaches operate in an open-loop manner or use only coarse feedback, making it difficult to recover from failures caused by occlusion, spatial misalignment, or incomplete execution. Second, their few-shot prompts are often arranged without an explicit learning structure, which can cause the model to imitate surface-level code patterns rather than infer reusable task-planning abstractions. As a result, generalization to unseen long-horizon tasks remains limited. To address these issues, we propose DAHLIA, a D ata- A gnostic H ierarchical Closed-loop Framework for L ong-horizon I ncremental In-context A daptation. DAHLIA formulates manipulation as an episodic code-generation process. In each episode, a planner generates a complete executable task plan by composing predefined perception and manipulation APIs. The plan is executed as a sequence of primitives without per-step replanning. After execution, a reporter evaluates the task outcome from paired observations and the original instruction, then returns structured task-level feedback for the next planning episode if the goal is not yet achieved. This design introduces closed-loop recovery at the task level while avoiding continuous inference during execution. A central component of DAHLIA is its structured in-context learning strategy. Instead of using randomly selected demonstrations, we organize few-shot examples in progressively increasing functional and structural complexity, and combine them with chain-of-thought reasoning cues. The examples therefore serve as a curriculum that guides the LLM to extract reusable program structures, task decomposition logic, and spatial reasoning patterns. This progressive prompting strategy improves long-horizon code synthesis and supports out-of-distribution generalization without task-specific training. The main contributions of this work are summarized as follows: • We propose an episodic code-generation framework for long-horizon robotic manipulation, enabling an LLM to synthesize executable task plans from language instructions without task-specific training or pretrained low-level action policies. • We introduce a progressive in-context learning strategy with chain-of-thought reasoning, which organizes examples from simple to complex and improves compositional generalization in long-horizon planning. • We design a VLM-based episodic reporter that provides structured task-level feedback for replanning under partial observability, while avoiding the computational overhead of per-step feedback. • We evaluate DAHLIA on more than 30 long-horizon tasks across LoHoRavens, CALVIN, Franka Kitchen, and real-world scenarios, demonstrating improved robustness and generalization over strong language- and code-generation baselines. II RELATED WORK Task planning with language guidance uses LLMs as high-level planners for task decomposition via natural language, combined with pretrained low-level controllers (e.g., RL-based) to execute long-horizon tasks. SayCan [ 4 ] introduced open-loop planning with LLMs, while closed-loop variants like Inner Monologue [ 5 ] , DoReMi [ 6 ] , and LoHoRavens [ 7 ] incorporate various feedback mechanisms to enhance robustness. However, these approaches often struggle in unseen scenarios and degrade under environment perturbations due to the limitations of their low-level policies [ 7 , 9 ] . While feedback has been well studied in language-generation-based frameworks, its potential remains underexplored in the context of code-generation-based planning. Manipulation with code generation leverages LLMs to directly control robots through code, bypassing the need for fine-tuned low-level policies [ 10 , 7 , 8 ] . Recent works fall into categories such as direct code generation [ 8 , 11 , 12 ] , task decomposition [ 13 ] , and constraint-based planning [ 14 , 15 ] , with Code-as-Policy (CaP) [ 8 ] being a notable example. However, few studies explore both the role of structured few-shot prompting on robustness and generalization, and closed-loop feedback. Our work aims to address this gap by incorporating a closed-loop feedback pipeline, combining examples with progressively increasing functionality and difficulty. Tasks User Can you use blocks to build a 2*2*2 cube in the zone? Prompted with: 1. Available APIs: from utils import get_obj_names, get_bbox, … 2. Coordinates: front:x+, left:y+, top:z+, back:x-, right:y-, below:z- 3. Rules: You are writing Python code for robot manipulation … 4. Example plan (increasing difficulty): def stack_blocks(…); def stack_blocks_by_color(…) … Chain-of-Thought Reasoning Planners Task plan LMPs/APIs Primitives … Reporter Evaluation LMPs/APIs Observation Structured Contextual Feedback: Success signal Boolean: task complete/ not complete. Object Str: which [object] to operate. Location Array: where the objects [locations]. Target [Str, Array]: where the [target] located. Action Str: what [action] primitive to take Before After Loop 1 A bread at (x1, y1, z1) is not yet placed in the bowl. Task not complete. … Before After Loop k PLANNER REPORTER Fig. 2: Framework of