How to Create Illusions of Consciousness in Large Language Models? A Close Reading of Stanford AI Town Paper
Close Reading of the Stanford AI Town Paper: Generative Agents: Interactive Simulacra of Human Behavior
September 5, 2023 • 8 min read
Architectural Facade Perpetual Motion Machine and Controller — Original Paper Explanation
by Simon Meng, mp.weixin.qq.com • See original
When I first saw the Stanford AI Town paper “Generative Agents: Interactive Simulacra of Human Behavior” (Park et al., 2023), I was truly shocked 🥹—the idea that we could manipulate 25 intelligent agent proxies (Agents) using prompt magic to simulate a mini-Westworld is incredible. So, after the code was released a few days ago, I went through it alongside the paper and felt both surprised and understanding at the same time. Here, I would like to share my notes and answer some questions you might find interesting. You can also download the original paper with my annotations at the end! 🤗
My Summary:
Stanford University has shown that, without modifying the large language model (the experiment used GPT-3.5), by using an external memory database and game map, along with clever prompt decomposition, the Agents (NPCs/intelligent agents) in the AI Town can exhibit social behaviors similar to real humans (time planning, action decision-making, participation in social activities, etc.). Although this does not actually prove that models like GPT possess “consciousness” (many of the Agents’ “choices” are made under strict constraints; every time Agents take action, they are simply responding to a streamlined prompt), it demonstrates that the capabilities of LLMs (large language models) can be transferred to complex tasks, including “social” interactions, and provides a foundational model framework for conducting social experiments based on language rather than quantification.

Answering Common Questions
How do Agents store and retrieve long-term memory?
- Memory Storage Method: Stored in an external database in JSON format.
- How Memory is Retrieved: When recalling memory, three weights are considered: Recency, Importance, and Relevance.
- –Recency: Memories closer to the current time have higher recency.
- –Importance: Higher entropy (content not overlapping with other memories, non-routine behavior) increases importance.
- –Relevance: Evaluates the semantic embedding relevance between the current dialogue and stored memories.
- Memory Storage Format: The basic storage unit in the memory stream is a “node,” each containing a natural language description and timestamps for when it was created and last retrieved. Details can be found in the nodes.json file in each character’s folder. An example of an object file format is as follows:
– Below is an event node:
"node_910": {
"node_count": 910,
"type_count": 761,
"type": "event",
"depth": 0,
"created": "2023-02-13 21:11:10",
"expiration": null,
"subject": "the Ville:Isabella Rodriguez's apartment:main room:bed",
"predicate": "is",
"object": "idle",
"description": "bed is idle",
"embedding_key": "bed is idle",
"poignancy": 1,
"keywords": ["idle", "bed"],
"filling": []
}
– Below is a thought (planning) node:
{
"node_912": {
"node_count": 912,
"type_count": 146,
"type": "thought",
"depth": 1,
"created": "2023-02-14 00:00:00",
"expiration": "2023-03-16 00:00:00",
"subject": "Isabella Rodriguez",
"predicate": "plan",
"object": "Tuesday February 14",
"description": "This is Isabella Rodriguez's plan for Tuesday February 14: wake up and complete the morning routine at 6:00 am, open Hobbs Cafe at 8:00 am, have lunch with her staff at 12:00 pm, attend to guests at the cafe from 8:00 am to 8:00 pm, take a long walk after closing the cafe at 8:00 pm.",
"embedding_key": "This is Isabella Rodriguez's plan for Tuesday February 14: wake up and complete the morning routine at 6:00 am, open Hobbs Cafe at 8:00 am, have lunch with her staff at 12:00 pm, attend to guests at the cafe from 8:00 am to 8:00 pm, take a long walk after closing the cafe at 8:00 pm.",
"poignancy": 5,
"keywords": ["plan"],
"filling": null
}
}
How do Agents locate and move in the map?
- Route Calculation: Initially, I thought GPT could fully understand spatial coordinates, allowing Agents to specify their desired coordinates when outputting. However, I realized I was mistaken 😂. In fact, Agents only indicate the destination name in their output, such as “cafe,” and the actual movement path on the screen is entirely navigated and rendered automatically by the sandbox game engine.
- Map Storage: The map information is stored in a JSON file using a tree structure, as shown in the image below:

- Map Information Converted to Prompt: When an agent needs to decide whether to move to another area, they are informed of their current location, the areas included in their current location, and the areas they can move to, followed by a dialogue scenario for the agent to make a choice, as shown below:
[Agent’s Summary Description]
Eddy Lin is currently in The Lin family’s house: Eddy Lin’s bedroom: desk) that has Mei and John Lin’s bedroom, Eddy Lin’s bedroom, common room, kitchen, bathroom, and garden. Eddy Lin knows of the following areas: The Lin family’s house, Johnson Park, Harvey Oak Supply Store, The Willows Market and Pharmacy, Hobbs Cafe, The Rose and Crown Pub. * Prefer to stay in the current area if the activity can be done there. Eddy Lin is planning to take a short walk around his workspace. Which area should Eddy Lin go to?
How do Agents interact with other Agents and the environment?
- The environment itself can be slightly altered by the agents’ actions; for example, a restroom can be occupied, and a kitchen stove can be turned on or off, and pipes can leak.
- Interactions between agents are determined by the sandbox game engine, and when the distance between two agents on the map is below a certain threshold, there is a high probability of triggering dialogue, which occurs through natural language interaction.
How do Agents make decisions?
- Observation: Observational behavior includes both observing and storing the observed content in memory. Observed objects generally include the agents’ own thoughts, behaviors of other agents in spatial and temporal overlap on the map, and the states of non-agent objects on the map. Here are some examples of observable content:
“(1) Isabella Rodriguez is setting out the pastries, (2) Maria Lopez is studying for a Chemistry test while drinking coffee, (3) Isabella Rodriguez and Maria Lopez are conversing about planning a Valentine’s day party at Hobbs Cafe, (4) The refrigerator is empty.” (Park et al., 2023, p. 8)
- Planning: Describes a sequence of activities the agent plans to undertake in the future, including location and start/end times. Plans are also stored in long-term memory, can be synchronously retrieved, and modified. Plans are generated recursively from broad to detailed: first, give the LLM a character description and an initial time frame for a plan, then let the LLM complete each hour; then recursively feed the LLM again to fill in the details for each hour. Here’s an example of driving the LLM to plan for an agent:
“Name: Eddy Lin (age: 19)
Innate traits: friendly, outgoing, hospitable Eddy Lin is a student at Oak Hill College studying music theory and composition. He loves to explore different musical styles and is always looking for ways to expand his knowledge. Eddy Lin is working on a composition project for his college class. He is taking classes to learn more about music theory. Eddy Lin is excited about the new composition he is working on but he wants to dedicate more hours in the day to work on it in the coming days On Tuesday February 12, Eddy 1) woke up and completed the morning routine at 7:00 am, [. . . ] 6) got ready to sleep around 10 pm.
Today is Wednesday February 13. Here is Eddy’s plan today in broad strokes: 1)”
- Reflection: Agents perceive the world and store memories, deciding whether to change their original plans and react based on their memories. Below is a prompt case illustrating how an agent simulates its reaction when encountering another agent:
“John Lin’s status:
John is back home early from work.
Observation: John saw Eddy taking a short walk around his workplace.
Summary of relevant context from John’s memory: Eddy Lin is John’s Lin’s son. Eddy Lin has been working on a music composition for his class.