Large language models (LLMs) have shown remarkable capabilities, but still struggle with processing extensive contexts, limiting their ability to maintain coherence and accuracy over long sequences. In contrast, the human brain excels at organising and retrieving episodic experiences across vast temporal scales, spanning a lifetime. In this work, we introduce EM-LLM, a novel approach that integrates key aspects of human episodic memory and event cognition into LLMs, enabling them to effectively handle practically infinite context lengths while maintaining computational efficiency. EM-LLM organises sequences of tokens into coherent episodic events using a combination of Bayesian surprise and graph-theoretic boundary refinement in an on-line fashion. When needed, these events are retrieved through a two-stage memory process, combining similarity-based and temporally contiguous retrieval for efficient and human-like access to relevant information. Experiments on the LongBench dataset demonstrate EM-LLM's superior performance, outperforming the state-of-the-art InfLLM model with an overall relative improvement of 4.3% across various tasks, including a 33% improvement on the PassageRetrieval task. Furthermore, our analysis reveals strong correlations between EM-LLM's event segmentation and human-perceived events, suggesting a bridge between this artificial system and its biological counterpart. This work not only advances LLM capabilities in processing extended contexts but also provides a computational framework for exploring human memory mechanisms, opening new avenues for interdisciplinary research in AI and cognitive science.
翻译:大语言模型(LLMs)已展现出卓越的能力,但在处理长上下文时仍面临挑战,限制了其在长序列中保持连贯性与准确性的能力。相比之下,人脑擅长在跨越一生的时间尺度上组织和提取情景经验。本研究提出EM-LLM,一种将人类情景记忆与事件认知的关键特征整合到大语言模型中的新方法,使其在保持计算效率的同时能够有效处理近乎无限的上下文长度。EM-LLM通过在线方式结合贝叶斯惊奇度与图论边界优化,将词元序列组织为连贯的情景事件。当需要时,这些事件通过两阶段记忆过程进行检索,结合基于相似性和时间连续性的检索机制,实现高效且类人的相关信息访问。在LongBench数据集上的实验表明,EM-LLM性能优异,在各项任务中总体相对性能超越当前最先进的InfLLM模型4.3%,其中在PassageRetrieval任务上提升达33%。进一步分析显示,EM-LLM的事件分割结果与人类感知事件存在强相关性,表明该人工系统与其生物对应机制之间建立了桥梁。这项工作不仅提升了大语言模型处理长上下文的能力,还为探索人类记忆机制提供了计算框架,为人工智能与认知科学的跨学科研究开辟了新途径。