GenSwarm: Scalable Multi-Robot Code-Policy Generation and Deployment via Language Models

Wenkang Ji, Huaben Chen, Mingyang Chen, Guobin Zhu, Lufeng Xu, Roderich Groß, Rui Zhou, Ming Cao, Shiyu ZhaoarXiv 2025 · DOI

Introduction

Programming a single robot is a significant challenge; programming a swarm is often a logistical and mathematical nightmare. Traditionally, achieving complex collective behaviors—such as encircling a moving target or forming a bridge—required manual derivation of mathematical objective functions and local control laws for every individual unit. GenSwarm introduces an end-to-end pipeline that skips manual derivation, moving directly from natural language instructions to real-world execution using Large Language Models (LLMs).

The Multi-Robot Programming Challenge

The development of swarm robotics is hindered by three primary hurdles:

  1. The Complexity Gap: Swarms rely on emergent behavior. Developers must program individual robots with local rules that result in global behavior, requiring expert-level control theory knowledge.
  2. The Adaptation Gap: Changing a task (e.g., from "encircle" to "follow") typically requires repeating the entire design and validation cycle.
  3. The Deployment Gap: Manually updating code on dozens of physical robots scales poorly and is logistically intensive.

Methodology: The GenSwarm Pipeline

GenSwarm addresses these gaps through a three-module pipeline empowered by LLM agents:

The GenSwarm pipeline consists of task analysis, code generation, and a deployment/improvement loop.
  • Task Analysis: An LLM agent parses instructions to extract a "Constraint Pool" and a "Skill Library."
  • Code Generation: The system constructs a hierarchical Skill Graph, generating low-level skills (e.g., collision avoidance) before high-level logic (e.g., target assignment) to ensure reusability.
  • Deployment & Improvement:
    • Automated Deployment: Utilizing Ansible and Docker, GenSwarm pushes code to all robots simultaneously in near-constant time.
  • VLM Feedback: A Vision Language Model (VLM) analyzes simulation footage. If failures occur, the VLM provides a "critic" report for the LLM to debug the code before physical deployment.

Experimental Evaluation and Results

The system was evaluated on a benchmark of ten diverse multi-robot tasks, including cooperative behaviors like flocking and bridging, and dynamic tasks like pursuing.

GenSwarm's deployment architecture and task performance across simulation and real-world environments.

GenSwarm was compared against state-of-the-art baselines: MetaGPT, Code-as-Policy (CaP), and LLM2Swarm. Key results include:

  • High Success Rates: GenSwarm achieved an average success rate of 81%, outperforming baselines by 34% to 37%.
  • Efficiency: Full runtime environments are deployed in roughly two minutes, with code updates taking only seconds.
  • Interpretability: By defining a "Constraint Pool," the system creates "white-box" Python code that is human-auditable.

Discussion and Future Work

GenSwarm demonstrates that "Plain-Policy" prompts—describing how robots should behave—are more effective than goal-only descriptions. It also successfully manages hybrid control, automatically deciding between centralized and distributed logic.

Current limitations include a reliance on external motion capture for perception and the fact that generated code may not be mathematically "optimal" for energy or speed. Future work will focus on integrating onboard sensing (LiDAR/cameras) and developing a "behavioral repertoire" to reuse successful code across tasks.

Paper Citation: Ji, W., et al. (2025). GenSwarm: Scalable Multi-Robot Code-Policy Generation and Deployment via Language Models. arXiv:2503.23875v2 [cs.RO].

Summary updated

BibTeX
@misc{ji2025genswarm,
  author = {Wenkang Ji and Huaben Chen and Mingyang Chen and Guobin Zhu and Lufeng Xu and Roderich Groß and Rui Zhou and Ming Cao and Shiyu Zhao},
  title = {{GenSwarm: Scalable Multi-Robot Code-Policy Generation and Deployment via Language Models}},
  year = {2025},
  eprint = {2503.23875},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.23875},
}
Figure