arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2411.17685cs.LGcs.CL
收藏

Attamba:关注多token状态

Attamba: Attending To Multi-Token States

Cornell University(康奈尔大学);Google(谷歌公司)

Yash Akhauri, Safeen Huda, Mohamed S. Abdelfattah

AI总结:

针对普通transformer注意力计算量随序列长度二次方增长的问题,提出Attamba架构,用状态空间模型压缩token块并对压缩键值表示应用注意力,可提升模型质量、实现灵活分块,在相似计算量下困惑度提升24%,或在5%困惑度损失下减少4倍计算量。

摘要:

在预测序列中的下一个token时,普通transformer会对所有之前的token计算注意力,导致计算量随序列长度呈二次方增长。状态空间模型(SSMs)将整个token序列压缩为固定维度的表示以提高效率,而其他架构则通过低秩投影或序列上的稀疏注意力模式实现亚二次方复杂度。在本文中,我们介绍Attamba,一种新颖的架构,它使用状态空间模型压缩token块,并对这些压缩的键值表示应用注意力。我们发现,用SSMs替换transformer中的键和值投影可以提高模型质量并实现灵活的token分块,在KV缓存和注意力计算量相似的情况下,transformer的困惑度提高了24%;在困惑度损失5%的情况下,KV缓存和注意力浮点运算次数约减少4倍。Attamba可以对可变长度的分块序列执行注意力,实现二次方和线性缩放之间的平滑过渡,提供适应性效率提升。

英文摘要:

When predicting the next token in a sequence, vanilla transformers compute attention over all previous tokens, resulting in quadratic scaling of compute with sequence length. State-space models compress the entire sequence of tokens into a fixed-dimensional representation to improve efficiency, while other architectures achieve sub-quadratic complexity via low-rank projections or sparse attention patterns over the sequence. In this paper, we introduce Attamba, a novel architecture that uses state-space models to compress chunks of tokens and applies attention on these compressed key-value representations. We find that replacing key and value projections in a transformer with SSMs can improve model quality and enable flexible token chunking, resulting in 24% improved perplexity with transformer of similar KV-Cache and attention footprint, and ~4 times smaller KV-Cache and Attention FLOPs for 5% perplexity trade-off. Attamba can perform attention on chunked-sequences of variable length, enabling a smooth transition between quadratic and linear scaling, offering adaptable efficiency gains.

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

↑