Transformer architectures have achieved state-of-the-art results on a variety of sequence modeling tasks. However, their attention mechanism comes with a quadratic complexity in sequence lengths, making the computational overhead prohibitive, especially for long sequences. Attention context can be seen as a random-access memory with each token taking a slot. Under this perspective, the memory size grows linearly with the sequence length, and so does the overhead of reading from it. One way to improve the efficiency is to bound the memory size. We show that disparate approaches can be subsumed into one abstraction, attention with bounded-memory control (ABC), and they vary in their organization of the memory. ABC reveals new, unexplored possibilities. First, it connects several efficient attention variants that would otherwise seem apart. Second, this abstraction gives new insights--an established approach (Wang et al., 2020b) previously thought to be not applicable in causal attention, actually is. Last, we present a new instance of ABC, which draws inspiration from existing ABC approaches, but replaces their heuristic memory-organizing functions with a learned, contextualized one. Our experiments on language modeling, machine translation, and masked language model finetuning show that our approach outperforms previous efficient attention models; compared to the strong transformer baselines, it significantly improves the inference time and space efficiency with no or negligible accuracy loss.
翻译:变形器结构在一系列序列建模任务中取得了最先进的结果。 然而, 它们的注意机制在序列长度上带有四重复杂度, 使得计算高转盘的难度很高, 特别是对于长序列来说。 注意环境可以被视为随机的存取存储器, 每一个符号取一个槽。 在这个角度下, 内存的大小随着序列长度的长度而线性地增长, 从中读取的间接费用也是这样。 提高效率的方法之一是将内存的大小捆绑起来。 我们显示, 差异性的方法可以包含在一个抽象的、 受约束的摩擦控制(ABC) 的注意, 它们在记忆的组织结构中也各不相同。 ABC 显示, ABC 显示的是新的、 新的、 尚未探索的可能性。 首先, 它把一些有效的关注变量连接在一起, 而不是随机的。 其次, 这个抽象的、 给新的、 固定的方法( Wang et al., 2020b) 和 从它读到因果关系上的注意, 事实上, 我们展示了一个新的ABC 实例, 它从现有的ABC 方法中汲取了灵感, 但是取代了他们的记忆- mind- im- mort- mort- changinginginginginging lical lavel laction maildolfortical laction mading lactioning coming coming coming coming mainal laus views