Multi-Agent Systems Powered by Large Language Models: Applications in Swarm Intelligence
Cristian Jimenez-Romero, Alper Yegenoglu, Christian Blum
TL;DR
This work demonstrates how large language models (LLMs) can guide agent behaviors in classic swarm systems by embedding decision logic in prompts and integrating GPT-4o with NetLogo via a Python bridge. Through two experiments—ant foraging with structured, rule-based prompts and bird flocking with knowledge-driven prompts—it shows that LLM-driven agents can achieve emergent swarm dynamics comparable to traditional rule-based implementations, with hybrid populations often outperforming purely homogeneous systems. The study highlights the critical role of meticulous prompt design and iterative tuning in achieving reliable, context-aware behavior, and discusses practical considerations such as computation time and API costs. Collectively, the results indicate that LLM middleware can enrich swarm intelligence modeling and enable flexible exploration of self-organizing phenomena, while outlining directions for more scalable, memory-enabled, or locally hosted implementations.
Abstract
This work examines the integration of large language models (LLMs) into multi-agent simulations by replacing the hard-coded programs of agents with LLM-driven prompts. The proposed approach is showcased in the context of two examples of complex systems from the field of swarm intelligence: ant colony foraging and bird flocking. Central to this study is a toolchain that integrates LLMs with the NetLogo simulation platform, leveraging its Python extension to enable communication with GPT-4o via the OpenAI API. This toolchain facilitates prompt-driven behavior generation, allowing agents to respond adaptively to environmental data. For both example applications mentioned above, we employ both structured, rule-based prompts and autonomous, knowledge-driven prompts. Our work demonstrates how this toolchain enables LLMs to study self-organizing processes and induce emergent behaviors within multi-agent environments, paving the way for new approaches to exploring intelligent systems and modeling swarm intelligence inspired by natural phenomena. We provide the code, including simulation files and data at https://github.com/crjimene/swarm_gpt.
