XYZNOT

Papers · arXiv 2407.17789

Very Large-Scale Multi-Agent Simulation in AgentScope

Published cs.MAcs.AI arXivPDF

Read with translation and AI

Summary in three lines

  1. 🎯 Multi-agent simulation platforms face major bottlenecks in scalability, agent population diversity, and multi-device lifecycle management at massive scale.
  2. 🔧 Implements an actor-based distributed mechanism with one-to-one and many-to-one process modes, automatic workflow conversion via to_dist, multi-layer environments, and an automated persona generator.
  3. 📈 Successfully simulated 1 million agents across 4 multi-GPU devices in 12 minutes (Llama3-8B) and completed a dummy 1M-agent benchmark in just 40 seconds.

Abstract

Recent advances in large language models (LLMs) have opened new avenues for applying multi-agent systems in very large-scale simulations. However, there remain several challenges when conducting multi-agent simulations with existing platforms, such as limited scalability and low efficiency, unsatisfied agent diversity, and effort-intensive management processes. To address these challenges, we develop several new features and components for AgentScope, a user-friendly multi-agent platform, enhancing its convenience and flexibility for supporting very large-scale multi-agent simulations. Specifically, we propose an actor-based distributed mechanism as the underlying technological infrastructure towards great scalability and high efficiency, and provide flexible environment support for simulating various real-world scenarios, which enables parallel execution of multiple agents, automatic workflow conversion for distributed deployment, and both inter-agent and agent-environment interactions. Moreover, we integrate an easy-to-use configurable tool and an automatic background generation pipeline in AgentScope, simplifying the process of creating agents with diverse yet detailed background settings. Last but not least, we provide a web-based interface for conveniently monitoring and managing a large number of agents that might deploy across multiple devices. We conduct a comprehensive simulation to demonstrate the effectiveness of these proposed enhancements in AgentScope, and provide detailed observations and insightful discussions to highlight the great potential of applying multi-agent systems in large-scale simulations. The source code is released on GitHub at https://github.com/modelscope/agentscope/tree/main/examples/paper_large_scale_simulation to inspire further research and development in large-scale multi-agent simulations.

Reading guide

Problem and motivation

Large language model (LLM) agents enable interactive and realistic simulations without extensive manual rule programming. However, scaling multi-agent simulations to realistic demographic sizes reveals three critical bottlenecks:

  1. Scalability and efficiency limits: Centralized execution and Python's Global Interpreter Lock (GIL) hinder agent execution. Existing actor frameworks (e.g., Ray) spin up a new process per actor, wasting resources when handling millions of lightweight, I/O-bound agents.
  2. Unsatisfied population distributions and agent diversity: Agents with simple, identical background prompts behave homogeneously, failing to represent realistic demographic distributions (e.g., across education, age, or occupation).
  3. Difficult management: Orchestrating, launching, monitoring, and terminating hundreds of thousands or millions of agents distributed across clusters requires substantial operational overhead.

Key ideas

  • Actor-based distributed architecture: Agents compute independently as actors. The platform supports both one-to-one (agent-per-process, avoiding GIL for compute-heavy tasks) and many-to-one (agents share processes, maximizing CPU core time-sharing during I/O waits) mappings.
  • Zero-refactor distributed conversion (to_dist): Users author centralized workflows, which are transparently converted to distributed setups using local proxies and asynchronous message placeholders.
  • Environment as an agent: Environments are modeled as specialized agents supporting state maintenance, high concurrency access via RPC, bi-directional triggers (via listeners), and nested multi-layer structures for group-level simulations.
  • Configurable heterogeneous population pipeline: Users define demographic distributions in configuration files, and an LLM meta-prompt pipeline generates diverse, individualized agent personas.
  • Agent-Manager: A web-based graphical interface and persistent remote server network to deploy, monitor, and clean up agents across cluster nodes.

Method

Distributed Execution & Automatic Conversion

In AgentScope, independent agents execute concurrently. When a centralized pipeline is tagged with .to_dist(), two stages occur:

  1. Distributed agents spawn across remote workers; lightweight proxy objects remain on the central orchestrator.
  2. Proxies immediately return message placeholders upon receiving a call. Downstream agents only block when they inspect placeholders that point to pending computation from preceding agents.

Simulation Dynamics

