GenSim: Generating Robotic Simulation Tasks via Large Language Models

Lirui Wang, Yiyang Ling, Zhecheng Yuan, Mohit Shridhar, Chen Bao, Yuzhe Qin, Bailin Wang, Huazhe Xu, Xiaolong Wang

TL;DR

GenSim is a framework that uses Large Language Models (LLMs) like GPT-4 to automatically design and code hundreds of new robotic simulation tasks. By scaling task diversity tenfold, the authors demonstrate that robots can learn more robust, generalizable policies that perform 25% better on complex, unseen tasks in the real world.

What Problem Does This Paper Address?

In robotics, the "data bottleneck" is a constant hurdle. Collecting real-world interaction data is slow and expensive. While simulation offers a cheaper alternative, most simulated environments suffer from a lack of task-level diversity.

Humans are great at moving objects around in a scene (scene-level diversity), but writing the actual code for a new task—defining the assets, the success conditions, and the expert demonstrations—is labor-intensive. Consequently, most benchmarks are limited to a few dozen tasks. This lack of variety makes it difficult for robotic policies to generalize; a robot trained to "pick up a red block" might fail completely when asked to "build a bridge" because it has never seen the structural logic required for the latter.

Methods

The authors introduce GenSim, an automated pipeline that treats LLMs as "simulation engineers."

GenSim Pipeline Overview

The framework consists of three main components:

  1. Task Creator: This uses an LLM to propose a task name, a natural language description, and the corresponding Python code (compatible with the PyBullet-based Ravens benchmark). It operates in two modes:
  2. Goal-directed: The user provides a target (e.g., "build a car"), and the LLM generates a curriculum of simpler sub-tasks to reach that goal.
  3. Exploratory: The LLM bootstraps from a library of existing tasks to iteratively propose novel and increasingly complex challenges.
  4. Task Library: A memory component that stores high-quality, verified tasks. This library is used for Retrieval-Augmented Generation (RAG), allowing the LLM to look at previous successful code to write better new code.
  5. Verification Loop: Not all LLM-generated code works. GenSim implements a hierarchical feedback system:
  6. Syntax/Runtime checks: Does the code compile and run?
  7. Achievability: Can an automated expert policy actually solve the task?
  8. LLM Reflection: A second LLM "critic" evaluates if the task is interesting and distinct from existing ones.

Finally, the generated tasks are used to train a language-conditioned multi-task policy (based on the CLIPort architecture), effectively distilling the LLM’s high-level reasoning into low-level robotic actions.

Datasets

  • Initial Seed: 10 human-curated tasks from the CLIPort/Ravens benchmark.
  • GenSim Expanded: A new benchmark of 100+ tasks generated by GPT-4.
  • Finetuning Data: The authors used the 100 GPT-4 tasks to finetune smaller, open-source models like Code Llama and GPT-3.5, showing that these models can become significantly better at task generation with targeted training.

Key Insights and Ideas

  • Task-Level Generalization: The core "aha" moment is that task diversity is more important than scene diversity for building foundational robotic policies. Training on 100 diverse tasks allows the robot to understand the relationships between objects better than training on 10 tasks with 1,000 different object positions.
  • LLMs as Grounded Coders: The paper shows that GPT-4 has a surprising grasp of physical grounding. It doesn't just write code; it understands that a "bridge" requires two pillars and a crossbar, and it can translate that spatial reasoning into simulation coordinates.
Task Composition and Extrapolation
  • Composition and Extrapolation: The authors observed the LLM performing "composition" (combining "put block in bowl" and "insertion" to create "color-ordered insertion") and "extrapolation" (inventing entirely new structures like "build-a-bridge").
  • Distillation via Simulation: Instead of using an LLM to plan every step in real-time (which is slow and expensive), GenSim uses the LLM to create the data that trains a fast, local policy.

Key Results

  • Scaling: GenSim expanded the existing benchmark by 10x with minimal human intervention.
  • Simulation Performance: Policies trained on GenSim tasks showed a 40% improvement in zero-shot transfer to new tasks within the simulator compared to those trained only on human-curated data.
  • Real-World Transfer: In sim-to-real experiments using an XArm-7 robot, the GenSim-pretrained policy outperformed the baseline by 25% on long-horizon tasks (like "sorting garbage" or "packing kits") that it had never seen during training.
  • Model Benchmarking: While GPT-4 is the most capable "engineer," finetuned versions of Code Llama-13B reached performance levels comparable to GPT-3.5, suggesting that task generation can be localized and made more efficient.

Limitations and Future Work

  • Action Space: Currently, GenSim is limited to top-down, 2D "pick-and-place" primitives. It does not yet handle high-degree-of-freedom tasks like opening drawers or manipulating deformable objects (like cloth).
  • Hallucinations: The LLM occasionally tries to use assets (URDF files) that don't exist in the library or creates tasks that are physically impossible.
  • Human Verification: While the process is largely automated, a human still spends about 10 seconds per task to do a final "sanity check" on the generated video.
  • Complex Physics: The framework struggles with tasks requiring complex tactile feedback or intricate contact physics, which are notoriously difficult to simulate accurately.

Summary updated

BibTeX
@inproceedings{wang2024gensim,
  author = {Lirui Wang and Yiyang Ling and Zhecheng Yuan and Mohit Shridhar and Chen Bao and Yuzhe Qin and Bailin Wang and Huazhe Xu and Xiaolong Wang},
  title = {{GenSim: Generating Robotic Simulation Tasks via Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=OI3RoHoWAN},
}
Figure