让大模型记忆像橡皮筋一样可伸缩,自动分配记忆资源提升推理能力。
ElasticMem: Latent Memory as a Learnable Resource for LLM Agents

- 记忆按需动态分配,通过学习策略决定用多少记忆空间。
- 在问答和智能体任务中,准确率提升超24%,且节省大量生成token。
- 适合需要长期记忆与个性化交互的AI助手、智能体系统开发。
长时记忆对大模型代理在长时间交互中保持连贯性、个性化回复和复用经验至关重要。现有方法通常将记忆视为固定资源:文本空间方法拼接检索到的记忆,导致大量token开销且易受噪声干扰;潜在空间方法虽降低文本成本,但仍依赖固定的检索机制或容量上限。这造成记忆使用效率与查询需求不匹配。我们提出ElasticMem,一种可学习的弹性潜在记忆框架。ElasticMem离线构建包含检索键和内容缓存的潜在记忆库,根据推理器隐藏状态自适应检索记忆,通过学习策略为每条记忆分配可变潜在预算,并将选中的潜在状态作为软记忆令牌注入生成过程。整个记忆使用流程通过下游任务奖励,采用组相对策略优化进行训练。我们在MemorySuite上评估,涵盖内存密集型问答与具身智能体控制任务。在Qwen2.5-3B-Instruct和Qwen2.5-7B-Instruct模型上,ElasticMem分别将加权平均问答准确率提升26.2%和24.6%,在ALFWorld任务中成功率提升66.3%和27.2%,同时实现最低的token消耗。消融实验与定性分析表明,自适应检索与弹性预算分配能有效优先选择有用证据与可迁移计划,超越固定余弦相似度限制。
原文摘要 · Abstract (English)
Long-term memory is essential for LLM agents to reason coherently across extended interactions, personalize responses, and reuse past experience. However, existing memory-augmented methods typically treat memory as a fixed resource: text-space approaches concatenate retrieved memories into the context window, causing substantial token overhead and sensitivity to noisy evidence, while latent-space approaches reduce textual cost but still rely on rigid retrieval or fixed-capacity memory interfaces. This creates a mismatch between query-dependent memory utility and fixed memory allocation. We propose ElasticMem, a memory-augmented LLM framework that learns to use memory as an elastic latent resource. ElasticMem builds an offline latent memory bank with retrieval keys and content caches, retrieves memories adaptively from the reasoner's hidden state, assigns each retrieved memory a variable latent budget through a learned policy, and injects selected latent states as soft memory tokens for generation. The full memory-use process is optimized with downstream task rewards through group-relative policy optimization. We evaluate ElasticMem on MemorySuite, covering memory-intensive QA and embodied agent control. Across Qwen2.5-3B-Instruct and Qwen2.5-7B-Instruct backbones, ElasticMem improves weighted average QA accuracy by 26.2% and 24.6%, and improves ALFWorld success rate by 66.3% and 27.2%, respectively, over the strongest baselines, while achieving the lowest ALFWorld token cost. Ablations and qualitative analyses further show that adaptive retrieval and elastic budget allocation help ElasticMem prioritize useful evidence and transferable plans beyond rigid cosine similarity. Our code for ElasticMem will be released at https://github.com/ulab-uiuc/ElasticMem.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。