TL;DR
MemForest is a novel, general-purpose memory compression framework designed to prevent the storage and retrieval bottlenecks that plague long-term LLM agents. By partitioning historical memory into event-centric maximum spanning trees ("EventTrees") using both semantic similarity and temporal continuity, it progressively merges redundant information using an LLM. The framework retains up to 99.7% of an agent's original performance at a 50% memory compression ratio while accelerating retrieval speeds by up to 2.24×.
What Problem Does This Paper Address?
As AI agents are deployed in long-horizon tasks like multi-turn dialogue, personalized assistance, and video understanding, they continuously accumulate historical interactions as external memory. However, this unconstrained growth creates a massive bottleneck: storage costs skyrocket, and retrieval latency degrades significantly over time.
Existing memory management techniques fall short. Simple token-pruning or similarity-based dropping methods often discard dense, highly critical textual context. Meanwhile, more advanced post-processing compression methods are typically tailored to specific graph structures or restricted to streaming video scenarios. The challenge lies in designing a general, scalable memory compression framework that reduces size without sacrificing the rich temporal and semantic relationships inherent in an agent's history.
Methods
MemForest introduces a three-step pipeline to partition, compress, and accurately retrieve agent memories:
- EventTree Semantic-Temporal Partitioning: The authors observe that memory events exhibit two key features: global semantic similarity (similar ideas recurring across distant time windows) and local temporal continuity (adjacent memories belonging to the same event despite semantic differences). MemForest combines these properties by first using KMeans clustering to establish initial event units, and then refining them using a dual-score fusion that accounts for both embedding similarity and temporal proximity.
- EventTree Progressive Merging: Each partitioned event unit is modeled as a fully connected graph, from which a maximum spanning tree (the EventTree) is constructed using Kruskal's algorithm. To protect core information, edge weights are adjusted to penalize the merging of high-degree "hub" nodes. The framework then iteratively selects the highest-weight edges and leverages a lightweight LLM (GPT-4o-mini) to synthesize the two connected memory nodes into a single, concise summary node until the target compression ratio is achieved.
- Anchor-Guided Propagation Retrieval (AGPR): To compensate for any structural information degraded during compression, AGPR dynamically enhances retrieval. It identifies the top candidate nodes most similar to a query, designates the absolute closest nodes as "anchors," and propagates relevance scores to their temporal neighbors, ensuring contextually rich memory retrieval.
Datasets
The authors evaluated MemForest across both unimodal (text-only) and multimodal (video/robotics) agent frameworks using five established benchmarks:
- Unimodal (Mem0 framework): Evaluated on LoCoMo (long-term conversation modeling), LongMemEval (long-term interactive chat assistants), and PersonaMem (dynamic user profiling and personalized responses).
- Multimodal (M3-Agent framework): Evaluated on M3-Bench-robot (first-person robot environment interactions) and M3-Bench-web (multimodal online video understanding).
Key Insights and Ideas
- The Dual-Score Imperative: Relying solely on semantic similarity fails to capture adjacent, structurally different nodes belonging to the same event. Conversely, relying solely on temporal windows fails when an event recurs much later. Fusing both is essential for clean event segmentation.
- Node Degree as an Importance Metric: In an EventTree, nodes with higher degrees act as structural hubs. By explicitly protecting these hubs from premature merging, MemForest preserves the core narrative anchor of an event.
- Contextual Healing via AGPR: Compression naturally smooths out details. AGPR acts as a mechanism to "heal" this loss during inference by pulling in the temporal neighborhoods of key recalled memories, proving that smart retrieval can offset aggressive compression.
Key Results
MemForest consistently outperformed standard pruning (Random, KMeans, DART, StreamMeCo) and merging (ToMe) baselines across varying compression ratios:
- Unimodal Performance: At a 50% compression ratio under the Mem0 framework, MemForest preserved 97.1% of the original uncompressed performance while delivering a 1.89× retrieval speedup.
- Multimodal Performance: Under the M3-Agent framework at 50% compression, it retained an astonishing 99.7% of original performance and achieved a 2.24× retrieval speedup.
Even under an aggressive 70% compression ratio, MemForest maintained high query relevance, demonstrating robust stability compared to pruning methods which suffered severe performance drops.
Limitations and Future Work
While highly effective, MemForest faces pronounced performance degradation when applied to low-redundancy textual frameworks at extreme compression rates (e.g., dropping to 93.3% accuracy at a 70% compression ratio on Mem0).
The authors outline several promising directions for future research:
- Designing specialized compression algorithms tailored specifically for low-redundancy textual memory.
- Training dedicated, compact, open-source models optimized purely for memory node merging to eliminate reliance on commercial LLM APIs.
- Optimizing retrieval mechanisms to minimize heavy embedding similarity computations, further boosting speed.
- Integrating holistic safety analyses to automatically detect, correct, or purge corrupted or conflicting historical memory entries.
Summary updated