IN THIS BREAKDOWN · 10 SECTIONS
You can read 22% of this breakdown.
The paper in one minute
Joon Sung Park, Michael Bernstein, Percy Liang and colleagues at Stanford and Google built Smallville, a small town in a sprite-based sandbox populated by 25 agents, each described by a paragraph of identity and relationships, all driven by gpt-3.5-turbo. Users can watch them, talk to them, or change their environment. The paper, presented at UIST 2023, is about the architecture that keeps those agents coherent over days, not just over a single reply.
The center is the memory stream: every observation an agent makes ("Isabella is setting out pastries", "the desk is unoccupied") is stored as a natural-language record with a timestamp. To decide what to put in the prompt, the agent retrieves memories by scoring each one on three things: recency, an exponential decay of 0.995 per game hour since the memory was last used; importance, a 1 to 10 poignancy rating the model assigns when the memory is created (brushing teeth is a 1, a breakup a 10); and relevance, the cosine similarity of the memory's embedding to the current query. Each component is scaled to the range 0 to 1 across candidates and the three are added with equal weight.
Two further mechanisms make the agents seem to think. Reflection runs when the summed importance of recent events passes 150, about two or three times a day: the model reads the 100 most recent memories, asks itself the three most salient questions it could answer, retrieves evidence for each, and writes five insights, with citations to the memories behind them, back into the stream. Reflections can build on other reflections, forming trees. Planning writes a day's agenda in five to eight broad chunks, then decomposes it into hour-long and then 5 to 15 minute actions, also stored in the stream, and re-plans when something happens.
In an evaluation, 100 people ranked agents' answers to interview questions for believability; the full architecture won, and removing reflection, then planning, then memory each made agents less believable. In the two-day simulation, news of a mayoral candidacy and a Valentine's Day party spread through conversations, relationships formed, and five agents turned up at the party.
Research notes: the problem, approach and results
TrueSkill believability of the full architecture against no memory, reflection or planning
agents who knew about Isabella's Valentine's Day party, from 1 to 13 of 25, with no user intervention
summed importance of recent events that triggers a reflection; agents reflected two or three times a day
Language models can produce a plausible response for a moment, but a character built on them forgets what it did an hour ago, eats lunch three times, and cannot draw conclusions from its own experience. Believable behavior over days needs memory and planning.
Store every observation as a timestamped sentence in a memory stream. Retrieve by recency, model-rated importance and embedding relevance. When enough important things happen, reflect: ask what can be concluded and store the answers. Plan the day in broad strokes, then refine to minutes.
In a ranking study with 100 people, the full architecture was judged most believable and each removed component lowered the rating. In a two-day simulation of 25 agents, a party invitation spread from one agent to 13 and 5 of 12 invitees showed up.
Why it matters to an FDE
You are unlikely to build a simulated town for a customer. You will build assistants and agents that remember interactions, and this paper's three-part retrieval score and its reflection step are the patterns most memory systems still use.
Retrieval is more than similarity. Recency and importance matter for memory in a way they do not for document search. A support agent should weigh last week's escalation above a routine ticket from last year, even when both match the query.
The weights decide behavior. Equal weights after min-max scaling can let a dramatic but irrelevant memory crowd out the relevant one. Our simulation below shows how easily it happens. Tune the weights on the customer's own questions.
Reflection is summarization with provenance. Writing conclusions back into memory, with references to the observations behind them, is a good way to keep long histories usable. Keep the citations so conclusions can be checked and corrected.
Cost scales with every agent and every step. Twenty-five agents for two game days cost thousands of dollars in tokens and took days to run. Budget memory operations per user before promising "remembers everything".
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 99 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦2 results tables
- ?5 interview questions with answers
- 03Key takeaways
The architecture's parts, the evaluation design, the emergent behavior, and misreadings to avoid
Free account - 04How it works
The memory record, the scoring formula, the reflection and planning prompts, and the sandbox loop
Premium - 05The numbers that matter
The ranking study, the emergent measures, the failure modes and the cost
Premium - 06Try it yourself
The retrieval score on a synthetic memory stream: decay, scaling, weights, reflections
Premium - 07Where it breaks
The limits the authors report and the ones in the evaluation design
Premium - 08Using it on a deployment
Applying memory streams, scored retrieval and reflection to a customer assistant
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
