Growing with Your Embodied Agent: A Human-in-the-Loop Lifelong Code Generation Framework for Long-Horizon Manipulation Skills

Yuan Meng, Zhenguo Sun, Max Fest, Xukun Li, Zhenshan Bing, Alois Knoll · Submission to ICLR 2026 · Rejected

TL;DR

Existing language-model-based robotic code generation often fails on long-horizon manipulation due to hallucination, limited context windows, and catastrophic forgetting when prompts are edited. The authors introduce LYRA, a human-in-the-loop framework that distills interactive human corrections into modular, reusable Python skill functions stored in an external memory. Supported by retrieval-augmented generation (RAG) and simple user hints, LYRA achieves a 93% success rate on long-horizon tasks, successfully completing 20+ step manipulation goals like "build a house" in both simulation and the real world.

What Problem Does This Paper Address?

While Large Language Models (LLMs) can generate robot control policies as Python code (e.g., Code-as-Policies), they struggle with long-horizon tasks requiring fine spatial reasoning and multi-step composition.

Current closed-loop methods attempt to fix errors automatically using vision-language models (VLMs) or LLM verifiers. However, automated LLM verifiers frequently suffer from false positives—such as declaring a badly stacked Jenga tower a "success"—or get caught in local optima. When human feedback is used, it is often injected directly by modifying prompt examples or updating flat task scripts, which triggers catastrophic forgetting or pollutes the prompt context.

The paper asks: How can we efficiently capture human guidance into stable, lifelong skill representations that persist and compose across new, complex manipulation problems?

Methods

The authors propose LYRA (Lifelong learning code sYnthesis framework with human-in-the-loop for Robotic long-horizon skill Acquisition), organized into three distinct phases:

  1. Preference-Aligned Skill Acquisition: When learning a base behavior (e.g., stacking blocks corner-to-corner), the LLM parses the natural-language concept into a reusable Python function signature. The agent runs generated candidate code in simulation, and a human provides quick, free-form textual feedback until the function matches user intent.
  2. Lifelong Capability Extension: Users guide the agent through a bottom-up curriculum of task variations. A meta-prompt instructs the agent to extend skills (via nested calls or branching logic) while preserving backward compatibility.
  3. Task-Specific Retrieval & Planning: Learned skills and verified task plans are stored in an external vector database (ChromaDB using OpenAI text embeddings). For a new task:
  4. RAG fetches the top-$K$ most similar code examples and relevant skill headers.
  5. Hint Mechanism: A user can supply brief, natural language hints (e.g., recommending a specific sub-skill) when top-down task decomposition differs semantically from bottom-up skill names.
  6. Real-World Foundation Perception: For physical execution on a Franka FR3 arm, the system replaces privileged simulation states with Grounded SAM 2 (for object segmentation/centers) and FoundationPose (for 6D object orientation).
[Human Feedback] ──> [Skill Function Formulation] ──> [External Memory (RAG)]
                             │                                 │
                     (Extends over time)              (Dynamic Retrieval + Hints)
                             │                                 │
                             ▼                                 ▼
                   Modular Skill Library             Long-Horizon Robot Plans

Datasets

  • Customized Ravens (PyBullet): Long-horizon tabletop rearrangement tasks including block stacking, building arbitrary $i \times j \times k$ pyramids/cubes, assembling facial features, building Jenga towers, and the benchmark "build a house" task (>20 primitives).
  • Franka Kitchen: 4 long-horizon kitchen subtasks (kettle, microwave, slide cabinet, hinge cabinet).
  • Meta-World (MT20): 20 robotic arm manipulation tasks (e.g., button press, sweep-into, drawer operations, hammer).
  • LIBERO-long: Evaluated against baseline Vision-Language-Action (VLA) foundation models.
  • Physical Demonstrations: Real-world execution using a Franka FR3 manipulator on tasks such as building a house, writing "ICLR", stacking Jenga layers, and building a temple.

Key Insights and Ideas

  • Skills as Functions beats Flat Code: Storing knowledge as parameterizable functions (with clear inputs/docstrings) prevents catastrophic forgetting. In contrast, storing flat, monolithic task scripts introduces compounding syntax and execution bugs over long horizons.
  • Humans Reason Faster Than LLMs in Embodied Spaces: While typing human feedback takes ~22 seconds, human visual decision-making takes under 8 seconds (<25% cognitive load). By comparison, automated LLM verifiers took >14 seconds to analyze before/after images and frequently hallucinated false task completions.
  • Bridging the Bottom-Up / Top-Down Gap with Hints: Skills are learned bottom-up from primitives, but complex instructions decompose top-down. Automatic vector similarity sometimes misses the right skill; a lightweight hint bridges this semantic gap and keeps the prompt uncluttered.

Key Results

  • Success Rate: LYRA achieves an average 0.93 success rate across long-horizon Ravens tasks, outperforming open-loop CaP (0.45), LLM-feedback baselines like DAHLIA (0.66), and a memory-less prompt ablation (0.77).
  • Feedback Efficiency: Reduces human correction rounds by 42% on Franka Kitchen (2.75 rounds) and MetaWorld (2.55 rounds) compared to flat-code and LLM-feedback alternatives.
  • Superiority Over VLAs and Lifelong RL on Extreme Horizons: Pretrained VLAs (OpenVLA, $\pi_0$) and lifelong RL baselines (LEGION, HiLL, Text2Reward) achieved 0% success on the >20-step Ravens tasks (pyramids, Jenga, house building), whereas LYRA maintained an 80–95% success rate with zero catastrophic forgetting (score: 0.00).
  • Real-World Long Horizon: Physical runs exceeded 12 continuous minutes without human intervention during execution.

Limitations and Future Work

  • Human Effort Dependency: The system relies on human interaction and curriculum design to establish new skills.
  • Collaborative Human–LLM Feedback: The authors highlight future work in blending automated LLM feedback for simple error detection with human intervention only when ambiguous spatial edge-cases arise.

Summary updated

BibTeX
@misc{meng2025growing,
  author = {Yuan Meng and Zhenguo Sun and Max Fest and Xukun Li and Zhenshan Bing and Alois Knoll},
  title = {{Growing with Your Embodied Agent: A Human-in-the-Loop Lifelong Code Generation Framework for Long-Horizon Manipulation Skills}},
  year = {2025},
  eprint = {2509.18597},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.18597},
}
Figure