Transformers在概念上被认为与上一代最先进的NLP模型——循环神经网络(RNNs)不同。在本研究中,我们证明仅解码器的transformers实际上可以被概念化为无界多状态RNNs——一种隐藏状态大小不受限的RNN变体。我们进一步表明,通过固定transformers的隐藏状态大小,可将其转换为有界多状态RNNs,从而有效压缩其键值缓存。我们提出了一种新颖的、无需训练的压缩策略——基于注意力的令牌省略(Token Omission Via Attention,TOVA)。我们在四项长距离任务和多个大语言模型(LLMs)上开展的实验表明,TOVA的性能优于多种基线压缩策略。值得注意的是,我们的结果几乎与完整模型相当,在某些情况下仅使用原始缓存大小的1/8,这意味着吞吐量提升了4.8倍。我们的研究结果阐明了transformers与RNNs之间的联系,并有助于缓解LLMs最棘手的计算瓶颈之一——键值缓存的大小问题。我们在https://github.com/schwartz-lab-NLP/TOVA公开发布了代码。
英文摘要:
Transformers are considered conceptually different from the previous generation of state-of-the-art NLP models - recurrent neural networks (RNNs). In this work, we demonstrate that decoder-only transformers can in fact be conceptualized as unbounded multi-state RNNs - an RNN variant with unlimited hidden state size. We further show that transformers can be converted into $\textit{bounded}$ multi-state RNNs by fixing the size of their hidden state, effectively compressing their key-value cache. We introduce a novel, training-free compression policy - $\textbf{T}$oken $\textbf{O}$mission $\textbf{V}$ia $\textbf{A}$ttention (TOVA). Our experiments with four long range tasks and several LLMs show that TOVA outperforms several baseline compression policies. Particularly, our results are nearly on par with the full model, using in some cases only $\frac{1}{8}$ of the original cache size, which translates to 4.8X higher throughput. Our results shed light on the connection between transformers and RNNs, and help mitigate one of LLMs' most painful computational bottlenecks - the size of their key-value cache. We publicly release our code at https://github.com/schwartz-lab-NLP/TOVA
Compositional Reasoning with Transformers, RNNs, and Chain of Thought
Courant Institute of Mathematical Sciences(Courant数学科学研究所);New York University(纽约大学);Center for Data Science(数据科学中心);Center for Computational Mathematics(计算数学中心);Flatiron Institute(Flatiron研究所)
Linguistic Knowledge and Transferability of Contextual Representations
Allen Institute for Artificial Intelligence(艾伦人工智能研究所);Harvard John A. Paulson School of Engineering and Applied Sciences(哈佛大学约翰·A·保尔森工程与应用科学学院);MIT Computer Science and Artificial Intelligence Laboratory(麻省理工学院计算机科学与人工智能实验室);University of Washington(华盛顿大学)
Paul G. Allen School of Computer Science & Engineering, University of Washington(华盛顿大学保罗·G·艾伦计算机科学与工程学院);Microsoft(微软);DeepMind;Allen Institute for AI(艾伦人工智能研究所)
Generative AI Commons(生成式人工智能公地);EleutherAI;U. of Barcelona(巴塞罗那大学);Charm Therapeutics(Charm Therapeutics公司);Ohio State U.(俄亥俄州立大学);U. of C., Santa Barbara(加州大学圣巴巴拉分校);Zendesk(Zendesk公司);Booz Allen Hamilton(博思艾伦汉密尔顿公司);Tsinghua University(清华大学);Peking University(北京大学);Crisis24(Crisis24公司);New York U.(纽约大学);National U. of Singapore(新加坡国立大学);Wroclaw U. of Science and Technology(弗罗茨瓦夫理工大学);Databaker Technology(数据面包科技);Purdue U.(普渡大学);Criteo AI Lab(Criteo人工智能实验室);Epita(法国计算机科学与技术高等学院);Nextremer(Nextremer公司);Moves(Moves公司);Yale U.(耶鲁大学);RuoxinTech(若芯科技);U. of Oslo(奥斯陆大学);U. of Science and Technology of China(中国科学技术大学);Kuaishou Technology(快手科技)
Exploring the Syntactic Abilities of RNNs with Multi-task Learning
PSL Research University(巴黎文理研究大学);Bar Ilan University(巴伊兰大学);CNRS(法国国家科学研究中心);EHESS(法国社会科学高等研究院);Johns Hopkins University(约翰斯·霍普金斯大学)
最近的工作已经探索了RNN的句法能力,使用主语-动词一致性任务,诊断对句子结构的敏感性。RNN在常见情况下很好地执行了这项任务,但在复杂句子中却表现不佳(Linzen et al.,2016年)。我们测试这些错误是否是由于固有的限制架构或相对间接的监督提供的大多数协议依赖于语料库。我们训练了一个RNN来执行协议任务和一个额外的任务,无论是CCG超级标记还是语言建模。多任务训练导致出错率显著降低,特别是在复杂句子上,这表明RNN有能力进化出比以前更复杂的句法表示。我们还表明,容易获得的协议训练数据可以提高其他语法任务的性能,特别是当只有有限的训练数据可用于这些任务。多任务范例还可以被利用来将语法知识注入到语言模型中。