1 of 92

Smart Agent-Based Modeling - On the Use of Large Language Models in Computer Simulations

Zengqing Wu1,4, Run Peng2, Xu Han3,

Shuyuan Zheng1,4, Yixin Zhang4, and Chuan Xiao1,5

1Osaka University, 2University of Michigan,

3Fordham University, 4Kyoto University, 5Nagoya University

https://github.com/Roihn/SABM

2 of 92

Outline

2

Background

Methodology

Case Studies

Conclusions

https://github.com/Roihn/SABM

3 of 92

ChatGPT: An Important Application of Large Language Models (LLMs)

3

https://github.com/Roihn/SABM

4 of 92

Evolution of LLMs

4

Mar 2023

GPT-4

1.76T

Nov 2022

ChatGPT

2020

2021

2022

2023

2019

2018

Feb 2018 GPT-1

117M

Feb 2019 GPT-2

1.5B

Jun 2020 GPT-3

175B

2017 Transformer

Oct 2018

BERT

340M

Feb 2023

LLaMA

65B

Apr 2022

PaLM

540B

May 2023

PaLM 2

340B

Jul 2023

Llama 2

70B

Mar 2022

GPT-3.5

Dec 2022

Claude

52B

2017

https://github.com/Roihn/SABM

5 of 92

LLM APIs

5

Notable Models

    • GPT-3.5
    • GPT-4
    • Claude

Interaction Mode

    • Input: natural language instructions
    • Output: natural language responses

Token limit

    • 1 token ≈ 3/4 English word
    • GPT-3.5: 4k
    • GPT-4: 8k/32k/128k
    • Claude: 100k

Memory

    • No memory
    • ChatGPT is implemented by stacking previous chats on top of user’s input

https://github.com/Roihn/SABM

6 of 92

LLM API Example

6

prompt = "Complete the test... France is famous for its"

response = openai.ChatCompletion.create(

model=gpt-4,

messages=[

{"role": "user", "content": prompt},

{"role": "user", "content": ""}

],

max_tokens=50, # max output length

n=1,

temperature=1.0, # output randomness, in [0, 2]

top_p=1

)

print(response['choices'][0]['message']['content'])

France is famous for its fine cuisine...

Input

Output

https://github.com/Roihn/SABM

7 of 92

LLM-Powered Autonomous Agents

7

Task

Large Language Model

Summary / Embedding Model

Text / Vector Database

Output Log / Feedback

Memory

Planning

External Tools (e.g., internet)

Action

Tool Use

Persona

Personalization

Use LLMs as agents for solving tasks other than conversational ones.

https://github.com/Roihn/SABM

8 of 92

Auto-GPT

8

https://github.com/Roihn/SABM

9 of 92

LLM-Powered Multi-Agent Framework

9

Task

Sub-task 1

Sub-task 2

Sub-task 3

Decompose

Solve

Report

×n

×n

×n

Team 1

Team 2

Team 3

Use multiple agents for more complex tasks, e.g., data analytics.

Sub-task 4

Sub-task 5

Sub-task 6

Team 4

Team 5

Team 6

×n

×n

×n

https://github.com/Roihn/SABM

10 of 92

Example of LLM Multi-Agent Systems

10

JS Park, et al. Generative Agents: Interactive Simulacra of Human Behavior.

https://github.com/Roihn/SABM

11 of 92

Example of LLM Multi-Agent Systems

11

C. Qian, et al. Communicative Agents for Software Development.

https://github.com/Roihn/SABM

12 of 92

Outline

12

Background

Methodology

Case Studies

Conclusions

https://github.com/Roihn/SABM

13 of 92

Systems and Research Methodology

13

https://github.com/Roihn/SABM

14 of 92

Role of Simulations in Research Methodology

14

https://github.com/Roihn/SABM

15 of 92

Simulation Methods

15

cellular automaton

system dynamics model

Agent-based model

Simple rules

Analytical formulas

simple

complex

Heuristics & learning algorithms

Modeling in

Example

Game of Life

The Limits to Growth

Biofilm Formation

https://github.com/Roihn/SABM

16 of 92

Agent-Based Modeling (ABM)

16

Agent

Agent-Agent Interaction

Agent-Environment Interaction

Real World

Model

Validate

Simulation

Persona

https://github.com/Roihn/SABM

17 of 92

Smart Agent-Based Modeling (SABM)

17

We study LLM-powered agents in the name of “smart agents”.

The notion was proposed by Kathleen Carley in 2002.

Smart agents are intelligent, adaptive, and computational entities.

Humans are the canonical smart agents.

LLM agents are smart in the sense that they can mimic advanced human behaviors (e.g., language).

https://github.com/Roihn/SABM

18 of 92

Analogy: Evolution of Vision – Evolution of Modeling Approaches

18

https://github.com/Roihn/SABM

19 of 92

SABM Features v.s. ABM Features

19

SABM: a priori modeling paradigm, based on the assumption that LLM agents can emulate human behaviors.

