Skip to yearly menu bar Skip to main content


Oral
in
Workshop: ES-FoMo II: 2nd Workshop on Efficient Systems for Foundation Models

Simple linear attention language models balance the recall-throughput tradeoff

Simran Arora · Sabri Eyuboglu · Michael Zhang · Aman Timalsina · Silas Alberti · Dylan Zinsley · James Zou · Atri Rudra · Christopher Re

[ ] [ Project Page ]
Fri 26 Jul 1:15 a.m. PDT — 1:30 a.m. PDT

Abstract: Abstract Recent work has shown that attention-based language models excel at "recall", the ability to ground generations in tokens previously seen in context. However, the efficiency of attention-based models is bottle-necked during inference by the KV-cache's aggressive memory consumption. In this work, we explore whether we can improve language model efficiency (e.g. by reducing memory consumption) without compromising on recall. By applying experiments and theory to a broad set of architectures, we identify a key tradeoff between a model's recurrent state size and recall ability. We show that efficient alternatives to attention (e.g. H3, Mamba, RWKV) maintain a fixed-size recurrent state, but struggle at recall. We propose BASED a simple architecture combining linear and sliding window attention. By varying BASED window size and linear attention feature dimension, we can dial the state size and traverse the Pareto frontier of the recall-memory tradeoff curve, recovering the full quality of attention on one end and the small state size of attention-alternatives on the other. We train language models up to $1.3$b parameters and show that BASED matches the strongest sub-quadratic models (e.g. Mamba) in perplexity and outperforms them on real-world recall-intensive tasks by 10.36 accuracy points. Implementations of linear attention are often less efficient than optimized standard attention implementations. To make BASED competitive, we develop IO-aware algorithms that enable $24\times$ higher throughput on language generation than FlashAttention-2, when generating 1024 tokens using $1.3$b parameter models. Overall, BASED extends the Pareto frontier of the throughput-recall tradeoff space. Our code is available at: https://github.com/HazyResearch/based

Chat is not available.