The platform evaluates multi-agent reasoning on the classic "guess of the average" game. Each agent submits . The winning target is: When iterated under common knowledge of rationality, the unique Nash equilibrium converges to . In alternative experiments testing generalization beyond prior training data, the target rule was adjusted to: Setting yields a non-zero Nash equilibrium:

Results

  • Scalability: A simulation of 1,000,000 agents completed in 12 minutes using 4 nodes (each with 8 A100-80G GPUs, 64 CPU cores, 1 TB RAM) using Llama3-8B with basic prompts, and in 85 minutes with Chain-of-Thought (CoT) prompting (which expanded token counts over 150-fold). In a dummy compute benchmark removing LLM inference latency, 1M agents ran in 40 seconds, compared to 8.6 hours via standard Python asynchronous I/O and ~12 days via serial execution.
  • Horizontal scaling: With a fixed 10,000 agents per device, overall runtime remained constant as cluster size increased from 1 to 4 nodes.
  • Prompting & reasoning depth: Under basic prompting, most models reported around 50 (though MistralAI-8x7B averaged 36.63 and MistralAI-8x22B averaged 31.69). Adding CoT instructions pushed reports toward 0 (Qwen2-72B winning numbers dropped from 33.70 to 12.76, and multi-round round 5 averages dropped from 25.16 to 2.02).
  • Demographics & roles: Higher assigned education levels systematically produced lower, more game-theoretically optimal guesses (Ph.D. agents reported lower numbers than elementary school agents). Occupations like game theory professors and economists reported the lowest numbers.
  • Variants: When the equilibrium was shifted to 10 (), agents iteratively converged around 10 over multiple rounds.

Limitations and open questions

  • Role-playing inconsistency in edge cases: When prompted to act as a 7-year-old child, agents still executed multi-step arithmetic and recursive reasoning that contradicted the persona.
  • Simple arithmetic errors: Agents occasionally made basic calculation slips (especially involving fractions or decimals), even when their strategic reasoning logic was sound.
  • Sensitivity to training priors: Shifting the target ratio from to degraded performance because models leaned on memorized game theory patterns; performance recovered only when prompts explicitly stated that the game was a variant of "guess of the average".

Key terms

AgentScope
A multi-agent platform designed for LLM-based applications, extended here to support very large-scale distributed simulations.
Actor Model
A concurrent computation paradigm where each actor acts as an autonomous computing unit that communicates via message passing without shared memory.
to_dist
A built-in AgentScope function that converts a centralized, sequentially authored multi-agent workflow into a distributed execution pipeline using proxies and placeholders.
Placeholders
Asynchronous response tokens returned immediately by proxy agents so orchestrators continue executing without blocking on remote worker responses.
Agent-Manager
A centralized, web-based visual dashboard and daemon server infrastructure used to deploy, observe, and manage the lifecycle of agents across remote cluster nodes.
Guess 2/3 of the Average
A classic game theory benchmark where players pick numbers in [0, 100] aiming to hit 2/3 of the overall average, having a theoretical Nash equilibrium of 0.
Many-to-One Multi-Process Mode
An AgentScope execution mode where multiple agents reside in a single OS process to share threads, CPU cores, and network ports during I/O waits.

Questions

How many agents can AgentScope simulate simultaneously?

The authors demonstrated simulations with up to 1,000,000 active agents running across 4 physical cluster nodes (each equipped with 8 A100-80G GPUs).

How does AgentScope avoid Python GIL limitations in large-scale parallelism?

It implements actor-based multi-processing with two execution modes: one-to-one (one process per agent) for compute-intensive tasks, and many-to-one (multiple agents sharing a process) for API-waiting and I/O-bound tasks, avoiding GIL contention via Remote Procedure Calls.

How are realistic agent populations generated?

Users supply high-level demographic distributions (such as education, gender, age, and occupation) in a configuration file, which an LLM-driven meta-prompt pipeline samples and expands into detailed character biographies.

What happens when the game rules deviate from standard game theory benchmarks?

When altering the ratio to 51/100 or shifting the target formula to 5 + 1/2 of the average, agents initially struggled due to memorized priors, but adding contextual notes or CoT prompts allowed models like Qwen2-72B and MistralAI-8x22B to successfully converge to the shifted equilibrium.

The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.

Read with translation and AI