让大模型记忆更轻量高效,按内容特点分层存储与调用。
LeanMem: Simple and Efficient Long-Term Memory for LLM Agents

- 按信息特性分类存储:摘要、事件、原始记录分别处理。
- 推理时按需动态选内存,最高提升15.1分准确率。
- 适合需要长期交互的智能体,节省算力与延迟。
长时记忆对基于大模型的智能体持续交互和利用远期历史至关重要。现有记忆系统通常以统一方式处理异构对话内容,导致令牌消耗过大或细粒度证据不可逆丢失。我们提出,历史对话应根据可压缩性、时间动态性和保真度需求差异化处理。为此,我们设计了轻量级框架 LeanMem:先过滤低价值内容,再将信息片段分别存为紧凑的概要记忆、时序结构的事件记忆或源关联的记录记忆。维护时仅更新动态变化的事件记忆,避免稳定概要与固定记录的冗余固化。推理时,根据查询需求动态选择记忆类型并分配检索预算,按需组装证据。在 LoCoMo 与 LongMemEval-S 数据集上,使用 GPT-4.1-mini 与 Qwen3-8B,LeanMem 在所有设置下均优于最强基线,准确率最高提升 15.1 点,同时保持最低或接近最低的构建成本、推理令牌数与延迟。代码与数据集见附录。
原文摘要 · Abstract (English)
Long-term memory is essential for LLM-based agents to sustain interactions and reliably leverage distant history. However, existing memory systems typically process heterogeneous dialogue content through a uniform summarization and retrieval pipeline, leading to either excessive token consumption or irreversible loss of fine-grained evidence. We argue that historical dialogue content should be handled differently according to its compressibility, temporal dynamics, and fidelity requirements. Based on this insight, we propose LeanMem, a lightweight long-term memory framework. LeanMem first filters out low-value content, then stores informative segments as compact profile memory, temporally structured event memory, or source-grounded record memory, depending on the nature of the information. During maintenance, only dynamically evolving event memories are selectively updated, avoiding redundant consolidation of stable profiles and immutable records. During inference, LeanMem dynamically selects memory types and allocates retrieval budgets according to query-specific evidence demands, assembling relevant evidence on demand. On LoCoMo and LongMemEval-S with GPT-4.1-mini and Qwen3-8B, LeanMem improves accuracy over the strongest memory-based baseline in every setting, by up to 15.1 points, at the lowest or near-lowest construction cost, inference tokens, and latency. The code and datasets are included in the supplementary materials.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。