LeanMem is a lightweight long-term memory framework for LLM Agents that stores and maintains heterogeneous conversational content differentially according to compressibility, temporal dynamics, and fidelity requirements, achieving accuracy gains while reducing token consumption on public long-term conversational QA benchmarks.
The long-term memory module of an LLM Agent must manage massive, heterogeneous historical conversation content. Existing mainstream memory systems commonly process all conversation content through a unified summarization and retrieval pipeline. This indiscriminate processing mechanism causes two negative outcomes that are hard to reconcile: either retaining enough detail leads to excessive token consumption, or compressing volume causes irreversible loss of fine-grained evidence.
To address this common design gap, related research proposes that different historical conversation content inherently has different compressibility, temporal dynamics characteristics, and fidelity requirements, and should not be pushed through the same pipeline for indiscriminate processing. This judgment forms the core design premise of the differentiated long-term memory processing framework.
The framework's overall architecture consists of four functional modules connected in series, covering the full life cycle of memory from input to query response: the first module performs topic segmentation, filtering key statements and grouping them into topically coherent segments; the second module is controlled memory write routing, which dispatches segments to one of three storage partitions—profile memory, event memory, or record memory—based on their compression needs, temporal attributes, and fidelity requirements; the third module implements selective memory evolution, buffering and incrementally updating event memory via localized offline merge operations; the fourth module performs adaptive evidence synthesis, planning retrieval paths and assembling sufficient supporting evidence under query-triggered resource budget constraints. You can use the architecture diagram to intuitively understand the division of labor among the four modules and the complete processing chain.
LeanMem uses a three-stage pipeline for full-process memory handling; the first stage is controlled memory writing. After a conversation segment is input, the framework first determines whether the segment needs to enter the memory system; segments with low informational value are directly ignored, avoiding unnecessary construction overhead. For segments judged useful, a lightweight scheduler first completes information type classification, assigning suitable storage strategies to different content categories: stable user attributes and preferences are compressed and stored as profile memory, state-changing information is stored as event memory with temporal anchors and state descriptions, and detail-dense content is stored as record memory with a lightweight index and pointers to the original conversation, ensuring later traceability of fine-grained evidence.
The second stage is selective memory evolution, where the framework designs differentiated maintenance strategies for different memory representations. Profile memory stores stable user attributes, and record memory retains immutable source-based indexes; neither performs unnecessary merge or update operations. Only event memory—which represents continuous interaction processes and can be progressively refined through subsequent interactions—is allowed to undergo evolution, eliminating redundant overhead from repeatedly maintaining the full memory at its root.
The paper designs controlled ablation experiments targeting LeanMem's core component contributions, setting up five functional-deficiency variants, each removing one of five core modules: key statement filtering, topic segmentation, heterogeneous memory storage scheduling, event memory evolution, and demand-aware retrieval planning; all other experimental conditions remain identical to the full LeanMem version.
The query requirement tuple that supports demand-aware retrieval planning contains entities, attributes, temporal ordering, relational constraints, evidence requirement descriptions, the set of memory types needed, and the relative dependency weights of each memory type.
The ablation results for each component show that the absence of any core module brings varying degrees of performance loss and increased runtime overhead: removing key statement filtering introduces many non-informative dialogue turns, causing accuracy drops and higher token usage and latency; removing topic segmentation causes session-level inputs to mix different discussion content, generating coarser memory construction units, raising costs and severely degrading performance on the LongMemEval-S dataset; replacing heterogeneous memory storage scheduling with a unified summarization strategy causes the largest accuracy drop on both public benchmarks, LongMemEval-S and LoCoMo, while increasing token usage, validating that the differentiated minimal-sufficient memory representation is the framework's core design for balancing evidence retention and runtime efficiency; removing the event memory evolution module also causes明显明显 significant performance degradation on LongMemEval-S.
LeanMem's differentiated storage design avoids both typical defects of traditional long-term memory pipelines: it neither performs redundant processing on easily compressible information nor causes irreversible loss of fidelity-sensitive evidence information. Experimental validation on the two public benchmarks LoCoMo and LongMemEval-S shows that the framework can achieve more stable answer quality while reducing the combined overhead of the full chain from memory construction to inference.