Titans:在测试时学习记忆
Titans: Learning to Memorize at Test Time
AI总结:
本文提出Titans架构,通过引入可学习的神经长期记忆模块与注意力机制结合,解决Transformer上下文长度受限问题,在多个任务上超越现有模型并支持超长上下文。
摘要:
十多年来,关于如何有效利用循环模型和注意力机制已经有了大量研究工作。循环模型旨在将数据压缩到固定大小的记忆(称为隐藏状态)中,而注意力机制允许关注整个上下文窗口,捕捉所有 token 之间的直接依赖关系。然而,这种更精确的依赖建模带来了二次方的计算代价,将模型限制在固定长度的上下文中。我们提出了一种新的神经长期记忆模块,该模块学习记忆历史上下文,并帮助注意力机制在利用久远过去信息的同时关注当前上下文。我们表明,这种神经记忆具有快速可并行化训练的优势,同时保持快速推理。从记忆的角度来看,我们认为注意力机制由于其有限的上下文但精确的依赖建模,充当短期记忆;而神经记忆由于其记忆数据的能力,充当长期、更持久的记忆。基于这两个模块,我们引入了一个新的架构家族,称为 Titans,并提出三种变体来解决如何有效地将记忆融入该架构的问题。我们在语言建模、常识推理、基因组学和时间序列任务上的实验结果表明,Titans 比 Transformers 以及近期现代线性循环模型更有效。此外,与基线相比,它们能够有效扩展到超过 2M 上下文窗口大小,并在大海捞针任务中取得更高准确率。
英文摘要:
Over more than a decade there has been an extensive research effort on how to effectively utilize recurrent models and attention. While recurrent models aim to compress the data into a fixed-size memory (called hidden state), attention allows attending to the entire context window, capturing the direct dependencies of all tokens. This more accurate modeling of dependencies, however, comes with a quadratic cost, limiting the model to a fixed-length context. We present a new neural long-term memory module that learns to memorize historical context and helps attention to attend to the current context while utilizing long past information. We show that this neural memory has the advantage of fast parallelizable training while maintaining a fast inference. From a memory perspective, we argue that attention due to its limited context but accurate dependency modeling performs as a short-term memory, while neural memory due to its ability to memorize the data, acts as a long-term, more persistent, memory. Based on these two modules, we introduce a new family of architectures, called Titans, and present three variants to address how one can effectively incorporate memory into this architecture. Our experimental results on language modeling, common-sense reasoning, genomics, and time series tasks show that Titans are more effective than Transformers and recent modern linear recurrent models. They further can effectively scale to larger than 2M context window size with higher accuracy in needle-in-haystack tasks compared to baselines.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。