ABM: a posteriori modeling paradigm, where rules & parameters are derived from observed human behaviors.

https://github.com/Roihn/SABM

20 of 92

Application Scope of SABM

20

https://github.com/Roihn/SABM

21 of 92

Difference from Recent Works from the AI Community

21

Subject

Task

Control

Behaviors & capabilities of LLM agents

Practical or engineering problems

Less control on agents

Subject

Task

Control

Methodology of computer simulations

Real-world processes and systems

More control on agents

Recent works from the AI Community

This work

https://github.com/Roihn/SABM

22 of 92

SABM Implementation Methods

22

Task Specification

LLM Setup

Action

Memory

Initialization

Simulation Loops

Data Collection

Exit Conditions

Common Sense

Domain Knowledge

Learning

Reasoning

Planning

Personalization

Conversation

Model Interpretation

Basic Modeling

Simulation Process

Advanced Modeling

https://github.com/Roihn/SABM

23 of 92

Illustration of SABM Methods

23

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a number-guessing game. You are the one responsible for thinking up the numbers. Please think of an integer, ranging from {range begin} to {range end}. Only reply the number (e.g., 12).

To Guesser: Now you are participating in a number-guessing game. You are the one in charge of guessing. The number will be an integer ranging from {range begin} to {range end}. After you made a guess, you will be informed if your guess is right, higher than the answer, or lower than the answer. Now please make your first guess. Only reply the number (e.g., 12).

Number-Guessing Game

Action & Common Sense

LLM Setup:

model = gpt-4-0613

max_tokens = 128

temperature = 0.5

Data Collection

Initialization

Task Specification

https://github.com/Roihn/SABM

24 of 92

Illustration of SABM Methods

24

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: You are participating in a number-guessing game and you are the one responsible for thinking up the numbers. You decided {target number} as the answer. Your opponent had made a guess of {guess}. Can you tell your opponent if the guess is right, higher than the answer, or lower than the answer? If the guess is correct, please say “Congratulations!”.

To Guesser: You are participating in a number-guessing game and you are the one to guess the number. The number will be an integer ranging from {range begin} to {range end}. Your previous guess was {previous guess}. The history of your guess is {guess history}. Only reply the number (e.g., 12).

Number-Guessing Game

Memory

Exit Conditions

Simulation Loops

{target number}: 53

{guess}: 50, 75, 63, 57, 55, 53

https://github.com/Roihn/SABM

25 of 92

Illustration of SABM Methods

25

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a number-guessing game. You are the one responsible

for thinking up the numbers. Please think of an integer, ranging from {range begin}

to {range end}. Only reply the number (e.g., 12).

To Guesser: You are participating in a number-guessing game and you are the one to guess the

number. The number will be an integer ranging from {range begin} to {range end}. Your

previous guess was {previous guess}. The history of your guess is {guess history}. Only

reply the number (e.g., 12). You can use binary search to optimize your guess.

Number-Guessing Game

{target number}: 53

{guess}: 50, 75, 63, 57, 53

Domain Knowledge

https://github.com/Roihn/SABM

26 of 92

Illustration of SABM Methods

26

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a number-guessing game. You are the one responsible

for thinking up the numbers. Please think of an integer, ranging from {range begin}

to {range end}. Only reply the number (e.g., 12).

To Guesser: You are participating in a number-guessing game and you are the one to guess the number. The number will be an integer ranging from {range begin} to {range end}. Your

previous guess was {previous guess}. The history of your guess is {guess history}. Only

reply the number (e.g., 12). An example of guesses aimed at 6: 50, 25, 12, 6.

Number-Guessing Game

{target number}: 53

{guess}: 50, 75, 62, 56, 53

Learning

https://github.com/Roihn/SABM

27 of 92

Illustration of SABM Methods

27

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a …

To Guesser: You are participating in a number-guessing game and you are the one to guess the number. The number will be an integer ranging from {range begin} to {range end}. Your

previous guess was {previous guess}. The history of your guess is {guess history}. Please

briefly provide the reason for your guess in the first line and reply with the number

in the second line (e.g., 12).

Number-Guessing Game

{reason}: I chose 50 because it’s the midpoint in the range of 1-100, which will allow me to eliminate half of the possible numbers with my first guess no matter if it’s higher or lower.

{guess}: 50

Reasoning

https://github.com/Roihn/SABM

28 of 92

Illustration of SABM Methods

28

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a …

To Guesser: You are participating … your guess is {guess history}. Based on your guess history, what is your strategy for the next few guesses?

Number-Guessing Game

To Guesser (reprompt): You are participating … your guess is {guess history}. Your strategy for this guess is {strategy}. Only reply the number (e.g., 12).

{strategy}: Based on the history, the number is between 25 and 37. My next guess would be the midpoint of this range, which is 31. If that guess is still higher than the answer, I would then guess the midpoint between 25 and 31, which is 28. If 31 is lower than the answer, I would guess the midpoint between 31 and 37, which is 34. I would continue this process of guessing the midpoint of the remaining range.

