Discovering Effective Agent Memory Designs through Program Evolution: what it means for business leaders
An LLM-driven search writes whole agent memory programs from near-empty seeds, and the designs it finds beat five hand-built memory systems on two benchmarks while costing less to serve.
1. What the method is
MAPE is a framework that uses LLM-driven evolutionary search to write whole agent memory programs instead of tuning parts of an existing one. Every candidate implements the same lifecycle interface: build a persistent store from the conversation history, retrieve evidence for a query, compose that evidence into a context, and hand it to a fixed answering model. Search starts from minimal seeds, such as a program that stores nothing, and runs in two modes. MAPE-A optimizes answer accuracy alone; MAPE-P treats accuracy and token serving cost as separate objectives and works from their Pareto frontier. The output is four evolved memory systems, one per benchmark and objective, plus two design patterns the authors isolate and test: keeping raw conversation as retrievable evidence, and a composition module called Query-Routed Scaffolding that prepares evidence according to the type of question.
2. Why the method was developed
Agent memory systems such as Mem0, Zep, A-Mem, LightMem and SimpleMem turn interaction history into extracted facts, notes or graphs, and their designs come from human judgment about what to keep and how to retrieve it. Earlier automated work evolved prompts, configurations or pipelines, but usually within a restricted set of components or starting from an established architecture, and it optimized accuracy with little attention to what the result costs to run. The authors wanted to know what a search would build with no architecture to anchor on, and how the objective changes the answer. Tracking serving cost across the lifecycle also exposes a question that matters commercially: whether LLM calls are better spent building memory up front or processing evidence when a question arrives. Their error analysis of the hand-built systems points to incomplete retrieved evidence as a major source of wrong answers.
3. Who should care
Engineering teams that build assistants, support agents or any product that must remember users across sessions are the direct audience, because the paper gives two concrete changes to test against whatever memory layer we run today. Whoever owns inference spend should read the cost tables: the same accuracy tier is reached at very different prices depending on where the LLM calls sit, and several commercial memory products were far more expensive than plain retrieval on one benchmark. Procurement and architecture leads evaluating a memory vendor get a sharper question to ask, namely whether the product keeps the original conversation retrievable or only its own extracted facts. Product owners should note the failure types addressed, dates and counting, which are the errors users notice. Teams running evaluation get a reusable protocol: a common interface, a held-out set, and per-stage cost accounting.
4. How the method works
Each iteration, a proposer agent reads the archive of earlier programs, their scores and diagnoses, picks parents, and writes a new candidate with a stated hypothesis. The candidate gets a small sanity run, with up to two repairs, then a full run on the search set. A separate diagnosis agent reads the traces and records likely causes of failure for later proposals. Every candidate stays in the archive, including dominated ones. Runs last 20 steps, with Claude Opus 4.8 as proposer and diagnoser. The representative accuracy-only system extracts atomic notes per session, keeps raw conversation rounds, indexes both densely and lexically, fuses rankings with reciprocal rank fusion, and returns note bundles plus up to five raw rounds. Its composition stage routes each query by intent to a scaffold that pairs LLM extraction with deterministic code, such as date arithmetic or programmatic counting, then drafts an answer for the fixed answering model.
5. How it was evaluated
The benchmarks are LoCoMo and LongMemEval-S, both conversational question answering, each split 20% for search and 80% for evaluation: two LoCoMo conversations with 233 questions for search and eight with 1,307 for evaluation, and 100 against 400 LongMemEval instances. Baselines are full-context prompting, embedding RAG over the top ten messages, and Mem0, A-Mem, LightMem, SimpleMem and Zep connected through adapters. Serving models are GPT-4.1 mini and a locally hosted Qwen3 30B model, with text-embedding-3-small for embeddings and GPT-5 mini as the correctness judge. Cost is tokens across all four stages at list prices, amortized per query and reported per 1,000 queries; it leaves out search cost, local compute, storage and latency. The authors also test transfer across backbones and benchmarks without further evolution, ablate the two patterns, and transplant the composition module into the five baselines. One caveat: the evaluation set is also used to choose the final program from a shortlist.
6. How it performed
On LoCoMo with GPT-4.1 mini the accuracy-only program reaches 87.94% at $7.21 per 1,000 queries and the cost-aware one 85.18% at $2.03, against 80.87% for full context at $12.54. On LongMemEval they reach 77.00% and 72.25% against 66.00% for RAG, the best baseline. Moved to Qwen, the cost-aware LoCoMo program scores 81.33%, 12 points above SimpleMem at 35% of its cost, while the accuracy-only one falls to 43.80% on temporal questions. Dropping raw rounds costs 12.17 and 6.50 points; dropping the scaffolding 4.44 and 6.25; transplanting it lifts all five baselines by 2.75 to 9.25 points. Limits: LoCoMo-evolved programs moved to LongMemEval land just under RAG, runs vary, selection involved manual judgment, and only two conversational benchmarks are covered. Our call is to pilot: test raw-evidence retention and query-routed composition on our own memory stack before considering the search itself. (Source: arXiv 2611.17068, 2026)
← Back to dossier index