无键注意力:面向高效Transformer的值空间路由与仅值缓存
Keyless Attention: Value-Space Routing and Value-Only Caching for Efficient Transformers
AI总结:
提出无键注意力机制,通过消除键投影并仅使用查询和值,实现50%的KV缓存减少,同时匹配或超越标准注意力的解码吞吐量,并在多个模型上达到相当或更优的困惑度与下游任务性能。
摘要:
我们提出无键注意力(Keyless Attention),一种完全消除键投影的注意力机制,仅对查询和值进行操作。这产生了仅值缓存(Value-Only Cache),与标准注意力相比,将KV缓存内存和访问开销精确减少50%,同时匹配或超越标准注意力的解码吞吐量。除了效率提升,我们引入了深度$m$注意力分解(Depth-$m$ Attention Factorization):标准注意力计算注意力双线性形式的深度2分解,而无键注意力实现了该家族的深度$m$实例。在$m=3$时,无键注意力通过一个值空间路由矩阵(替代键投影)匹配标准注意力的投影矩阵数量,并引入了路由与检索之间的耦合。在五个模型和四种架构(GPT-2 280M、GPT-2 557M、Pythia 410M、Qwen2 1.5B和Llama 3.2 1B)上的实验表明,无键注意力在5个模型中的4个上匹配或超越了标准QKV注意力的困惑度。在下游零样本评估(GPT-2 557M)中,无键注意力在5个常识推理基准中的4个上表现更优,同时在整个过程中实现50%的KV缓存减少。
英文摘要:
Transformer architectures form the foundation of modern natural language processing, yet the Key-Value (KV) cache introduces substantial memory and bandwidth overhead during long-context generation, increasingly bottlenecking large-scale deployment. We propose Keyless Attention, a novel attention mechanism that replaces the conventional key projection with a dedicated value-space routing projection, eliminating key representations from the attention computation entirely and yielding a Value-Only Cache that reduces KV-cache memory by 50% while improving decode throughput. Experiments across multiple models and architectures demonstrate that Keyless Attention achieves comparable perplexity and downstream task performance to standard QKV attention, while consistently reducing KV-cache memory by 50%. Furthermore, Keyless Attention exhibits slower validation loss degradation after the best epoch, indicating improved robustness against overfitting. Ablation studies confirm that the dedicated value-space routing projection is critical, with Keyless Attention outperforming KV-sharing methods that eliminate the key cache without replacing its routing role. Experiments in the pretraining regime further confirm the viability of Keyless Attention in industrial settings.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。