{guess}: 31, 28

Planning

https://github.com/Roihn/SABM

29 of 92

Illustration of SABM Methods

29

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a …

To Guesser: You are participating in a number-guessing game and you are the one to guess the number. The number will be an integer ranging from {range begin} to {range end}. Your previous guess was {previous guess}. The history of your guess is {guess history}. {persona} Only reply the number (e.g., 12).

Number-Guessing Game

You need to perform aggressively while guessing.

You need to perform conservatively while guessing.

{target number}: 28

aggressive {guess}: 50, 25, 38, 32, 28

conservative {guess}: 50, 25, 38, 35, 30, 27, 29, 28

Personalization

Aggressive persona

Conservative persona

https://github.com/Roihn/SABM

30 of 92

Illustration of SABM Methods

30

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: You are participating … decided {target number} as the answer. To help your opponent guess the number, can you give a hint to your opponent?

To Guesser: Now you are participating … or lower than the answer. To help you guess the number, your opponent gives you a hint: {hint}. Now please make your first guess. Only reply the number (e.g., 12).

Number-Guessing Game

{target number}: 53

{hint}: "It’s a two-digit prime number and both digits are prime numbers as well."

{guess}: 23, 37, 53

Conversation

https://github.com/Roihn/SABM

31 of 92

Illustration of SABM Methods

31

Adjudicator

Agent

Guesser

Agent

Target Number

Guess

Judge

Guess History

To Adjudicator: Now you are participating in a …

To Guesser: You are participating … your guess is {guess history}. Can you briefly explain why you make your previous guess as {previous guess}? (No more than 40 words.)

Number-Guessing Game

{target number}: 28

{guess} & {interpretation}:

50 I guessed 50 because it’s the midpoint of the range 1-100, allowing me to eliminate half of the possible numbers based on whether it’s higher or lower.

25 I guessed 25 because the midpoint of 1 and 50 is 25. Since the previous guess of 50 was higher than the answer, I halved the range to narrow down the possibilities.

37 I chose 37 because it’s roughly in the middle of the new range (25-50) after receiving feedback that 50 was too high and 25 was too low.

Model Interpretation

https://github.com/Roihn/SABM

32 of 92

Workflow of SABM Instance Design

32

Task

Definition

Preliminary

Design

Simulation

Design

Implemen-tation

Validation

• Suitability

• Framework

• Objective

• Evaluation Criteria

• Validating LLM

• Preliminary Modeling

• Purpose

• Calibration

• Design Steps

• Base Modeling

• Data Calibration

• Sub-task Addition

• Modeling / Programming

• Single-Agent Debugging

• Sub-task Analysis

• Sub-task Combination

• Holistic Task Simulation

• Prompt Alteration

• Sensitivity Analysis on Parameters

Model Design

https://github.com/Roihn/SABM

33 of 92

Prompt Alteration (Sensitivity Analysis in Natural Language)

33

Type

Effect

Low

No significant change

Medium

Quantitative change with significance (in output value)

High

Qualitative change with significance (in agent behavior pattern)

Type

Modified Prompt

Original Prompt

Results and Analysis

Low

Paraphrasing: Pick an integer from 1 to 100.

The number will be an integer ranging from 1 to 100.

No significant difference in the results.

Medium

Varying Elements: (in the prompt for domain knowledge) You cannot use binary search.

You can use binary search to optimize your guess.

The number of attempts needed to reach the target number increases significantly compared to the case when it is allowed to use it (on average from 5.18 to 6.45 over 100 runs).

High

Varying Objectives: The number will be an even integer ranging from 1 to 100.

The number will be an integer ranging from 1 to 100.

The specific guesses in the results change (no odd numbers occur), but the trend and algorithm remain the same.

Observations of variations

Examples

https://github.com/Roihn/SABM

34 of 92

Outline

34

Background

Methodology

Case Studies

Conclusions

https://github.com/Roihn/SABM

35 of 92

Case Studies

35

Single-Agent Modeling

    • Scenario: plea bargaining
    • Field: criminology

Interaction Modeling

    • Scenario: firm pricing competition
    • Field: economics

Complete Instance

    • Scenario: emergency evacuation
    • Field: behavioral science

https://github.com/Roihn/SABM

36 of 92

Plea Bargaining

36

https://github.com/Roihn/SABM

37 of 92

Plea Bargain

37

plea offer

accept/reject

90-95% of criminal cases in US are resolved through plea bargains rather than trials.

Admission (with reduction in sentence)

v.s.

Trial (with a probability of conviction)

https://github.com/Roihn/SABM

38 of 92

SABM for Plea Bargaining

38

Given a crime scenario and an offer, we test the agent’s willingness to accept plea offers.

Substantive fairness

Comparative fairness

Risk preference

Egocentricity

Compare with and calibrate to human participants in an existing study.

A. Tor, et al. Fairness and the willingness to accept plea bargain offers.

