arXiv:2603.22325cs.LGcs.AI2026-03被引 2

将RNN与自注意力结合,按需存储关键信息,显著降低内存占用。

Hybrid Associative Memories

  • 用RNN压缩序列,仅对难预测内容用注意力补充存储
  • KV缓存大小可由用户阈值精确控制,内存使用减少超50%
  • 适合长序列任务,兼顾效率与精准召回,适用于资源受限场景

循环神经网络(RNN)与自注意力机制均广泛用于序列建模,但其内部记忆构建方式截然不同:RNN将全部历史压缩为固定大小状态,而自注意力则随序列长度线性增长键值缓存(KV cache)。前者高效但长序列性能下降,后者记忆成本高且难以精确召回。现有融合方法多简单交替使用,未发挥互补优势。本文提出混合关联记忆(HAM)层,让RNN负责整体压缩,仅将难以预测的高价值信息通过注意力显式存储。该设计实现数据驱动的KV缓存增长,可通过单一连续阈值精细调控。实验表明,此方法在保持接近Transformer性能的同时,显著降低KV缓存使用量,在长序列任务中表现优异。

原文摘要 · Abstract (English)

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.

序列建模内存优化混合架构

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。