LAMARL: LLM-Aided Multi-Agent Reinforcement Learning for Cooperative Policy Generation

Guobin Zhu, Rui Zhou, Wenkang Ji, Shiyu Zhao

Abstract

Multi-Agent Reinforcement Learning (MARL) is often hindered by extreme sample inefficiency and the arduous process of manual reward engineering. This paper introduces LAMARL (LLM-Aided Multi-Agent Reinforcement Learning), a framework that leverages the reasoning capabilities of Large Language Models (LLMs) to automatically generate prior policies and reward functions. By integrating these LLM-generated components into a standard MARL pipeline, the framework achieves an average training sample efficiency increase of 185.9% and eliminates the need for expert-level reward design. Experimental results in shape assembly tasks demonstrate that LAMARL matches state-of-the-art performance while significantly reducing manual labor.

1. Introduction

Training robot swarms to perform cooperative tasks, such as shape assembly or collaborative transport, typically relies on Multi-Agent Reinforcement Learning (MARL). Despite its potential, MARL faces two primary bottlenecks: the "cold start" problem, where agents waste millions of steps in random exploration, and the "black art" of reward design, which requires iterative tuning by domain experts.

While LLMs have shown promise in single-agent robotics, multi-agent systems present unique challenges, including the need for decentralized coordination based on local, incomplete information. LAMARL addresses these challenges by using LLMs to provide a structured "warm start" for the learning process, bridging the gap between high-level logical reasoning and low-level numerical optimization.

2. Methodology

The LAMARL framework is divided into two main modules: automated function generation and MARL integration.

2.1 LLM-Aided Function Generation

To ensure the reliability of generated code, LAMARL utilizes a structured pipeline rather than direct code generation:

  • Chain-of-Thought (CoT) Prompting: The LLM is prompted to analyze task constraints, such as collision avoidance and synchronization, before writing code.
  • Basic APIs: A library of pre-implemented Python functions (e.g., get_neighbor_id_list) is provided to the LLM. This restricts the LLM to valid robot capabilities and prevents hallucination.
  • Outputs: The module produces two key Python functions: a Prior Policy (heuristic rules) and a Reward Function (success criteria).

2.2 MARL Integration

The generated functions are integrated into the Multi-Agent Deep Deterministic Policy Gradient (MADDPG) algorithm:

  • Prior Policy Regularization: The RL agent is penalized for deviating significantly from the LLM’s prior policy. This ensures agents maintain "common sense" behaviors, such as avoiding collisions, from the earliest stages of training.
  • Automated Reward: The LLM-generated reward function replaces manual reward engineering, guiding the swarm toward complex task completion without human intervention.

3. Experimental Evaluation

LAMARL was evaluated on a Shape Assembly Benchmark involving 30 homogeneous robots in a 2D simulation and 8 omnidirectional robots in a physical testbed. The task required the swarm to arrange themselves into specific geometric shapes while maintaining uniform spacing.

3.1 Performance and Efficiency

LAMARL demonstrated a significant boost in training speed, reaching convergence with a 185.9% increase in sample efficiency compared to standard RL. In terms of final performance, LAMARL achieved results comparable to the "Mean-shift" method—a hand-tuned traditional control method that represents the current state-of-the-art but requires intensive manual design.

3.2 The Role of Prompt Engineering

The study highlighted the necessity of structured prompting. Without the use of Basic APIs and Chain-of-Thought reasoning, the LLM's success rate in generating valid, executable code plummeted from 68.5% to just 1%.

4. Discussion and Limitations

LAMARL effectively plays to the strengths of both LLMs (high-level logic) and MARL (low-level optimization). However, some limitations remain:

  • Reward Density: Current LLM-generated rewards are often sparse (binary feedback), which may be insufficient for more complex, multi-stage tasks requiring continuous feedback.
  • Geometric Complexity: The system showed slightly lower effectiveness on shapes with sharp corners or narrow passages (e.g., the letters "L" or "T") compared to expert-tuned controllers.
  • Environment Setup: While policy and reward generation are automated, environment parameters like sensing radii still require manual configuration.

5. Conclusion

LAMARL represents a significant step toward autonomous robot swarm training. By automating the most labor-intensive aspects of MARL—reward design and initial exploration—the framework makes complex multi-agent coordination more accessible and efficient. Future work will focus on enabling LLMs to generate dense reward structures and configure simulation environments autonomously.

Summary updated

BibTeX
@article{zhu2025lamarl,
  author = {Guobin Zhu and Rui Zhou and Wenkang Ji and Shiyu Zhao},
  title = {{LAMARL: LLM-Aided Multi-Agent Reinforcement Learning for Cooperative Policy Generation}},
  journal = {IEEE Robotics Autom. Lett.},
  year = {2025},
  doi = {10.1109/lra.2025.3577527},
}
Figure