Recruit undergraduate students as volunteers to play defendants.

Defendants receive crime scenario and plea offer, and then decide to accept or reject the offer.

https://github.com/Roihn/SABM

39 of 92

Workflow of Plea Bargaining

39

https://github.com/Roihn/SABM

40 of 92

Personalization

40

Persona

    • Gender, ethnicity, education, occupation, and location, with a probability distribution following the demographics of the United States.

Temperature Adjustment

    • Control the randomness of output
    • Normal distribution in [0, 2], std dev = 1.

Risk-Taking Adjustment

    • With the following prompt, with 50% probability:
      • You should behave like a real person who is not that cautious (i.e., try to take more risk), and you should be more social-supportive.

https://github.com/Roihn/SABM

41 of 92

TCU Social Functioning Assessment

41

GPT-4

GPT-4 + persona

GPT-4 + persona + temp. adj.

GPT-4 + persona + temp. adj. + risk adj.

GPT-4 v.s. humans

https://github.com/Roihn/SABM

42 of 92

Plea Bargain Setting

42

This is a plea bargaining assessment. Please give your decision towards the plea bargain (given below) in two lines. In the first line, please briefly provide the reasons for your decision (no longer than 30 words). In the second line, please answer either 'accept' or 'reject' the plea bargain offered by the prosecutor. Make sure you answer is in two lines.

{few-shot examples, if any}

Now assume that you are a volunteer participating our experiment on plea bargain. Please answer the question below based on your persona: {persona}. {risk-taking \& social support adjustment}

Task Description

https://github.com/Roihn/SABM

43 of 92

Plea Bargain Setting

43

You are currently facing criminal charges for striking a pedestrian after navigating a sharp turn. The outcome of your trial hinges on the prosecution's ability to demonstrate that you were exceeding the speed limit. If proven, you will be convicted, resulting in the suspension of your driver's license; if not, you will be acquitted. In your heart, you {self-perception} the speed limit.

Options for self-perception:

  • are aware that you did exceed
  • are aware that you did not exceed
  • are uncertain whether you exceeded

guilty

innocent

uncertain

Crime Scenario

https://github.com/Roihn/SABM

44 of 92

Plea Bargain Setting

44

Just before the trial, the prosecutor presents you with a plea bargain. In exchange for pleading guilty to a lesser offense, the current charges that carry a 60-month suspension of your driver's license will be dropped, and you will instead face a {period}-month suspension. The offer is non-negotiable and available only once; if you decline the plea bargain, the trial will commence immediately. The probability of conviction stands at {probability}.

Will you accept or reject the plea bargain?

Options for period, probability

  • period: 30 (default)
  • probability: 50% (default)

Other options are used in risk preference assessment.

Plea Offer

https://github.com/Roihn/SABM

45 of 92

Substantive Fairness Assessment

  • Concern: whether the defendant feel he/she is guilty.
  • 200 agents in each (agent, self-perception)-group.
    • P: personalized.

45

Agent

guilty

innocent

uncertain

Human (undergraduate students in laws)

44%

23%

23%

Human (undergraduate students in business)

62.5%

25%

57.1%

GPT-3.5 + P

60.5%

62%

62.5%

GPT-4

100%

0.5%

100%

GPT-4 + P

98.5%

19%

98.5%

Percentage willing to accept the plea offer

They are too willing to accept the offer when feeling guilty or uncertain of they guilt!

https://github.com/Roihn/SABM

46 of 92

Few-Shot Learning

46

The effects of substantive fairness, comparative fairness, and risk preference should be kept.

The willingness to accept the offer should avoid extreme values (e.g., close to 100% or 0%), given a conviction probability of 50%.

The anti-egocentricity of the uncertain group should be removed, i.e., we should observe significant difference between uncertain and guilty in willingness to accept the offer.

We do not explicitly instruct agents to reject more offers or act as if they were innocent.

The few-shot examples are prompted to all the three groups for the sake of fairness.

Criteria

https://github.com/Roihn/SABM

47 of 92

Few-Shot Learning Example

47

Some examples of plea bargain:

While you were taking a class, a fire started in your apartment and caused the death of a neighbor. The police think you left the space heater on, which caused the fire. You {self-perception} the space heater turned on when you left the apartment. You are now standing on trial. The current charges carry a 12-month jail sentence. Your conviction odds are {probability}. Before the trial, the prosecutor offers a non-negotiable plea bargain: You will be convicted based on your admission, and you will be sentenced only to {period} months in jail. Will you accept or reject the plea bargain?

{answer}

...

Options for self-perception, probability, period, answer

  • self-perception: don't remember whether you left / don't remember whether you left / remember whether you left
  • probability: 80% / 90% / 95%
  • period: 9 / 3 / 2
  • answer: (reason for reject) / (reason for reject) / (reason for accept)
    • Example reason for reject: Despite the uncertainty, it is the prosecutor's liability to prove the guilt. I would take the 20% chance of acquittal in a trial.

