Papers › Simple linear attention language models balance the recall-throughput tradeoff

Simple linear attention language models balance the recall-throughput tradeoff

28 Feb 2024arXiv:2402.18668archive 2025-07-28

Simran Arora, Sabri Eyuboglu, Michael Zhang, Aman Timalsina, Silas Alberti, Dylan Zinsley, James Zou, Atri Rudra, Christopher Ré

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 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.3b 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 6.22 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 24x higher throughput on language generation than FlashAttention-2, when generating 1024 tokens using 1.3b parameter models. Code for this work is provided at: https://github.com/HazyResearch/based.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.18668")

Code

Syntology Ran 10 of 10 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 3 ran · our draft was wrong; 7 ran with no contract checked.

By repository: official repository: 9 samples from 1 repository, 9 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

hazyresearch/based officialmentioned in papermentioned on GitHubpytorch report
hazyresearch/zoology officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
HazyResearch/prefix-linear-attention mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 10 ran; 0 honoured the contract we drafted; 0 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · our draft was wrong
7ran

Licence: 1 of the 10 samples is pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from hazyresearch/zoology. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

compute_ce_with_embeddings hazyresearch/zoology/zoology/metrics.py official repository ran Apache-2.0 (permissive) · a65bb41664db0e54 · report
compute_mse hazyresearch/zoology/zoology/metrics.py official repository ran fingerprinted Apache-2.0 (permissive) · 262da45c48c24f7b · report
elu_p1 hazyresearch/zoology/zoology/mixers/delta_net.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · bc4bddefd7540078 · report
fetch_wandb_runs hazyresearch/zoology/zoology/analysis/utils.py official repository ran Apache-2.0 (permissive) · b65e20a414f96742 · report
flatten hazyresearch/zoology/zoology/utils.py official repository ran Apache-2.0 (permissive) · e66720e1309bfffc · report
import_from_str hazyresearch/zoology/zoology/utils.py official repository ran Apache-2.0 (permissive) · 24282d4941c8fc1f · report
sum_norm hazyresearch/zoology/zoology/mixers/delta_net.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · e544fdb6373b9f42 · report
unflatten hazyresearch/zoology/zoology/utils.py official repository ran Apache-2.0 (permissive) · fa6e454f96200975 · report
unflatten hazyresearch/zoology/zoology/analysis/utils.py official repository ran Apache-2.0 (permissive) · 50615df14da6c8bb · report
sliding_window_additions identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · 5b9fbe85e112d9c2 · report

Tasks

Language ModellingMambaText Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SET

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections