Table of Contents
Fetching ...

OpenCity: A Scalable Platform to Simulate Urban Activities with Massive LLM Agents

Yuwei Yan, Qingbin Zeng, Zhiheng Zheng, Jingzhe Yuan, Jie Feng, Jun Zhang, Fengli Xu, Yong Li

TL;DR

The paper tackles the scalability bottleneck of LLM-based urban agent simulations by introducing OpenCity, a platform combining a scalable LLM request scheduler and a Group-and-Distill prompt optimizer. The system uses IO multiplexing, reusable connections, and CPU-offloaded local IO to achieve large speedups, while clustering agents into groups to share contextual prompts without sacrificing independence. Benchmarks across six cities with up to 10k agents show ~635x speedups, substantial reductions in LLM calls and tokens, and high faithfulness to real-world urban dynamics, enabling first-ever large-scale urban simulations and counterfactual analyses. A case study on urban segregation demonstrates policy-relevant insights and interpretable agent communications, underscoring OpenCity’s potential for interdisciplinary urban studies and planning.

Abstract

Agent-based models (ABMs) have long been employed to explore how individual behaviors aggregate into complex societal phenomena in urban space. Unlike black-box predictive models, ABMs excel at explaining the micro-macro linkages that drive such emergent behaviors. The recent rise of Large Language Models (LLMs) has led to the development of LLM agents capable of simulating urban activities with unprecedented realism. However, the extreme high computational cost of LLMs presents significant challenges for scaling up the simulations of LLM agents. To address this problem, we propose OpenCity, a scalable simulation platform optimized for both system and prompt efficiencies. Specifically, we propose a LLM request scheduler to reduce communication overhead by parallelizing requests through IO multiplexing. Besides, we deisgn a "group-and-distill" prompt optimization strategy minimizes redundancy by clustering agents with similar static attributes. Through experiments on six global cities, OpenCity achieves a 600-fold acceleration in simulation time per agent, a 70% reduction in LLM requests, and a 50% reduction in token usage. These improvements enable the simulation of 10,000 agents' daily activities in 1 hour on commodity hardware. Besides, the substantial speedup of OpenCity allows us to establish a urban simulation benchmark for LLM agents for the first time, comparing simulated urban activities with real-world data in 6 major cities around the globe. We believe our OpenCity platform provides a critical infrastructure to harness the power of LLMs for interdisciplinary studies in urban space, fostering the collective efforts of broader research communities. Code repo is available at https://anonymous.4open.science/r/Anonymous-OpenCity-42BD.

OpenCity: A Scalable Platform to Simulate Urban Activities with Massive LLM Agents

TL;DR

The paper tackles the scalability bottleneck of LLM-based urban agent simulations by introducing OpenCity, a platform combining a scalable LLM request scheduler and a Group-and-Distill prompt optimizer. The system uses IO multiplexing, reusable connections, and CPU-offloaded local IO to achieve large speedups, while clustering agents into groups to share contextual prompts without sacrificing independence. Benchmarks across six cities with up to 10k agents show ~635x speedups, substantial reductions in LLM calls and tokens, and high faithfulness to real-world urban dynamics, enabling first-ever large-scale urban simulations and counterfactual analyses. A case study on urban segregation demonstrates policy-relevant insights and interpretable agent communications, underscoring OpenCity’s potential for interdisciplinary urban studies and planning.

Abstract

Agent-based models (ABMs) have long been employed to explore how individual behaviors aggregate into complex societal phenomena in urban space. Unlike black-box predictive models, ABMs excel at explaining the micro-macro linkages that drive such emergent behaviors. The recent rise of Large Language Models (LLMs) has led to the development of LLM agents capable of simulating urban activities with unprecedented realism. However, the extreme high computational cost of LLMs presents significant challenges for scaling up the simulations of LLM agents. To address this problem, we propose OpenCity, a scalable simulation platform optimized for both system and prompt efficiencies. Specifically, we propose a LLM request scheduler to reduce communication overhead by parallelizing requests through IO multiplexing. Besides, we deisgn a "group-and-distill" prompt optimization strategy minimizes redundancy by clustering agents with similar static attributes. Through experiments on six global cities, OpenCity achieves a 600-fold acceleration in simulation time per agent, a 70% reduction in LLM requests, and a 50% reduction in token usage. These improvements enable the simulation of 10,000 agents' daily activities in 1 hour on commodity hardware. Besides, the substantial speedup of OpenCity allows us to establish a urban simulation benchmark for LLM agents for the first time, comparing simulated urban activities with real-world data in 6 major cities around the globe. We believe our OpenCity platform provides a critical infrastructure to harness the power of LLMs for interdisciplinary studies in urban space, fostering the collective efforts of broader research communities. Code repo is available at https://anonymous.4open.science/r/Anonymous-OpenCity-42BD.

Paper Structure

This paper contains 20 sections, 3 equations, 8 figures, 4 tables.

Figures (8)

  • Figure 1: The functionality of the proposed LLM Request Scheduler.
  • Figure 1: Acceleration experiment results
  • Figure 2: Overview of Group-and-Distill Meta-Prompt Optimizer.
  • Figure 3: Scalability experiments
  • Figure 4: The distribution of income segregation index for counterfactual experiment.
  • ...and 3 more figures