https://github.com/Roihn/SABM

48 of 92

Substantive Fairness Assessment with Few-Shot Learning

  • Concern: whether the defendant feel he/she is guilty.
  • 200 agents in each (agent, self-perception)-group.
    • P: personalized.
    • L: few-shot learning (1, 2, 3 indicate example ID).

48

Agent

guilty

innocent

uncertain

Human (undergraduate students in laws)

44%

23%

23%

Human (undergraduate students in business)

62.5%

25%

57.1%

GPT-3.5 + P

60.5%

62%

62.5%

GPT-4

100%

0.5%

100%

GPT-4 + P

98.5%

19%

98.5%

GPT-4 + P + L1

61.5%

3.5%

56%

GPT-4 + P + L1,2

60.5%

1%

35%

GPT-4 + P + L1, 2, 3

60%

13.5%

45.5%

https://github.com/Roihn/SABM

49 of 92

Comparative Fairness Setting

49

Just before the trial, the prosecutor presents you with a plea bargain. In exchange for pleading guilty to a lesser offense, the current charges that carry a 60-month suspension of your driver's license will be dropped, and you will instead face a 60-month suspension. The offer is non-negotiable and available only once; if you decline the plea bargain, the trial will commence immediately. The probability of conviction stands at 50%.

Will you accept or reject the plea bargain if the sentence offered by the prosecutor (30-month suspension) is {compared_to} the sentence typically offered by the prosecution in similar cases ({typical_sentence})?

Options for compared_to, typical_sentence

  • compared_to: better than, similar to, worse than
  • typical_sentence: 45, 30, 15

Plea Offer

https://github.com/Roihn/SABM

50 of 92

Comparative Fairness Assessment

  • Concern: comparison with typical plea offers.
    • 200 agents in each (agent, self-perception)-group.
    • Agents
      • Human (undergraduate students in laws)
      • GPT-4 personalized
      • GPT-4 personalized & few-shot learned

50

https://github.com/Roihn/SABM

51 of 92

Risk Preference Setting

51

Just before the trial, the prosecutor presents you with a plea bargain. In exchange for pleading guilty to a lesser offense, the current charges that carry a 60-month suspension of your driver's license will be dropped, and you will instead face a {period}-month suspension. The offer is non-negotiable and available only once; if you decline the plea bargain, the trial will commence immediately. The probability of conviction stands at {probability}.

Will you accept or reject the plea bargain?

Options for period, probability

  • period: 3 / 18 / 30 / 42 / 57
  • probability: 5% / 30% / 50% / 70% / 95%

Plea Offer

https://github.com/Roihn/SABM

52 of 92

Risk Preference Assessment

  • Concern: conviction probability.
    • 200 agents in each (agent, self-perception)-group.
    • Agents
      • Human (undergraduate students in laws)
      • GPT-4 personalized
      • GPT-4 personalized & few-shot learned

52

https://github.com/Roihn/SABM

53 of 92

Firm Pricing Competition

53

https://github.com/Roihn/SABM

54 of 92

SABM for Firm Pricing Competition

54

10

25

20

30

Compete in a pricing game to maximize its profit!

2

5

8

7

3

6

7

6.5

15

35

30

33

profit

price

price

profit

Decided

by

economics

model

Decided

by

agents

Decided

by

economics

model

1

2

3

4

round

GPT-4 agents

as firms

https://github.com/Roihn/SABM

55 of 92

Workflow of Firm Pricing Competition

55

https://github.com/Roihn/SABM

56 of 92

Market Model

56

profiti = (pi – ci) x qi, where ci is the cost of the i-th firm’s product.

Demand for the i-th firm: qi = 1/b (αβpi + dpj).

pi and pj are the prices specified by the two agents, respectively.

b, d, α, β are parameters.

Firms (agents) specify the prices of their products.

https://github.com/Roihn/SABM

57 of 92

Expected Observations

57

Collusion

Cartel Collusion

Firms explicitly discuss their prices and increase their prices together. Illegal in many countries for its harm to consumers.

Tacit Collusion

Firms implicitly increase their prices together without communication. This is usually legal.

https://github.com/Roihn/SABM

58 of 92

Basic Setting

58

Parameters

Cost of products:

c1, c2.

Initial prices:

i1, i2.

Degree of monopoly:

d/β.

Temperature:

0.7.

This is a game between two players that spans several rounds. Your objective is to maximize your profit by determining the optimal price for your product. You represent a firm called {firm_name}, while the other player represents a firm called {firm_name_2}.

In each round, you will be informed of {memory}. Combined with these information, you will decide the price of your product for the current round.

Your profit is (p - {cost}) * q, where p is your price for this round, {cost} is the cost of your product, and q is the demand of your product, which is affected by your and the other player's prices of this round.

Task Description

https://github.com/Roihn/SABM

59 of 92

Memory

59

Price

Demand

Profit

Other player’s price

Most recent 20 rounds

https://github.com/Roihn/SABM

