AI in the Wild: A ChatGPT Simulated Town 🤖🔥
Tags: ai, machinelearning, computerscience, chatgpt
Published: 2024-01-08 12:32:38

Have you heard about a village where all its citizens are controlled by <u>artificial intelligence</u>? It sounds like a great movie plot, but it's not fiction—it's a study done a few months ago that I just discovered and felt compelled to share in this article.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/MKorKFj0Muz4P0CI7D/giphy.gif">

## The study
Named "Generative Agents: Interactive Simulacra of Human Behavior", this study, led by Google and Stanford researchers, involved <u>25 ChatGPT agents</u> playing a game where each one assumed the role of a character in a simulated town. The agents were provided with simple descriptions, including their occupation and relationships with other agents, essentially receiving a <u>snapshot of their past</u> memories and motivations.

> Generative agents wake up, cook breakfast, and head to work; artists paint, while authors write; they form opinions, notice each other, and initiate conversations; they remember and reflect on days past as they plan the next day.

A <u>memory system</u> also was implemented, so all the experiences "lived" by the agents were stored in their own memory. For instance, when an agent named Eddy was telling his father, John, about his homework, John stored that information so later when the kid was off to school and his wife asked about their son, John knew that Eddy was excited with the music that he was composing as a homework and was able to share that.

![Simulated Town and Agents interacting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zx60b2d6s5v5k63a30g.png)

## What happened
Some interesting things happened during the study, such as:
- Each agent <u>created their own routine</u> without specific instructions given, just based on their histories, including daily activities as brushing teeth, taking shower and catching up with other agents.
- One of the agents was given the intent, in their history, to throw a Valentine's Day party. After proposing the event to other agents, they <u>autonomously spread invitations</u> to the party and even the ones that weren't invited by the host got to know about the event trough others, mirroring real-life information flow in a city;
- At the Valentine's Day party, guests and the host coordinated to schedule their arrival, showcasing a level of <u>collaboration</u> akin to real-world social dynamics.
- Another example of information diffusion was the fact that a mayoral election was happening and agents that weren't aware of that got information from other agents and were even capable of discussing about the election later.
- The agents were <u>reflecting</u> about themselves and what matters to them. One for instance, from his own observations, was able to "understand" how dedicated he is to research activities.

<figure>
![Information Diffusion about the Valentine's Day party](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzhyrfpdckn2zd39e5ry.png)
<figcaption>Valentine's Day Party Information Diffusion</figcaption>
</figure>

## AIs more human than... Humans?
A controlled evaluation tested whether ChatGPT agents could exhibit believable human behavior based on their environment and experiences.
As the agents responds to natural language question they were basically "interviewed" to <u>assess five human abilities</u>: maintaining self-knowledge, retrieving memory, generating plans, reacting, and reflecting.

A group of 25 humans watched full replays of the simulation, each following one agent while inspecting the corresponding agent memory data. These individuals were then interviewed, roleplaying as the selected agent. In the final evaluation, other human assessors were invited to rank the scenarios by believability. The result was striking—<u>ChatGPT proved more convincing</u> at roleplaying a human than an actual human, perhaps not surprising at this point.

<figure>
![Study Evaluation Results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mw2vctiyx6rdctsntti3.png)
<figcaption>Scenarios removing agents capabilities of Plan, Reflection and Observation were also ranked</figcaption>
</figure>

## Glitch in the Matrix
ChatGPT is amazing, we already know that, but the agents presented some behaviors that weren't expected by the researchers:
- Some agents failed to absorb information adequately, occasionally retrieving <u>incomplete memory fragments</u> during interviews;
- The stores at the simulated town closes at 5 p.m. but a few agents enter the stores after closing hours, misunderstanding the shop's operating hours.
- Even do the Bar was supposed to be a place to go later on the day, some agents during the simulation preferred to have lunch there instead of the café.

## My thoughts
This kind of study are really interesting to me, I don't work directly with AI or machine learning but it's a field that makes me reflect a lot.
And honestly, this is impressive, looking how human an artificial intelligence can get. Even the presented "errors" from the agents sounds a lot like a human to me... Who doesn't forget information that they should know? Who doesn't go to a store just to find out it's closed? And who has never grab a beer earlier than they should?

This makes me think, <u>how far artificial intelligence will go</u>? Perhaps in the near future, video games will feature NPCs (non-playable characters) entirely controlled by AIs, free from predetermined scripts, offering an immersive experience beyond our current imagination.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMDEzc2RldHEzMGFrbWw4MDM4OWwxMHhrMWVlZmc0dThoa3dzdWhmdCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/gLKVCVdLUXMTeIs6MD/giphy.gif">

I would love to hear your thoughts on the matter, what implications do you think this study could lead to?

---

_If you are interested in delving deeper into the research paper, [click here](https://github.com/joonspk-research/generative_agents) to access the official GitHub, where you can find the complete study and instructions to replicate the simulation._