Skip to main content
QUICK REVIEW

[论文解读] Think-in-Memory: Recalling and Post-thinking Enable LLMs with Long-Term Memory

Lei Liu, Xiaoyan Yang|arXiv (Cornell University)|Nov 15, 2023
Topic Modeling被引用 5
一句话总结

本文提出了一种新型的与大语言模型无关的外部记忆机制——思维记忆(Think-in-Memory, TiM),通过回忆与后思考过程存储并演化思想,实现长期记忆。通过消除对历史记录的重复推理,TiM 提升了长对话中的响应一致性和性能,实现高达 97.3% 的 top-10 检索准确率,相较于基线模型将检索时间减少了 0.1ms。

ABSTRACT

Memory-augmented Large Language Models (LLMs) have demonstrated remarkable performance in long-term human-machine interactions, which basically relies on iterative recalling and reasoning of history to generate high-quality responses. However, such repeated recall-reason steps easily produce biased thoughts, extit{i.e.}, inconsistent reasoning results when recalling the same history for different questions. On the contrary, humans can keep thoughts in the memory and recall them without repeated reasoning. Motivated by this human capability, we propose a novel memory mechanism called TiM (Think-in-Memory) that enables LLMs to maintain an evolved memory for storing historical thoughts along the conversation stream. The TiM framework consists of two crucial stages: (1) before generating a response, a LLM agent recalls relevant thoughts from memory, and (2) after generating a response, the LLM agent post-thinks and incorporates both historical and new thoughts to update the memory. Thus, TiM can eliminate the issue of repeated reasoning by saving the post-thinking thoughts as the history. Besides, we formulate the basic principles to organize the thoughts in memory based on the well-established operations, ( extit{i.e.}, insert, forget, and merge operations), allowing for dynamic updates and evolution of the thoughts. Furthermore, we introduce Locality-Sensitive Hashing into TiM to achieve efficient retrieval for the long-term conversations. We conduct qualitative and quantitative experiments on real-world and simulated dialogues covering a wide range of topics, demonstrating that equipping existing LLMs with TiM significantly enhances their performance in generating responses for long-term interactions.

研究动机与目标

  • 解决记忆增强型大语言模型在重复回忆相同历史记录时导致的推理不一致问题。
  • 使大语言模型能够维持历史思想的演化记忆,避免冗余推理。
  • 设计一种与大语言模型架构无关的记忆机制,支持动态记忆更新。
  • 提升真实世界与模拟对话中长期响应的质量与连贯性。
  • 引入基于局部敏感哈希(Locality-Sensitive Hashing)的高效检索机制,实现可扩展的长上下文对话。

提出的方法

  • 提出两阶段流程:(1) 在生成响应前从记忆中回忆相关思想,(2) 在生成后进行后思考并更新记忆。
  • 通过插入、遗忘与合并三种核心操作,在记忆中存储并演化思想,实现动态记忆演化。
  • 应用局部敏感哈希(LSH)以加速长期记忆中相关思想的检索。
  • 基于成熟原则组织记忆中的思想,确保一致性与可扩展性。
  • 无需修改大语言模型架构,即可将 TiM 集成至现有大语言模型中,实现与模型架构无关的部署。
  • 采用基于嵌入的相似性匹配进行检索,通过 LSH 优化以降低计算成本。

实验结果

研究问题

  • RQ1一种能够存储并演化思想的记忆机制,是否能有效减少大语言模型在长对话中因重复推理导致的推理不一致性?
  • RQ2在响应生成后进行后思考,如何提升记忆质量与响应一致性?
  • RQ3TiM 在真实世界医疗对话与多领域对话中,能在多大程度上提升响应正确性与上下文连贯性?
  • RQ4与标准的成对相似性计算相比,TiM 的检索机制效率如何?
  • RQ5在包括中文与英文对话在内的多样化领域中,TiM 是否优于基线记忆机制?

主要发现

  • TiM 在所有评估数据集上显著提升了响应正确性与上下文连贯性,包括 KdConv(电影、音乐、旅游)与 RMD(真实患者-医生对话)。
  • 在 KdConv 数据集中,TiM 实现了 97.3% 的 top-10 检索准确率,证明其在检索相关历史思想方面具有高度有效性。
  • 与基线的成对相似性计算相比,TiM 将每次查询的检索时间减少了约 0.1ms,展现出更高的效率。
  • TiM 的性能增益在中文对话中比英文对话更为显著,提示可能存在语言相关的潜在优势。
  • 在真实世界医疗应用中,TiM 支持的智能体能够避免遗忘关键症状,从而实现更准确、更全面的诊断。
  • 定性结果表明,TiM 通过模拟人类记忆的工作流程,帮助大语言模型生成更具人类特征、更一致且上下文连贯的响应。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。