arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.02441cs.CLcs.AI
收藏

大型语言模型中的认知记忆

Cognitive Memory in Large Language Models

Li Auto(利亚 Auto)

Lianlei Shan, Shixian Luo, Zezhou Zhu, Yu Yuan, Yong Wu

AI总结:

本文系统梳理了大型语言模型中的记忆机制,将其分为感觉、短期和长期记忆,并详述了基于文本、KV缓存、参数及隐藏状态的记忆实现方法,旨在提升上下文响应、减少幻觉并提高效率。

摘要:

本文探讨了大型语言模型(LLMs)中的记忆机制,强调其对生成上下文丰富响应、减少幻觉以及提升效率的重要性。它将记忆分为感觉记忆、短期记忆和长期记忆三类,其中感觉记忆对应于输入提示,短期记忆处理即时上下文,而长期记忆则通过外部数据库或结构实现。基于文本的记忆部分涵盖了获取(选择与摘要)、管理(更新、访问、存储及冲突解决)以及利用(全文搜索、SQL查询、语义搜索)。基于KV缓存的记忆部分讨论了选择方法(基于规律性的摘要、基于评分的方法、特殊令牌嵌入)和压缩技术(低秩压缩、KV合并、多模态压缩),以及诸如卸载和共享注意力机制等管理策略。基于参数的记忆方法(如LoRA、TTT、MoE)将记忆转化为模型参数以提升效率,而基于隐藏状态的记忆方法(如分块机制、循环变压器、Mamba模型)则通过将RNN隐藏状态与当前方法相结合来改进长文本处理。总体而言,本文对LLM记忆机制进行了全面分析,强调了其重要性及未来研究方向。

英文摘要:

This paper examines memory mechanisms in Large Language Models (LLMs), emphasizing their importance for context-rich responses, reduced hallucinations, and improved efficiency. It categorizes memory into sensory, short-term, and long-term, with sensory memory corresponding to input prompts, short-term memory processing immediate context, and long-term memory implemented via external databases or structures. The text-based memory section covers acquisition (selection and summarization), management (updating, accessing, storing, and resolving conflicts), and utilization (full-text search, SQL queries, semantic search). The KV cache-based memory section discusses selection methods (regularity-based summarization, score-based approaches, special token embeddings) and compression techniques (low-rank compression, KV merging, multimodal compression), along with management strategies like offloading and shared attention mechanisms. Parameter-based memory methods (LoRA, TTT, MoE) transform memories into model parameters to enhance efficiency, while hidden-state-based memory approaches (chunk mechanisms, recurrent transformers, Mamba model) improve long-text processing by combining RNN hidden states with current methods. Overall, the paper offers a comprehensive analysis of LLM memory mechanisms, highlighting their significance and future research directions.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