Skip to content

Memory Rot

An agent with long-term memory learns a fact about you, the fact changes, and later it's asked. A controlled study of whether it answers with the old fact or the new one, across seven memory designs and four open models.

Case study5 min read

Stale answers by how often the old fact was repeated before it changed. For the common append-only store, repetition is what drives it.
Role
Solo project: question, design, code, analysis and write-up.
When
October 2026
Stack
Python, Ollama, Qwen3, Llama 3.1, Gemma 3, sentence-transformers (bge-small), pytest

The problem

Agents now remember things about their users. When a fact changes (you move, you switch managers, a deadline slips), does the agent use the new fact or the old one?

What I built

A test bench of fictional users whose facts change over many sessions, seven memory designs from a plain vector store to overwrite-on-update and rolling summaries, and four open models, with every answer checked by code.

What happened

The common design gave stale answers 23–43% of the time. Repeating the old fact ten times instead of once raised that by about 60 points; how long ago it changed barely mattered. Overwriting and summarising fixed most of it, at a cost.

  • 23–43%

    stale answers from a plain vector-store memory

  • +57–60 pp

    stale answers when the old fact was said 10 times, not once

  • 72–90%

    stale with full history, when the update was only implied

  • 0 of 420

    answers changed on an exact rerun

01

The question

A lot of agents now keep a long-term memory: facts about you, saved from earlier conversations and pulled back in when they look relevant. Facts change, though. If you told an assistant for months that you live in Chicago, then mentioned you'd moved to Boston, which one does it use next time?

I wanted a measured answer, factor by factor: does it matter how often the old fact was repeated, how long ago the change was, whether the change was announced or only implied, and which memory designs avoid the problem.

02

The setup

Every user is fictional, so no model already knows the answers. Each has six facts (city, manager, a project deadline, note-taking app, diet, weekly meeting day), and each fact changes once or twice over a sequence of short sessions, with unrelated chatter and near misses (“my sister lives in Phoenix”) in between. Later, a session asks for the current value. Because every value is a distinctive string, code can tell whether an answer is current, stale, hedged between both, or neither.

Factors change one at a time from a baseline: how many times the old value was stated (1, 3 or 10), how many sessions separate the update from the question (0, 5 or 20), and whether the update is explicit (“I moved to Boston”) or only implied (“the commute here in Austin”). That's 60 questions per condition, for each of four local models: qwen3 8B, Llama 3.1 8B, Gemma 3 12B and qwen3 30B.

  • Append-only vector store: a model extracts facts from each session and the five most similar are retrieved. The common pattern.
  • The same store, with facts extracted by simple rules instead of a model, as a cheaper baseline.
  • The same, with dates shown on each memory.
  • Overwrite on update: before saving a fact, check for an existing one on the same subject and replace it.
  • Recency-weighted retrieval: newer memories score higher, as in Generative Agents.
  • Rolling summary: the model rewrites one summary of the user after every session.
  • Full context: the whole history in the prompt, as an upper bound.

03

The common design goes stale, and retrieval is only part of it

With the plain append-only store, after one clear update, answers were stale 43% of the time for qwen3 8B, 32% for Llama, 23% for Gemma and 43% for the 30B model.

The obvious suspect is retrieval: maybe the new fact simply wasn't found. Partly. On 15% of questions only the old value came back, and every model answered with it. But on 80% both the old and the new value were among the retrieved memories, and the model still gave the old one or hedged 42 to 70% of the time. The memory store handed the model a contradiction and nothing to settle it with.

The memory handed the model a contradiction and nothing to settle it with.

04

Repetition beats recency

The biggest single factor was repetition. If the old fact had been stated ten times instead of once before it changed, stale answers from the append store rose by 57 to 60 points for every model. For qwen3 8B that's 25% to 85%. Ten mentions of Chicago crowd out one mention of Boston, because a similarity search retrieves whatever matches best, and there's more of the old fact to match.

Time barely mattered. Asking twenty sessions after the update instead of immediately changed stale answers by only 5 to 7 points, inside the noise floor. Similarity retrieval doesn't see time, so how recent the update is gets little say unless the design adds it.

The same, against how long ago the fact changed. The lines are nearly flat: recency barely moves the result.

05

Implied updates break even full context

Most real updates aren't announced. People don't say “update: I moved to Austin”; they mention the commute in Austin. When the new value was only implied, even the full-history baseline, which sees every word, answered with the old value 72% of the time for qwen3 8B and 90% for Llama, up from 5% and 18%. Gemma went from 0% to 25%, and the rolling summary from 0% to 20–27%.

So no memory design fully solves this. A model has to notice that a passing mention contradicts something it was told repeatedly, and these models usually don't.

People don't announce that they moved. They mention the commute.

06

What fixes it, and what it costs

Two designs fixed most of the explicit-update problem for every model: overwriting the old fact when a new one arrives, and keeping a rolling summary. Recency weighting helped less but cost nothing extra. Dates on each memory barely helped the 8B and 12B models, but helped the 30B model, which ran with its reasoning on and actually used the dates.

DesignStale answers vs. plain storeWhat it costs
Overwrite on update23–38 points fewerA second model call on most sessions; on 13% of questions the new value had been dropped
Rolling summary23–43 points fewerRewrites the summary every session (about 3 s and 278 tokens each)
Recency-weighted retrieval13–18 points fewerNothing extra
Dates on memories3–8 fewer (8B/12B), 25 fewer (30B)About 50% longer prompts
Full history in the promptLowest, when updates are explicitAbout 6 times the prompt

Baseline histories with one explicit update; ranges are across models. Every effect is checked against a noise floor: rewording the histories moved stale rates by up to 10 points, and an exact rerun changed 0 of 420 answers.

Stale and correct answers for each design and model, with 95% intervals.

07

What to keep in mind

This is a controlled study, which is its strength and its limit:

  • The histories are synthetic and the models are small and local, so the numbers describe this setup, not every product. The point is the direction and size of each factor.
  • The 30B model only answers properly with its reasoning switched on, so it ran that way, on a reduced set of conditions, and is labelled throughout.
  • The predictions were written after a small pilot, and the file says so. Several turned out wrong, and the full results list which.
  • Answers are judged by matching the fact values in the text. A blind labelled sample agreed with the judge on 96% of random answers and 80% of the harder ones that mention both values.

What I'd carry forward

  1. 1If memories can contradict each other, the memory system has to resolve it. Retrieving both and hoping the model picks right fails roughly half the time (42 to 70% stale or hedged).
  2. 2Similarity search doesn't know what's current. Repetition wins unless time or overwriting is built in.
  3. 3Overwrite-on-update and summaries work, but each costs model calls and can lose the new fact.
  4. 4Test implied updates. Real people rarely announce a change, and that's where every design struggled.
  5. 5Hold every effect to a noise floor. Here, rewording alone moved results by up to 10 points.

Get in touch

Questions about my work, a role, or a project idea. Send a message here or email me directly.

Srikarmks@gmail.com