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

混合联想记忆

Hybrid Associative Memories

Leon Lufkin, Tomás Figliolia, Beren Millidge, Kamesh Krishnamurthy

AI总结:

本文提出混合联想记忆层,结合自注意力和RNN,利用各自优势:RNN压缩整个序列,注意力补充难以预测的信息。通过精确控制KV缓存增长,实现高效的序列混合。

摘要:

递归神经网络(RNN)和自注意力都是广泛使用的序列混合层,它们维护内部记忆。然而,这种记忆由两种正交机制构建:RNN将整个过去压缩成固定大小的状态,而自注意力的状态存储每个时间步的增长状态(KV缓存)与序列长度线性增长。这导致了正交的优势和劣势。自注意力层在上下文信息检索中表现优异,但具有较大的内存和计算成本,而RNN更高效,但在更长的上下文中退化,并在精确回忆任务中表现不佳。先前结合这两种机制的工作主要集中在简单地交错它们以减少计算成本,而未考虑它们的互补机制。我们提出混合联想记忆(HAM)层,结合自注意力和RNN,利用各自的优势:RNN压缩整个序列,而注意力仅补充RNN难以预测的信息,即最有价值的信息。HAM层使KV缓存能够根据数据动态增长,用户可以通过单一连续阈值精确控制。我们发现,这种对KV缓存增长速率的细粒度控制与损失和性能之间存在平滑的权衡。实证表明,我们的混合架构在显著降低KV缓存使用的情况下,相对于RNN和Transformer表现出强大且具有竞争力的性能。

英文摘要:

Recurrent neural networks (RNNs) and self-attention are both widely used sequence-mixing layers that maintain an internal memory. However, this memory is constructed using two orthogonal mechanisms: RNNs compress the entire past into a fixed-size state, whereas self-attention's state stores every past time step growing its state (the KV cache) linearly with the sequence length. This results in orthogonal strengths and weaknesses. Self-attention layers excel at retrieving information in the context but have large memory and computational costs, while RNNs are more efficient but degrade over longer contexts and underperform for precise recall tasks. Prior work combining these mechanisms has focused primarily on naively interleaving them to reduce computational cost without regard to their complementary mechanisms. We propose the Hybrid Associative Memory (HAM) layer, which combines self-attention and RNNs while leveraging their individual strengths: the RNN compresses the entire sequence, while attention supplements it *only* with information that is difficult for the RNN to predict, which is hence the most valuable information to explicitly store. HAM layers enable data-dependent growth of the KV cache, which can be precisely controlled by the user with a single, continuous threshold. We find that this fine-grained control of the KV cache growth rate has a smooth trade-off with loss and performance. Empirically, we show that our hybrid architecture offers strong, competitive performance relative to RNNs and Transformers even at substantially lower KV-cache usage.

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

↑