MemFolder improves agent memory efficiency by folding records and context

MemFolder: Structure-Guided Memory Folding for Efficient Agent Memory Management

Computation and LanguageComputer Vision and Pattern Recognition

Summary

Long-running AI agents keep growing memory stores as they interact, which slows down how fast they can find and use information. The authors introduce MemFolder, which smartly groups related memory records, making them fewer and shorter without losing important details. It uses structure like entities mentioned and timing to fold and compress memories in two steps, keeping key facts easy to retrieve. Their tests show MemFolder keeps most of the original performance while cutting memory size in half.

What this means in practice

  • For conversational ai developers: Reduce the size and speed up retrieval of long-term agent memories while preserving most of the useful information they contain.
  • For robotics system engineers: Improve memory management in robots by folding long interaction histories to enable faster decision-making with limited computation.

Authors

Xuyang Liu, Chenwen Lu, Junxi Wang, Siyu Ren, Xinying Lin, Siteng Huang, Hongli Sun, Linfeng Zhang, Honggang Chen

Abstract

Long-term agents accumulate large external memory stores as interactions unfold, increasing the costs of storage, retrieval, and response generation. Efficiency is constrained by two coupled factors: a growing record count increases retrieval overhead, while longer retrieved contexts increase prefill computation and decoding-time attention costs. Existing methods prune or consolidate records, but pruning can discard useful evidence, whereas consolidation may produce fewer yet longer retrieval units. We introduce MemFolder, a structure-guided memory folding framework that sequentially reduces record count and context length. The framework comprises two core components that share memory groups, using cross-record structure to guide both evidence consolidation and compact representation. RecordFolder grounds entity mentions, progressively selects representative yet complementary anchors, and combines semantic and entity affinity with temporal chaining to consolidate compatible records into fewer retrieval units. ContextFolder encodes the original records within these groups into compact text and uses verification feedback to revise encodings when key facts cannot be recovered. Experiments on the three text-based memory benchmarks LoCoMo, PersonaMem, and LongMemEval and the two multimodal benchmarks M3-Bench-web and M3-Bench-robot demonstrate the strong performance of our methods. Notably, on Mem0, RecordFolder retains 99.0% of the original average performance across the three text-based benchmarks with 50% fewer records, exceeding the strongest baseline by 1.9 percentage points in performance retention. Combined with ContextFolder, existing record compression methods further shorten their output records while retaining most of their performance.