Skip to content
AI Memory Benchmark

Guide

What is an AI memory layer, and when does an agent need one?

A memory layer is the part of an agent system that decides what to keep from past interactions and what to hand back to the model later. It exists because a model only knows what is in its prompt, and prompts are finite, paid for per token, and less reliable as they fill.

Updated

What it does

Every memory layer does three jobs, whatever it calls them:

  • Write. Take in conversations, documents or events and decide what is worth storing: raw text, extracted facts, summaries, or all three.
  • Maintain. Reconcile new information with old. People change jobs, plans and preferences; a store that only appends will confidently return the stale answer.
  • Read. Given the current task, return the small set of items that matter, ideally with dates and sources attached.

The main designs

Fact extraction into a vector store

A model pulls discrete facts out of each interaction, embeds them and stores them for similarity search. Mem0 is the best-known example. It is simple and cheap to query; its weakness is anything that depends on relationships between facts or on time.

Temporal knowledge graphs

Facts become edges between entities, each with a validity period, so the system can say what was true when. Zep, through its open-source Graphiti library, and Cognee take this route.

Self-editing agent memory

The agent itself decides what to write to and read from its memory, using tools. Letta, formerly MemGPT, established the pattern; Anthropic's memory tool is a file-based version of the same idea.

Observation logs

Background agents compress the running conversation into a dense log of observations that stays in the prompt. Mastra's Observational Memory works this way.

Hybrid retrieval over structured facts

Several newer systems extract typed facts and then search them several ways at once (semantic, keyword, graph, temporal) before reranking. Hindsight describes this design in its paper.

Plain files

Store the transcripts as files and let the agent search them with ordinary tools. Letta showed this scoring 74.0 on LoCoMo with GPT-4o-mini, above purpose-built systems of the time, which says as much about that benchmark as about files.

Do you need one, or just a bigger prompt?

With 1M-token windows now standard on flagship models, the honest first question is whether the history fits. If a user's entire history is a few tens of thousands of tokens and you answer occasionally, sending all of it may be the right design. A memory layer earns its place when at least one of these is true:

  • The history is, or will become, larger than the window.
  • You answer often enough that resending the history on every call dominates your bill or your latency.
  • Facts change over time and the model must know which version is current.
  • Different people are allowed to see different parts of the history.
  • The agent has to act on what it knows without being asked a question that points at the right fact.

That list is also a guide to which benchmarks to read. Size is tested by BEAM's 10M tier, acting without a cue and cost by DolphinBench, and knowledge updates by parts of BEAM and LongMemEval. Access control is not tested by any public benchmark we know of.

Questions people ask

What is the difference between a memory layer and RAG?

Retrieval-augmented generation searches a mostly static body of documents. A memory layer handles a history that keeps changing: it decides what to store from each interaction, updates or retires facts as they change, and tracks when things were true. Most memory layers use retrieval internally, but the writing and maintaining steps are what distinguish them.

Is a 1M-token context window enough instead of a memory layer?

Sometimes. If the whole history fits comfortably and you query it rarely, a large prompt can be the simplest correct design. It stops being enough when the history outgrows the window, when the per-call cost of resending it adds up, or when the model needs to know which of several conflicting facts is current.