Evolving programs improves agent memory accuracy and efficiency

Discovering Effective Agent Memory Designs through Program Evolution

Computation and LanguageArtificial Intelligence

Summary

Remembering details well is important for AI agents, but designing how they store and use memory can be tricky. The authors created a system called MAPE that automatically evolves memory programs to improve how agents remember and answer questions. This method found better memory designs that keep raw conversations and organize evidence smartly, which made AI answers more accurate and cheaper to get. Their findings also helped improve existing memory systems by adding better ways to combine information.

What this means in practice

  • For ai system developers: Build AI systems with improved memory modules that increase answer accuracy while reducing computational costs.
  • For conversational ai teams: Enhance chatbot memory management by integrating evolved composition methods to better handle and recall conversations.

Authors

Xinheng Ding, Seyyed Saeid Cheshmi, Ziyang Zhang, Tairan Chen, Wenya Xie, Yu Hou, Rui Zhang, Zirui Liu

Abstract

Program evolution provides a promising approach to discover agent memory designs and study the choices underlying their effectiveness. We introduce MAPE, a framework that evolves whole memory programs from minimal seeds through a standardized lifecycle interface and an iterative diagnosis-proposal loop. Experiments on LoCoMo and LongMemEval yield an absolute accuracy gain of up to 12% over manually designed baselines at 35% of the serving cost, with further evaluations supporting transfer across serving backbones and benchmarks. Empirical analyses and ablations identify and validate two recurring design patterns: retaining raw conversations as retrievable evidence preserves details omitted from extracted memories, while composing retrieved evidence according to query intent helps the answering model use it effectively. Transplanting the composition module into five existing memory systems improves accuracy across all five. Beyond these patterns, the search objective shapes where computation goes: optimizing serving cost alongside accuracy shifts computation from LLM-based memory construction to selective processing at query time while retaining competitive accuracy. Together, these findings offer empirical lessons for agent memory design. Code is available at https://github.com/ash-ding/MAPE.