让大模型代理记忆更准更快,还能自动发现矛盾信息。
Accurate and Efficient Long-Term Memory for LLM Agents

- 用带类型实体的图结构存记忆,保留对话中的关系和时间线索。
- 用哈希加速检索,响应速度仅0.58秒,准确率几乎不降。
- 存新信息时主动查冲突,能检测66%的错误,远超现有方法。
增强持久记忆的大语言模型代理可回忆过往交互,但现有系统存在两大缺陷:扁平无结构的存储会丢失多跳与时间推理所需的上下文关系;依赖昂贵的LLM分类使系统难以用于低延迟场景。缺乏对新信息与已有知识的验证机制,导致系统悄然积累矛盾。我们提出MOSAIC(Memory-Organized Structured Agent for Information Collection),一种结构化、冲突感知的长期记忆框架,显著提升准确率与效率。MOSAIC引入三项核心能力:(1) 带实体类型的图存储,通过语义分类保留事件、人物及关系间的结构,支持跨对话的历史多跳与时间推理;(2) 哈希加速双路径检索,以局部敏感哈希替代LLM分类,实现近实时查询,精度损失极小;(3) 保存时主动检测冲突,将新信息与图中邻接节点交叉比对,触发矛盾条目的更新或删除。在LoCoMo(长对话问答)、HaluMem及新型临床指南错误累积测试中,MOSAIC在LoCoMo上达到89.35%准确率(较最优基线提升27.21个百分点),在HaluMem-Medium与HaluMem-Long上的提取F1分别达86.77%与85.84%,中长对话问答正确率分别为73.10%与70.75%,并检测到66%注入的事实冲突(为最优基线14%的4.7倍),同时哈希加速检索使平均搜索延迟维持在每问题0.58秒。
原文摘要 · Abstract (English)
LLM agents augmented with persistent memory can recall past interactions, but existing systems suffer from two limitations: flat, unstructured storage loses relational context needed for multi-hop and temporal reasoning, and reliance on expensive LLM-based classification makes them impractical for latency-sensitive deployment. Without mechanisms to validate new information against stored knowledge, these systems silently accumulate contradictions. We present MOSAIC (Memory-Organized Structured Agent for Information Collection), a structured, conflict-aware long-term memory framework for LLM agents that is substantially more accurate and efficient. MOSAIC introduces three key capabilities: (1) entity-typed graph storage with semantic classification preserving relational structure across events, personas, and relationships, enabling multi-hop and temporal reasoning over conversation history; (2) hash-accelerated dual-path retrieval replacing LLM-based classification with locality-sensitive hashing, achieving near-instantaneous lookup with negligible accuracy loss; and (3) active conflict detection at save time that cross-references new information against existing graph neighbors, triggering updates or deletions for contradictory entries. Evaluated on LoCoMo (long-conversation QA), HaluMem, and a novel clinical-guideline error compounding test, MOSAIC achieves 89.35% accuracy on LoCoMo (+27.21 pp over the best baseline), best HaluMem-Medium extraction F1(86.77%) and HaluMem-Long extraction F1 (85.84%), best QA correctness on both Medium and Long (73.10%, 70.75%), and detects 66% of injected factual conflicts-4.7 times higher than the best baseline (14%)-while hash-accelerated retrieval keeps average search latency at 0.58 s per question.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。