Table of Contents
Fetching ...

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.

Multi-Agent Systems Powered by Large Language Models: Applications in Swarm Intelligence

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.

Paper Structure

This paper contains 26 sections, 10 figures, 3 tables.

Figures (10)

  • Figure 1: Diagram illustrating the toolchain for LLM-driven multi-agent simulations, integrating NetLogo and GPT-4o via the Python extension and OpenAI API. The workflow showcases a closed-loop process where environmental states are encoded into structured prompts, processed by GPT-4o to generate behavior suggestions, decoded into executable actions, and iteratively executed by agents within the NetLogo simulation environment.
  • Figure 2: Ant foraging simulation in NetLogo. The central circle depicts the nest area, while the three blue circles nearby indicate food sources.
  • Figure 3: Comparison of the total food collected across the three tested models: NetLogo (represented by the orange line), LLM (green line), and Hybrid (blue line). This visualization highlights the food collection performance differences among the different models over five runs with different seeds. The lines represent the means, while the shaded areas indicate the standard deviations.
  • Figure 4: The average number of steps taken by an ant to return to its nest after picking up food (for food patches 1--3). The green boxplots represent the simulations of LLM, the orange boxplots those of NetLogo, while the blue boxplots show the results of Hybrid. Each boxplot spans from the first to the third quartile, with the vertical line within the box indicating the median. The whiskers extend to represent the minimum and maximum number of steps taken, while the circles denote outliers.
  • Figure 5: Average number of steps taken by an ant from leaving the nest to finding a food source. Each boxplot spans from the first to the third quartile, with the vertical line within the box indicating the median. The whiskers extend to represent the minimum and maximum number of steps taken, while the circles denote outliers.
  • ...and 5 more figures