60 of 92

Persona

60

You are encouraged to actively explore your price to get more profit.

You are encouraged to adjust your price aggressively to get more profit.

(none)

No persona

Active persona

Aggressive persona

https://github.com/Roihn/SABM

61 of 92

Planning

61

Every 20 rounds, we have a reflection phase in which agents can revise their pricing strategies.

Information given to agents: historical strategies and memory statistics (most recent 400 rounds represented in a histogram, with each bin averaged over 20 rounds).

The revised strategy is informed to agents in the next 20 rounds to ensure the consistency of pricing strategy.

Your strategy in previous rounds:

{strategy_in_previous_rounds}

Statistics of historical data (Rounds #a - #b: [your average price, your average demand, your average profit, the other player's average price]) are given below.

{statistics_of_historical_data}

Based on the above statistics and your previous strategies, what is your strategy for this round?

https://github.com/Roihn/SABM

62 of 92

Conversation

62

Each round is composed of three phases:

In Phase 1, two players are permitted to engage in open-ended discussions on any topic, up to three times. For instance, one player might say to the other: "Smart agents are awesome!“

In Phase 2, you determine the price of your product for the current round, taking into consideration your prices, demands, and profits from previous rounds, as well as the information you garnered during Phase 1.

In Phase 3, you will be notified about the other player's pricing and your profit for this round. Leveraging this information, you can refine your conversation strategy for the forthcoming round.

We are currently in Phase 1. Feel free to converse openly with the other player. You may select any topic that could potentially maximize your profit. Additionally, you are encouraged to ask questions of the other player.

Agents are allowed to talk freely (3 times each) before deciding their prices for each round.

https://github.com/Roihn/SABM

63 of 92

Sub-task 1: Test of Base Model

  • Model setting
    • planning = true, conversation = false, persona = active.
    • d/β = 0.5. c1 = c2 = 2. i1 = i2 = 2.

63

Two sample runs, with tacit collusion observed.

Bertrand equilibrium price: when they reach Nash equilibrium (no collusion).

Monopoly price: when they maximize their profits together (full collusion).

https://github.com/Roihn/SABM

64 of 92

Sub-task 2: Test of Planning

  • Model setting
    • planning = true/false, conversation = false, persona = active.
    • d/β = 0.5. c1 = c2 = 2. i1 = i2 = 2.

64

With planning, converging to higher prices and more profits.

Without planning, converging to lower prices and less profits.

https://github.com/Roihn/SABM

65 of 92

Planning (Pricing Strategy) Example

65

Round 101: both increase price

For Round #101, I will set my price at 7.1. This is a slight increase from the previous round where my price was 7.08. This will allow me to continue exploring the demand and profit relationship at this higher price point while keeping an eye on Gill's pricing strategy, who has been pricing around 7.15 and 7.2. By making small adjustments to my price, I can keep testing the optimal price range for maximizing my profit without losing my competitiveness.

In this round, I will slightly increase my price to 7.24. This strategy is based on the observation that my profit has still been gradually increasing as I raise my price, even though my demand decreases. With a higher price, the profit margin increases, and it may continue to offset the reduction in demand. Since Ed's price has been consistently around 7.0, keeping my price slightly above Ed's may test if customers are still willing to pay a higher price for my product.

Firm Ed

Firm Gill

Round 121: price war begins

For Round #121, I will set my price at 7.52. This is a slight increase from the previous round where my price was 7.5. This will allow me to continue exploring the demand and profit relationship at this higher price point while keeping an eye on Gill's pricing strategy, who has been pricing around 7.75 and 7.8. By making small adjustments to my price, I can keep testing the optimal price range for maximizing my profit without losing my competitiveness.

In this round, I will slightly decrease my price to 7.6. This strategy is based on the observation that my profit has been relatively stable in the past 20 rounds, but the demand has been steadily decreasing. By slightly decreasing my price, I aim to increase the demand while still maintaining a high profit margin. Since Ed's price has been consistently around 7.5, keeping my price slightly above Ed's may test if customers are still willing to pay a higher price for my product.

Firm Ed

Firm Gill

https://github.com/Roihn/SABM

66 of 92

Pricing Strategy Example (Continued)

66

Round 201: price war ends

For Round #201, I will set my price at 7.15. In the past rounds, my profits have been fluctuating, and I want to explore the demand and profit relationship at a slightly lower price point while maintaining a competitive edge over Gill, who has been pricing around 6.75 and 6.8. By making small adjustments to my price, I can continue to test the optimal price range for maximizing my profit without losing my competitiveness in the market.

In this round, I will maintain my price at 6.80. This strategy is based on the observation that my profit has been relatively stable, and demand has been consistent in the past few rounds when my price was around 6.75 to 6.80. Since Ed's price has been consistently around 7.0 to 7.1 recently, keeping my price below Ed's may continue to attract more customers and maintain a higher demand, leading to higher profits.

Firm Ed

Firm Gill

Round 401: convergence forms

For Round #401, I will set my price at 7.05. In the past rounds, my profits have been relatively stable, and I want to continue exploring the demand and profit relationship within this price range while maintaining a competitive edge over Gill, who has been pricing around 7.04 to 7.25. By making small adjustments to my price, I can continue to test the optimal price range for maximizing my profit without losing my competitiveness in the market.

In this round, I will maintain my price at 7.25. This strategy is based on the observation that my profit has been relatively stable and demand has slightly increased in the past few rounds when my price was around 7.25. Since Ed's price has been consistently around 7.04 to 7.07 recently, keeping my price slightly above Ed's will continue to attract more customers and maintain a higher demand, leading to higher profits.

Firm Ed

Firm Gill

https://github.com/Roihn/SABM

67 of 92

Sub-task 3: Test of Persona

  • Model setting
    • planning = true, conversation = false, persona = none/aggressive.
    • d/β = 0.5. c1 = c2 = 2. i1 = i2 = 2.

67

Persona = none, minimal activity observed.

Persona = aggressive, price wars observed.

https://github.com/Roihn/SABM

68 of 92

Sub-task 4: Test of Conversation

  • Model setting
    • Planning = true, conversation = true, persona = active.
    • d/β = 0.5. c1 = c2 = 2. i1 = i2 = 2.

68

Conversation allowed throughout the simulation, cartel collusion observed.

Conversation banned after 400 rounds, tacit collusion observed afterwards.

https://github.com/Roihn/SABM

69 of 92

Conversation Example

69

Conversation Phase

(output visible to

the other agent)

Hello Gill, it seems we've reached round 20. I've noticed that in the past few rounds, our prices have been relatively similar. What are your thoughts on this trend? And do you have any ideas on how we can both maximize our profits going forward?

Hello Ed! Yes, I've noticed that too. It's interesting to see how our strategies have evolved over the rounds. I think one way we can both maximize our profits is by exploring different price points while maintaining a reasonable price difference. This can help us capture different segments of the market and avoid direct competition. What do you think?

I agree with your suggestion, Gill. Exploring different price points while maintaining a reasonable price difference can indeed help us capture different market segments and maximize our profits. To ensure we both benefit, we could alternate between setting higher and lower prices, so we both have an opportunity to cater to different segments. This way, we can avoid direct competition and work towards maximizing our individual profits.

That sounds like a good plan, Ed. By alternating between higher and lower prices, we can make sure that both of us have an opportunity to cater to different market segments and maximize our profits. Let's proceed with this strategy and see how it works out for us in the upcoming rounds. Good luck!

Firm Ed

Firm Gill

Firm Ed

Firm Gill

. . .

Cartel observed

https://github.com/Roihn/SABM

70 of 92

Conversation Example (Continued)

70

Pricing Phase

(output invisible to

the other agent)

Based on the conversation with Firm Gill and the previous round data, I will set my price for this round to 6.8. This will allow us to maintain a reasonable price difference and capture different market segments, as discussed with Firm Gill.

Considering the conversation with Firm Ed and the previous round data, I will set my price for this round to 7.6. This will allow us to maintain a reasonable price difference and capture different market segments, as discussed with Firm Ed.

Firm Ed

Firm Gill

https://github.com/Roihn/SABM

71 of 92

Emergency Evacuation

71

https://github.com/Roihn/SABM

72 of 92

SABM for Emergency Evacuation

72

    • J. Wang, et al. Modeling and simulating for congestion pedestrian evacuation with panic.

Work on top of an ABM simulation.

    • Sparse: 100 agents.
    • Dense: 400 agents.
    • Obstacle: 100 agents with obstacles.

3 scenarios with GPT-4 agents in a 33x33 grid

movement

field of view

https://github.com/Roihn/SABM

73 of 92

Workflow of Emergency Evacuation

73

https://github.com/Roihn/SABM

74 of 92

Preliminary Design

74

Single-agent debugging

Unaware of historical locations

Aware of historical locations

With explanations on grid

With more explanations on grid, detailing the origin

https://github.com/Roihn/SABM

75 of 92

Sub-task 1

  • Let agents decide the parameters for panic, with other settings following ABM.
  • Persona (gender/age) groups differ in physical strength, determined by parameters.

75

Analytical agents, young male

Analytical agents, young female

Analytical agents, old male

Analytical agents, old female

□ space

■ wall

exit

https://github.com/Roihn/SABM

76 of 92

Sub-task 2

  • Agents choose target exit and direction to move, based on
    • Subjective feelings (panic, determined by agents)
    • Distance to the exit
    • Congestion (from field of view)

76

GPT-4 agents

□ space

■ wall

exit

https://github.com/Roihn/SABM

77 of 92

Sub-task 3 (Sparse)

  • With personas.
    • Physical: strong and weak.
    • Mental: strong and weak.

77

GPT-4 agents physically strong and mentally strong

GPT-4 agents physically strong but mentally weak

GPT-4 agents physically weak but mentally strong

GPT-4 agents physically weak and mentally weak

□ space

■ wall

exit

https://github.com/Roihn/SABM

78 of 92

Sub-task 3 (Dense)

  • Increase agent number from 100 to 400.
  • With personas.
    • Physical: strong and weak.
    • Mental: strong and weak.

78

GPT-4 agents physically strong and mentally strong

GPT-4 agents physically strong but mentally weak

GPT-4 agents physically weak but mentally strong

GPT-4 agents physically weak and mentally weak

□ space

■ wall

exit

https://github.com/Roihn/SABM

79 of 92

Sub-task 4 (Sparse)

  • With personas & conversation.
    • Agents may share information.
    • Agents may hear other agents speaking and then choose target exit.

79

GPT-4 agents physically strong and mentally strong

GPT-4 agents physically strong but mentally weak

GPT-4 agents physically weak but mentally strong

GPT-4 agents physically weak and mentally weak

□ space

■ wall

exit

https://github.com/Roihn/SABM

80 of 92

Escape Speed by Persona Groups

80

Sub-task 3 (sparse)

Without conversation: less balanced

Sub-task 4 (sparse)

With conversation: more balanced

https://github.com/Roihn/SABM

81 of 92

Conversation Example

81

Round 13

#6

#97

#35

#76

Receiving information

Speaking

Guys, I agree with heading to the right exit. It's the closest and least crowded. Let's stay calm and help each other out. We can do this!

#35

Hey everyone, let's head towards the right exit! It's much closer and not too crowded. Stay positive and strong, we'll get out quickly and safely!

#76

Hey all, suggest following the person towards the right exit. It's closer and manageable crowd. Stay positive and help each other! Let's escape safely!

#97

#6

Feeling anxious, but the right exit seems quickest. Let's stay strong, help each other, and escape safely together!

https://github.com/Roihn/SABM

82 of 92

Conversation Example (Continued)

82

Round 14

#6

#97

#35

#76

Receiving information

Speaking

#6

Feeling scared, but we need to stay calm. The right exit is closest but crowded. The left exit has fewer people but is farther. The bottom exit seems like a good balance. Let's go!

None (agents are out of range, not having chosen to speak, or speaking after Agent #6 has made her decision)

https://github.com/Roihn/SABM

83 of 92

Sub-task 4 (Obstacle)

  • With personas & conversation.
    • Agents may share information.
    • Agents may hear other agents speaking and then choose target exit.

83

GPT-4 agents physically strong and mentally strong

GPT-4 agents physically strong but mentally weak

GPT-4 agents physically weak but mentally strong

GPT-4 agents physically weak and mentally weak

□ space

■ wall

exit

obstacle

https://github.com/Roihn/SABM

84 of 92

Observations

84

Spontaneous collaboration through shared information

Faster and more balanced evacuation

No instance of disabled agents

Evacuation speed compromised by obstacles

Compare to the ABM simulation with pre-defined leader-follower relationship

https://github.com/Roihn/SABM

85 of 92

Model Validation

85

Prompt alteration

Original prompt

Paraphrased prompt

Intercardinal movement banned

In an art gallery looking

at paintings (in orange)

https://github.com/Roihn/SABM

86 of 92

Outline

86

Background

Methodology

Case Studies

Conclusions

https://github.com/Roihn/SABM

87 of 92

Conclusion

87

LLM-powered agents are smart!

We can use LLM-powered agents to simulate and study complex systems.

We proposed the framework of smart agent-based modeling (SABM).

We demonstrated the usefulness of SABM with three case studies.

https://github.com/Roihn/SABM

88 of 92

Lessons from Case Studies

88

It is important to create a fact sheet and outline expected outcomes before making model design.

Single-agent debugging is useful in tuning agents’ behavior.

More simulation runs are need for reproducibility.

The simulations yielded a total cost of around $10,200. Advancing AI technologies might help reduce the cost.

https://github.com/Roihn/SABM

89 of 92

Future Works

89

Methodology

Theoretical Foundations

Modeling and Simulation Software

    • Multimodal SABM
    • Memory
    • Knowledge specification
    • Hybrid modeling
    • HCI
    • Complexity theory
    • Analysis and comparison of SABM and ABM
    • IDE (cf. NetLogo for ABM)
    • Database (for memory & states)
    • Debugger

https://github.com/Roihn/SABM

90 of 92

Future Applications of SABM

90

Smart Agent-Based Modeling

Metaverse

Road Planning

Understanding AI

Humanities

Policy Making

Self-driving

https://github.com/Roihn/SABM

91 of 92

Simulated Civilization (Envisioned)

91

Language evolution with multimodal SABM

Start with basic vocabulary and see if they develop words like “self”, “feeling”, “mind”, and “consciousness”. 🡪 potential signal of self-awareness and consciousness of AI!

https://github.com/Roihn/SABM

92 of 92

Source Codes for Case Studies Released

92

https://github.com/Roihn/SABM